Documentation
¶
Index ¶
- 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 Model
- func (model *Model) AddImage(image Image)
- func (model *Model) AddImageToHubCheckQueue(sha DockerImageSha)
- func (model *Model) AddImageToScanQueue(sha DockerImageSha)
- func (model *Model) AddPod(newPod Pod)
- func (model *Model) DeletePod(podName string)
- func (model *Model) FinishRunningScanClient(image *Image, err 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) RemoveImageFromHubCheckQueue(sha DockerImageSha) error
- func (model *Model) ScanResults() api.ScanResults
- func (model *Model) ScanResultsForPod(podName string) (int, int, string, error)
- type ModelMetrics
- type Pod
- type ScanStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
HubHost string
HubUser string
HubUserPassword 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) SetScanStatus ¶
func (imageInfo *ImageInfo) SetScanStatus(newStatus ScanStatus)
func (*ImageInfo) TimeInCurrentScanStatus ¶
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 *Config
HubVersion string
}
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) AddImageToHubCheckQueue ¶
func (model *Model) AddImageToHubCheckQueue(sha DockerImageSha)
func (*Model) AddImageToScanQueue ¶
func (model *Model) AddImageToScanQueue(sha DockerImageSha)
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.
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) RemoveImageFromHubCheckQueue ¶
func (model *Model) RemoveImageFromHubCheckQueue(sha DockerImageSha) error
func (*Model) ScanResults ¶
func (model *Model) ScanResults() api.ScanResults
type ModelMetrics ¶
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 ScanStatusError 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