Documentation
¶
Index ¶
- func RunFromInsideCluster()
- func RunLocally(kubeconfigPath string)
- type Container
- type DockerImageSha
- type HTTPResponder
- func (hr *HTTPResponder) AddImage(apiImage api.Image)
- func (hr *HTTPResponder) AddPod(apiPod api.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(apiPod api.Pod)
- type HubImageScan
- type Image
- type ImageInfo
- type Model
- type Perceptor
- type PerceptorConfig
- type Pod
- 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 Container ¶ added in v0.0.5
func NewContainer ¶ added in v0.0.5
type DockerImageSha ¶ added in v0.0.5
type DockerImageSha string
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(apiImage api.Image)
func (*HTTPResponder) AddPod ¶
func (hr *HTTPResponder) AddPod(apiPod api.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(apiPod api.Pod)
type HubImageScan ¶
type HubImageScan struct {
Sha DockerImageSha
Scan *hub.ImageScan
}
type Image ¶ added in v0.0.5
type Image struct {
// Name combines Host, User, and Project
Name string
Sha DockerImageSha
}
func NewImage ¶ added in v0.0.5
func NewImage(name string, sha DockerImageSha) *Image
func (Image) HubProjectName ¶ added in v0.0.5
func (Image) HubProjectVersionName ¶ added in v0.0.5
func (Image) HubScanName ¶ added in v0.0.5
func (*Image) HumanReadableName ¶ added in v0.0.5
HumanReadableName returns a nice, easy to read string
type ImageInfo ¶ added in v0.0.5
type ImageInfo struct {
ScanStatus ScanStatus
ScanResults *hub.ImageScan
ImageSha DockerImageSha
ImageNames []string
}
func NewImageInfo ¶ added in v0.0.5
func NewImageInfo(sha DockerImageSha, imageName string) *ImageInfo
type Model ¶
type Model struct {
// Pods is a map of "<namespace>/<name>" to pod
Pods map[string]Pod
Images map[DockerImageSha]*ImageInfo
ImageScanQueue []Image
ImageHubCheckQueue []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.
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 Pod ¶ added in v0.0.5
func (*Pod) QualifiedName ¶ added in v0.0.5
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