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 BlackDuckConfig
- type Config
- type ConfigManager
- type Host
- type HubManager
- func (hm *HubManager) FinishScanClient(hubURL string, scanName string, scanErr error) error
- func (hm *HubManager) HubClients() map[string]*hub.Hub
- func (hm *HubManager) ScanResults() map[string]map[string]*hub.Scan
- func (hm *HubManager) SetHubs(hubs map[string]*Host)
- 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, error)
- 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 PerceptorConfig
- 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 .....
func RunPerceptor ¶ added in v0.0.10
func RunPerceptor(configPath string)
RunPerceptor starts the perceptor
Types ¶
type BlackDuckConfig ¶
BlackDuckConfig handles BlackDuck-specific configuration
type Config ¶
type Config struct { BlackDuck *BlackDuckConfig Perceptor *PerceptorConfig LogLevel string }
Config stores the input perceptor configuration
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 returns the configuration manager
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 Host ¶
type Host struct { Scheme string Domain string // it can be domain name or ip address Port int User string Password string ConcurrentScanLimit int }
Host configures the Black Duck hosts
type HubManager ¶
type HubManager struct {
// contains filtered or unexported fields
}
HubManager stores the Black Duck Manager configuration
func NewHubManager ¶
func NewHubManager(newHub hubClientCreator, stop <-chan struct{}) *HubManager
NewHubManager returns the new Black Duck Manager configuration
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.Hub
HubClients returns the list of Black Duck instance
func (*HubManager) ScanResults ¶
func (hm *HubManager) ScanResults() map[string]map[string]*hub.Scan
ScanResults returns the scan results
func (*HubManager) SetHubs ¶
func (hm *HubManager) SetHubs(hubs map[string]*Host)
SetHubs setup the Black Duck
func (*HubManager) StartScanClient ¶
func (hm *HubManager) StartScanClient(hubURL string, scanName string) error
StartScanClient starts the Black Duck client
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(hubs map[string]*Host) HubClients() map[string]*hub.Hub 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 includes all methods related to setup the Black Duck
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 returns the next image from the queue
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 logs the http client not found error
func (*Perceptor) PostCommand ¶
func (pcp *Perceptor) PostCommand(command *api.PostCommand)
PostCommand resets the circuit breaker
func (*Perceptor) PostFinishScan ¶
func (pcp *Perceptor) PostFinishScan(job api.FinishedScanClientJob) error
PostFinishScan executes the post finished scan job
func (*Perceptor) UpdateAllImages ¶
UpdateAllImages updates all images in the model
func (*Perceptor) UpdateAllPods ¶
UpdateAllPods updates all pods in the model
func (*Perceptor) UpdateConfig ¶
UpdateConfig ...
type PerceptorConfig ¶
PerceptorConfig stores the perceptor configuration
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 {
HubManager HubManagerInterface
}
ScanScheduler stores the scan scheduler
func (*ScanScheduler) AssignImage ¶
func (s *ScanScheduler) AssignImage(image *m.Image) *hub.Hub
AssignImage finds a Hub that is available to scan `image`.
type Timings ¶
type Timings struct { CheckForStalledScansPauseHours int StalledScanClientTimeoutHours int ModelMetricsPauseSeconds int UnknownImagePauseMilliseconds int ClientTimeoutMilliseconds int }
Timings stores all timings configuration that is used for various operations
func (*Timings) CheckForStalledScansPause ¶
CheckForStalledScansPause returns an interval in hours to check the stalled scans
func (*Timings) ClientTimeout ¶
ClientTimeout returns the Black Duck client timeout
func (*Timings) ModelMetricsPause ¶
ModelMetricsPause returns an interval to pause the model metrics
func (*Timings) StalledScanClientTimeout ¶
StalledScanClientTimeout returns client timeout in hours for the stalled scans
func (*Timings) UnknownImagePause ¶
UnknownImagePause returns an interval in milliseconds to check for unknown images