Documentation
¶
Index ¶
- func RunPerceptor()
- 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) GetModel() string
- func (hr *HTTPResponder) GetNextImage() 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) SetConcurrentScanLimit(limit api.SetConcurrentScanLimit)
- func (hr *HTTPResponder) UpdateAllImages(allImages api.AllImages)
- func (hr *HTTPResponder) UpdateAllPods(allPods api.AllPods)
- func (hr *HTTPResponder) UpdatePod(apiPod api.Pod)
- type HubImageScan
- type Image
- func (image Image) HubProjectName() string
- func (image Image) HubProjectNameSearchString() string
- func (image Image) HubProjectVersionName() string
- func (image Image) HubProjectVersionNameSearchString() string
- func (image Image) HubScanName() string
- func (image Image) HubScanNameSearchString() string
- func (image *Image) HumanReadableName() string
- func (image *Image) PullSpec() string
- type ImageInfo
- type Model
- type ModelMetrics
- type Perceptor
- type PerceptorConfig
- type Pod
- type ScanStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunPerceptor ¶ added in v0.0.10
func RunPerceptor()
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 {
AddPodChannel chan Pod
UpdatePodChannel chan Pod
DeletePodChannel chan string
AddImageChannel chan Image
AllPodsChannel chan []Pod
AllImagesChannel chan []Image
PostNextImageChannel chan func(*Image)
PostFinishScanJobChannel chan api.FinishedScanClientJob
SetConcurrentScanLimitChannel chan int
GetModelChannel chan func(json string)
GetScanResultsChannel chan func(scanResults api.ScanResults)
}
HTTPResponder ...
func NewHTTPResponder ¶
func NewHTTPResponder() *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) GetModel ¶
func (hr *HTTPResponder) GetModel() string
func (*HTTPResponder) GetNextImage ¶
func (hr *HTTPResponder) GetNextImage() api.NextImage
func (*HTTPResponder) GetScanResults ¶
func (hr *HTTPResponder) GetScanResults() api.ScanResults
GetScanResults returns results for:
- all images that have a scan status of complete
- all pods for which all their images have a scan status of complete
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) SetConcurrentScanLimit ¶ added in v0.0.7
func (hr *HTTPResponder) SetConcurrentScanLimit(limit api.SetConcurrentScanLimit)
func (*HTTPResponder) UpdateAllImages ¶ added in v0.0.7
func (hr *HTTPResponder) UpdateAllImages(allImages api.AllImages)
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) HubProjectNameSearchString ¶ added in v0.0.7
func (Image) HubProjectVersionName ¶ added in v0.0.5
func (Image) HubProjectVersionNameSearchString ¶ added in v0.0.7
func (Image) HubScanName ¶ added in v0.0.5
func (Image) HubScanNameSearchString ¶ added in v0.0.7
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
TimeOfLastStatusChange time.Time
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
Config PerceptorConfig
HubVersion string
}
Model is the root of the core model
func NewModel ¶
func NewModel(config PerceptorConfig, hubVersion string) *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 ModelMetrics ¶ added in v0.0.8
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 hub
func NewPerceptor ¶
func NewPerceptor(config PerceptorConfig) (*Perceptor, error)
NewPerceptor creates a Perceptor using a real hub client.
type PerceptorConfig ¶
type PerceptorConfig struct {
HubHost string
HubUser string
HubUserPassword string
ConcurrentScanLimit int
UseMockMode bool
Port int
}
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 in perceptor
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 )
func (ScanStatus) MarshalJSON ¶ added in v0.0.8
func (s ScanStatus) MarshalJSON() ([]byte, error)
func (ScanStatus) MarshalText ¶ added in v0.0.8
func (s ScanStatus) MarshalText() (text []byte, err error)
func (ScanStatus) String ¶
func (status ScanStatus) String() string