validation

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration added in v0.3.1

type Configuration struct {
	Mode            Mode
	PolicyReference anchore.PolicyReference
}

func NewConfiguration added in v0.3.1

func NewConfiguration(
	meta metav1.ObjectMeta,
	imageReference string,
	policySelectors []PolicySelector,
	clientset kubernetes.Clientset,
) *Configuration

type Mode

type Mode string
const (
	PolicyGateMode   Mode = "policy"
	AnalysisGateMode Mode = "analysis"
	BreakGlassMode   Mode = "breakglass"
)

type PolicySelector added in v0.3.1

type PolicySelector struct {
	ResourceSelector ResourceSelector `mapstructure:"Selector"`
	Mode             Mode
	PolicyReference  anchore.PolicyReference
}

type ResourceSelector added in v0.3.1

type ResourceSelector struct {
	Type ResourceSelectorType `mapstructure:"ResourceType"` // The resource to do selection on,
	// supported: pod, namespace
	SelectorKeyRegex   string // The regex to select a matching key
	SelectorValueRegex string // The regex to apply to the label/annotation of the specified resource type
}

type ResourceSelectorType added in v0.3.1

type ResourceSelectorType string
const (
	GeneralResourceSelectorType   ResourceSelectorType = "resource"
	NamespaceResourceSelectorType ResourceSelectorType = "namespace"
	ImageResourceSelectorType     ResourceSelectorType = "image"
)

type Result

type Result struct {
	Mode        Mode
	IsValid     bool
	Message     string
	ImageDigest string
}

Result is a data structure that describes the evaluation result for a validation operation.

func Reduce

func Reduce(results []Result, messagePrefix string) Result

Reduce takes an arbitrary number of Results as input and reduces them to a single Result. This Result's Message aggregates the input Results' Messages, prefixed with the given messagePrefix. If only a single Result is passed in, the Result is returned as-is (and the messagePrefix is not used).

type Validator added in v0.3.1

type Validator func() Result

Validator is a function that can be executed to produce a validation Result.

func New added in v0.3.1

func New(configuration Configuration, imageBackend anchore.ImageBackend, user anchore.Credential,
	imageReference string) (Validator, error)

New returns a validator function with its internal state fully configured. If a validator function cannot be created, New returns an error.

Jump to

Keyboard shortcuts

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