Documentation
¶
Index ¶
- func RunFromInsideCluster()
- func RunLocally(kubeconfigPath string)
- type HTTPResponder
- func (hr *HTTPResponder) AddImage(image common.Image)
- func (hr *HTTPResponder) AddPod(pod common.Pod)
- func (hr *HTTPResponder) DeletePod(qualifiedName string)
- func (hr *HTTPResponder) Error(w http.ResponseWriter, r *http.Request, err error, statusCode int)
- func (hr *HTTPResponder) GetMetrics(w http.ResponseWriter, r *http.Request)
- func (hr *HTTPResponder) GetModel() string
- func (hr *HTTPResponder) GetNextImage(continuation func(nextImage api.NextImage))
- func (hr *HTTPResponder) GetScanResults() api.ScanResults
- func (hr *HTTPResponder) NotFound(w http.ResponseWriter, r *http.Request)
- func (hr *HTTPResponder) PostFinishScan(job api.FinishedScanClientJob)
- func (hr *HTTPResponder) UpdateAllPods(allPods api.AllPods)
- func (hr *HTTPResponder) UpdatePod(pod common.Pod)
- type HubImageScan
- type ImageScanResults
- type Model
- type Perceptor
- type PerceptorConfig
- type ScanStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunFromInsideCluster ¶
func RunFromInsideCluster()
func RunLocally ¶
func RunLocally(kubeconfigPath string)
Types ¶
type HTTPResponder ¶
type HTTPResponder struct {
// contains filtered or unexported fields
}
HTTPResponder ...
func NewHTTPResponder ¶
func NewHTTPResponder(model <-chan Model, metricsHandler *metrics) *HTTPResponder
func (*HTTPResponder) AddImage ¶
func (hr *HTTPResponder) AddImage(image common.Image)
func (*HTTPResponder) AddPod ¶
func (hr *HTTPResponder) AddPod(pod common.Pod)
func (*HTTPResponder) DeletePod ¶
func (hr *HTTPResponder) DeletePod(qualifiedName string)
func (*HTTPResponder) Error ¶
func (hr *HTTPResponder) Error(w http.ResponseWriter, r *http.Request, err error, statusCode int)
func (*HTTPResponder) GetMetrics ¶
func (hr *HTTPResponder) GetMetrics(w http.ResponseWriter, r *http.Request)
func (*HTTPResponder) GetModel ¶
func (hr *HTTPResponder) GetModel() string
func (*HTTPResponder) GetNextImage ¶
func (hr *HTTPResponder) GetNextImage(continuation func(nextImage api.NextImage))
func (*HTTPResponder) GetScanResults ¶
func (hr *HTTPResponder) GetScanResults() api.ScanResults
func (*HTTPResponder) NotFound ¶
func (hr *HTTPResponder) NotFound(w http.ResponseWriter, r *http.Request)
func (*HTTPResponder) PostFinishScan ¶
func (hr *HTTPResponder) PostFinishScan(job api.FinishedScanClientJob)
func (*HTTPResponder) UpdateAllPods ¶
func (hr *HTTPResponder) UpdateAllPods(allPods api.AllPods)
func (*HTTPResponder) UpdatePod ¶
func (hr *HTTPResponder) UpdatePod(pod common.Pod)
type ImageScanResults ¶
type ImageScanResults struct {
ScanStatus ScanStatus
ScanResults *hub.ImageScan
}
func NewImageScanResults ¶
func NewImageScanResults() *ImageScanResults
type Model ¶
type Model struct {
// Pods is a map of "<namespace>/<name>" to pod
Pods map[string]common.Pod
Images map[common.Image]*ImageScanResults
ImageScanQueue []common.Image
ImageHubCheckQueue []common.Image
ConcurrentScanLimit int
}
Model is the root of the core model
func (*Model) AddImage ¶
AddImage adds an image to the model, sets its status to NotScanned, and adds it to the queue for hub checking.
func (*Model) AddPod ¶
AddPod adds a pod and all the images in a pod to the model. If the pod is already present in the model, it will be removed and a new one created in its place. The key is the combination of the pod's namespace and name. It extract the containers and images from the pod, adding them into the cache.
func (Model) MarshalJSON ¶
type Perceptor ¶
type Perceptor struct {
// contains filtered or unexported fields
}
Perceptor ties together: a cluster, scan clients, and a hub. It listens to the cluster to learn about new pods. It keeps track of pods, containers, images, and scan results in a model. It has the hub scan images that have never been seen before. It grabs the scan results from the hub and adds them to its model. It publishes vulnerabilities that the cluster can find out about.
func NewMockedPerceptor ¶
NewMockedPerceptor creates a Perceptor which uses a mock scanclient
func NewPerceptor ¶
func NewPerceptor(cfg *PerceptorConfig) (*Perceptor, error)
NewPerceptor creates a Perceptor using a real hub client.
type PerceptorConfig ¶
PerceptorConfig contains all configuration for Perceptor
func GetPerceptorConfig ¶
func GetPerceptorConfig() (*PerceptorConfig, error)
GetPerceptorConfig returns a configuration object to configure Perceptor
func (*PerceptorConfig) StartWatch ¶
func (p *PerceptorConfig) StartWatch(handler func(fsnotify.Event))
StartWatch will start watching the Perceptor configuration file and call the passed handler function when the configuration file has changed
type ScanStatus ¶
type ScanStatus int
ScanStatus describes the state of an image -- have we checked the hub for it? Have we scanned it? Are we scanning it?
const ( ScanStatusUnknown ScanStatus = iota ScanStatusInHubCheckQueue ScanStatus = iota ScanStatusCheckingHub ScanStatus = iota ScanStatusInQueue ScanStatus = iota ScanStatusRunningScanClient ScanStatus = iota ScanStatusRunningHubScan ScanStatus = iota ScanStatusComplete ScanStatus = iota ScanStatusError ScanStatus = iota )
Allowed transitions:
- Unknown -> InHubCheckQueue
- InHubCheckQueue -> CheckingHub
- CheckingHub -> InQueue
- CheckingHub -> Complete
- InQueue -> RunningScanClient
- RunningScanClient -> Error
- RunningScanClient -> RunningHubScan
- RunningHubScan -> Error
- RunningHubScan -> Complete
- Error -> ??? throw it back into the queue?
func (ScanStatus) String ¶
func (status ScanStatus) String() string