Documentation
¶
Index ¶
- func CoreContainerToApiContainer(coreContainer Container) *api.Container
- func CorePodToApiPod(corePod Pod) *api.Pod
- func IsLegalTransition(from ScanStatus, to ScanStatus) bool
- type Config
- type Container
- type DockerImageSha
- 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 ImageScan
- type Model
- func (model *Model) APIModel() *api.Model
- func (model *Model) AddImage(image Image)
- func (model *Model) AddPod(newPod Pod)
- func (model *Model) DeletePod(podName string)
- func (model *Model) FinishRunningScanClient(image *Image, scanClientError error)
- func (model *Model) GetNextImageFromHubCheckQueue() *Image
- func (model *Model) GetNextImageFromScanQueue() *Image
- func (model *Model) InProgressHubScans() []Image
- func (model *Model) InProgressScanCount() int
- func (model *Model) InProgressScans() []DockerImageSha
- func (model *Model) Metrics() *ModelMetrics
- func (model *Model) ScanResults() api.ScanResults
- func (model *Model) ScanResultsForImage(sha DockerImageSha) (*ImageScan, error)
- func (model *Model) ScanResultsForPod(podName string) (*PodScan, error)
- func (model *Model) SetImageScanStatus(sha DockerImageSha, newScanStatus ScanStatus)
- type ModelMetrics
- type Pod
- type PodScan
- type ScanStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CoreContainerToApiContainer ¶ added in v0.0.17
func CorePodToApiPod ¶ added in v0.0.17
func IsLegalTransition ¶ added in v0.0.15
func IsLegalTransition(from ScanStatus, to ScanStatus) bool
Types ¶
type Config ¶
type Config struct {
HubHost string
HubUser string
HubUserPasswordEnvVar string
ConcurrentScanLimit int
UseMockMode bool
Port int
LogLevel string
}
Config contains all configuration for Perceptor
func (*Config) StartWatch ¶
StartWatch will start watching the Perceptor configuration file and call the passed handler function when the configuration file has changed
type DockerImageSha ¶
type DockerImageSha string
type HubImageScan ¶
type HubImageScan struct {
Sha DockerImageSha
Scan *hub.ImageScan
Err error
}
type Image ¶
type Image struct {
// Name combines Host, User, and Project
Name string
Sha DockerImageSha
}
func ApiImageToCoreImage ¶
func NewImage ¶
func NewImage(name string, sha DockerImageSha) *Image
func (Image) HubProjectName ¶
func (Image) HubProjectNameSearchString ¶
func (Image) HubProjectVersionName ¶
func (Image) HubProjectVersionNameSearchString ¶
func (Image) HubScanName ¶
func (Image) HubScanNameSearchString ¶
func (*Image) HumanReadableName ¶
HumanReadableName returns a nice, easy to read string
type ImageInfo ¶
type ImageInfo struct {
ScanStatus ScanStatus
TimeOfLastStatusChange time.Time
ScanResults *hub.ImageScan
ImageSha DockerImageSha
ImageNames []string
}
func NewImageInfo ¶
func NewImageInfo(sha DockerImageSha, imageName string) *ImageInfo
func (*ImageInfo) AddImageName ¶
func (*ImageInfo) FirstImageName ¶
func (*ImageInfo) TimeInCurrentScanStatus ¶
type ImageScan ¶ added in v0.0.17
type ImageScan struct {
OverallStatus hub.PolicyStatusType
PolicyViolations int
Vulnerabilities int
}
type Model ¶
type Model struct {
// Pods is a map of "<namespace>/<name>" to pod
Pods map[string]Pod
Images map[DockerImageSha]*ImageInfo
ImageScanQueue []DockerImageSha
ImageHubCheckQueue []DockerImageSha
ConcurrentScanLimit int
Config *Config
HubVersion string
}
Model is the root of the core model
func (*Model) AddImage ¶
AddImage adds an image to the model, adding 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 extracts the containers and images from the pod, adding them into the cache.
func (*Model) FinishRunningScanClient ¶
func (*Model) GetNextImageFromHubCheckQueue ¶
func (*Model) GetNextImageFromScanQueue ¶
func (*Model) InProgressHubScans ¶
func (*Model) InProgressScanCount ¶
func (*Model) InProgressScans ¶
func (model *Model) InProgressScans() []DockerImageSha
func (*Model) Metrics ¶
func (model *Model) Metrics() *ModelMetrics
func (*Model) ScanResults ¶
func (model *Model) ScanResults() api.ScanResults
func (*Model) ScanResultsForImage ¶ added in v0.0.17
func (model *Model) ScanResultsForImage(sha DockerImageSha) (*ImageScan, error)
func (*Model) ScanResultsForPod ¶
func (*Model) SetImageScanStatus ¶ added in v0.0.15
func (model *Model) SetImageScanStatus(sha DockerImageSha, newScanStatus ScanStatus)
type ModelMetrics ¶
type ModelMetrics struct {
ScanStatusCounts map[ScanStatus]int
NumberOfPods int
NumberOfImages int
ContainerCounts map[int]int
ImageCountHistogram map[int]int
PodStatus map[string]int
ImageStatus map[string]int
PodPolicyViolations map[int]int
ImagePolicyViolations map[int]int
PodVulnerabilities map[int]int
ImageVulnerabilities map[int]int
}
type ScanStatus ¶
type ScanStatus int
ScanStatus describes the state of an image in perceptor
const ( ScanStatusUnknown ScanStatus = iota ScanStatusInHubCheckQueue ScanStatus = iota ScanStatusInQueue ScanStatus = iota ScanStatusRunningScanClient ScanStatus = iota ScanStatusRunningHubScan ScanStatus = iota ScanStatusComplete ScanStatus = iota )
func (ScanStatus) MarshalJSON ¶
func (s ScanStatus) MarshalJSON() ([]byte, error)
func (ScanStatus) MarshalText ¶
func (s ScanStatus) MarshalText() (text []byte, err error)
func (ScanStatus) String ¶
func (status ScanStatus) String() string