Documentation
¶
Index ¶
- func APIContainerToCoreContainer(apiContainer api.Container) (*model.Container, error)
- func APIImageToCoreImage(apiImage api.Image) (*model.Image, error)
- func APIPodToCorePod(apiPod api.Pod) (*model.Pod, error)
- func RunPerceptor(configPath string)
- type Config
- type ConfigManager
- type HubConfig
- type HubManager
- func (hm *HubManager) FinishScanClient(hubURL string, scanName string, scanErr error) error
- func (hm *HubManager) HubClients() map[string]hub.ClientInterface
- func (hm *HubManager) ScanResults() map[string]map[string]*hub.Scan
- func (hm *HubManager) SetHubs(hubURLs []string)
- func (hm *HubManager) StartScanClient(hubURL string, scanName string) error
- func (hm *HubManager) Updates() <-chan *Update
- type HubManagerInterface
- type Perceptor
- func (pcp *Perceptor) AddImage(apiImage api.Image) error
- func (pcp *Perceptor) AddPod(apiPod api.Pod) error
- func (pcp *Perceptor) DeletePod(qualifiedName string)
- func (pcp *Perceptor) Error(w http.ResponseWriter, r *http.Request, err error, statusCode int)
- func (pcp *Perceptor) GetModel() api.Model
- func (pcp *Perceptor) GetNextImage() api.NextImage
- func (pcp *Perceptor) GetScanResults() api.ScanResults
- func (pcp *Perceptor) NotFound(w http.ResponseWriter, r *http.Request)
- func (pcp *Perceptor) PostCommand(command *api.PostCommand)
- func (pcp *Perceptor) PostFinishScan(job api.FinishedScanClientJob) error
- func (pcp *Perceptor) UpdateAllImages(allImages api.AllImages) error
- func (pcp *Perceptor) UpdateAllPods(allPods api.AllPods) error
- func (pcp *Perceptor) UpdateConfig(config *Config)
- func (pcp *Perceptor) UpdatePod(apiPod api.Pod) error
- type RoutineTaskManager
- type ScanScheduler
- type Timings
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIContainerToCoreContainer ¶
APIContainerToCoreContainer .....
func APIImageToCoreImage ¶
APIImageToCoreImage .....
func APIPodToCorePod ¶
APIPodToCorePod .....
Types ¶
type ConfigManager ¶
type ConfigManager struct {
ConfigPath string
// contains filtered or unexported fields
}
ConfigManager handles:
- getting initial config
- reporting ongoing changes to config
func NewConfigManager ¶
func NewConfigManager(configPath string, stop <-chan struct{}) *ConfigManager
NewConfigManager ...
func (*ConfigManager) DidReadConfig ¶
func (cm *ConfigManager) DidReadConfig() <-chan *Config
DidReadConfig ...
func (*ConfigManager) GetConfig ¶
func (cm *ConfigManager) GetConfig() (*Config, error)
GetConfig returns a configuration object to configure Perceptor
type HubConfig ¶
type HubConfig struct {
Hosts []string
User string
PasswordEnvVar string
ClientTimeoutMilliseconds int
Port int
ConcurrentScanLimit int
TotalScanLimit int
}
HubConfig handles Hub-specific configuration
func (*HubConfig) ClientTimeout ¶
ClientTimeout converts the milliseconds to a duration
type HubManager ¶
type HubManager struct {
// contains filtered or unexported fields
}
HubManager ...
func NewHubManager ¶
func NewHubManager(newHub hubClientCreator, stop <-chan struct{}) *HubManager
NewHubManager ...
func (*HubManager) FinishScanClient ¶
func (hm *HubManager) FinishScanClient(hubURL string, scanName string, scanErr error) error
FinishScanClient tells the appropriate hub client to start polling for scan completion.
func (*HubManager) HubClients ¶
func (hm *HubManager) HubClients() map[string]hub.ClientInterface
HubClients ...
func (*HubManager) ScanResults ¶
func (hm *HubManager) ScanResults() map[string]map[string]*hub.Scan
ScanResults ...
func (*HubManager) StartScanClient ¶
func (hm *HubManager) StartScanClient(hubURL string, scanName string) error
StartScanClient ...
func (*HubManager) Updates ¶
func (hm *HubManager) Updates() <-chan *Update
Updates returns a read-only channel of the combined update stream of each hub.
type HubManagerInterface ¶
type HubManagerInterface interface {
SetHubs(hubURLs []string)
HubClients() map[string]hub.ClientInterface
StartScanClient(hubURL string, scanName string) error
FinishScanClient(hubURL string, scanName string, err error) error
ScanResults() map[string]map[string]*hub.Scan
Updates() <-chan *Update
}
HubManagerInterface ...
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 NewPerceptor ¶
func NewPerceptor(config *Config, timings *Timings, scanScheduler *ScanScheduler, hubManager HubManagerInterface) (*Perceptor, error)
NewPerceptor creates a Perceptor using a real hub client.
func (*Perceptor) GetNextImage ¶
GetNextImage .....
func (*Perceptor) GetScanResults ¶
func (pcp *Perceptor) 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 (*Perceptor) NotFound ¶
func (pcp *Perceptor) NotFound(w http.ResponseWriter, r *http.Request)
NotFound .....
func (*Perceptor) PostCommand ¶
func (pcp *Perceptor) PostCommand(command *api.PostCommand)
PostCommand .....
func (*Perceptor) PostFinishScan ¶
func (pcp *Perceptor) PostFinishScan(job api.FinishedScanClientJob) error
PostFinishScan .....
func (*Perceptor) UpdateAllImages ¶
UpdateAllImages .....
func (*Perceptor) UpdateAllPods ¶
UpdateAllPods .....
func (*Perceptor) UpdateConfig ¶
UpdateConfig ...
type RoutineTaskManager ¶
type RoutineTaskManager struct {
// contains filtered or unexported fields
}
RoutineTaskManager manages routine tasks
func NewRoutineTaskManager ¶
func NewRoutineTaskManager(stop <-chan struct{}, timings *Timings) *RoutineTaskManager
NewRoutineTaskManager ...
func (*RoutineTaskManager) GetTimings ¶
func (rtm *RoutineTaskManager) GetTimings() (*Timings, error)
GetTimings gets the timings in a threadsafe way
func (*RoutineTaskManager) SetTimings ¶
func (rtm *RoutineTaskManager) SetTimings(newTimings *Timings)
SetTimings sets the timings in a threadsafe way
type ScanScheduler ¶
type ScanScheduler struct {
TotalScanLimit int
ConcurrentScanLimit int
HubManager HubManagerInterface
}
ScanScheduler ...
func (*ScanScheduler) AssignImage ¶
func (s *ScanScheduler) AssignImage(image *m.Image) hub.ClientInterface
AssignImage finds a Hub that is available to scan `image`.
type Timings ¶
type Timings struct {
CheckForStalledScansPauseHours int
StalledScanClientTimeoutHours int
ModelMetricsPauseSeconds int
UnknownImagePauseMilliseconds int
}
Timings ...
func (*Timings) CheckForStalledScansPause ¶
CheckForStalledScansPause ...
func (*Timings) ModelMetricsPause ¶
ModelMetricsPause ...
func (*Timings) StalledScanClientTimeout ¶
StalledScanClientTimeout ...
func (*Timings) UnknownImagePause ¶
UnknownImagePause ...