policy

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyDocument is the error returned when no document body is
	// specified.
	ErrEmptyDocument = errors.New("document is required to create policy")

	// ErrUnknownType is the error returned when a type contained in the policy
	// is unrecognized.
	ErrUnknownType = errors.New("unknown type")
)

Functions

func CoversImage

func CoversImage(ctx context.Context, document, target string) (bool, error)

CoversImage parses the given policy document, and checks if the target image matches any of the image globs included in the policy.

func Parse

func Parse(_ context.Context, document string) ([]*unstructured.Unstructured, error)

Parse decodes a provided YAML document containing zero or more objects into a collection of unstructured.Unstructured objects.

func ParseClusterImagePolicies

func ParseClusterImagePolicies(ctx context.Context, document string) (cips []*v1beta1.ClusterImagePolicy, warns error, err error)

ParseClusterImagePolicies returns ClusterImagePolicy objects found in the policy document.

func UnsafeParseClusterImagePolicies

func UnsafeParseClusterImagePolicies(ctx context.Context, document string) (cips []*v1beta1.ClusterImagePolicy, err error)

UnsafeParseClusterImagePolicies returns ClusterImagePolicy objects found in the policy document, without validating if the policy is valid.

func Validate

func Validate(ctx context.Context, document string) (warns error, err error)

Validate decodes a provided YAML document containing zero or more objects and performs limited validation on them.

Types

This section is empty.

Jump to

Keyboard shortcuts

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