services

package
v0.0.0-...-dd22938 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher struct {
	// contains filtered or unexported fields
}

Dispatcher do some preprocessing of top of Image objects and calls the internally configured Scanner. TODO expand this to accept multiple Scanners if necessary.

func NewDispatcher

NewDispatcher returns a handler for all container image scan operations using trivy.

func (*Dispatcher) AddEventHandler

func (t *Dispatcher) AddEventHandler(handler cache.ResourceEventHandler)

AddEventHandler adds a handler to Image related events.

func (*Dispatcher) Get

func (t *Dispatcher) Get(ctx context.Context, ns, name string) (*imgv1b1.Image, error)

Get returns a shipwright image object.

func (*Dispatcher) Sync

func (t *Dispatcher) Sync(ctx context.Context, img *imgv1b1.Image) error

Sync runs a scan on the provided Image object. Goes through all image hash references, parses them and calls processImage for all of them sequentially.

type ImageScan

type ImageScan struct {
	// contains filtered or unexported fields
}

ImageScan gather all actions related to ImageScan objects. Actions in a sense of "services" or if you prefer: "use cases". The business logic for ImageScans lives in this struct.

func NewImageScan

NewImageScan returns a handler for all ImageScan related services.

func (*ImageScan) AddEventHandler

func (t *ImageScan) AddEventHandler(handler cache.ResourceEventHandler)

AddEventHandler adds a handler to Image related events.

func (*ImageScan) Get

func (t *ImageScan) Get(ctx context.Context, name string) (*v1b1scans.ImageScan, error)

Get returns a ImageScan object. Returned object is already a copy of the cached object and may be modified by caller as needed.

func (*ImageScan) Sync

func (t *ImageScan) Sync(ctx context.Context, scan *v1b1scans.ImageScan) error

Sync manages image scan changes. We verify that the ImageScan still has reference to existing shipwright images, we delete references if the Image was deleted. This function also deletes the ImageScan if it has no reference to Images.

type Scanner

type Scanner interface {
	Scan(context.Context, types.ImageReference, []*types.SystemContext) ([]v1b1scans.Vulnerability, error)
}

Scanner implments a Scan method and is reponsible for scanning a given container image reference using provided system contexts. This function should return a list of vulnerability IDs (for example "CVE-2022-0185").

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL