preflight

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

package preflight implements preflight checks for PKO APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContextWithPhase added in v1.4.0

func NewContextWithPhase(ctx context.Context, phase corev1alpha1.ObjectSetTemplatePhase) context.Context

Types

type APIExistence

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

Prevents the use of APIs not registered into the kube-apiserver.

func NewAPIExistence

func NewAPIExistence(restMapper meta.RESTMapper) *APIExistence

func (*APIExistence) Check

func (p *APIExistence) Check(ctx context.Context, _, obj client.Object) (violations []Violation, err error)

type CheckerFn added in v1.4.0

type CheckerFn func(
	ctx context.Context, owner, obj client.Object,
) (violations []Violation, err error)

func (CheckerFn) Check added in v1.4.0

func (fn CheckerFn) Check(
	ctx context.Context, owner,
	obj client.Object,
) (violations []Violation, err error)

type DryRun added in v1.7.0

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

func NewDryRun added in v1.7.0

func NewDryRun(client client.Writer) *DryRun

func (*DryRun) Check added in v1.7.0

func (p *DryRun) Check(ctx context.Context, _, obj client.Object) (violations []Violation, err error)

type EmptyNamespaceNoDefault added in v1.4.0

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

Prevents the use of APIs not registered into the kube-apiserver.

func NewEmptyNamespaceNoDefault added in v1.4.0

func NewEmptyNamespaceNoDefault(restMapper meta.RESTMapper) *EmptyNamespaceNoDefault

func (*EmptyNamespaceNoDefault) Check added in v1.4.0

func (p *EmptyNamespaceNoDefault) Check(
	ctx context.Context, owner,
	obj client.Object,
) (violations []Violation, err error)

type Error added in v1.4.0

type Error struct {
	Violations []Violation
}

func (*Error) Error added in v1.4.0

func (e *Error) Error() string

type List

type List []checker

Runs a list of preflight checks and aggregates the result into a single list of violations.

func (List) Check

func (l List) Check(
	ctx context.Context, owner,
	obj client.Object,
) (violations []Violation, err error)

type NamespaceEscalation

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

Prevents namespace escalation from users specifying cluster-scoped resources or resources in other namespaces in non-cluster-scoped APIs.

func NewNamespaceEscalation

func NewNamespaceEscalation(restMapper meta.RESTMapper) *NamespaceEscalation

func (*NamespaceEscalation) Check

func (p *NamespaceEscalation) Check(
	ctx context.Context, owner,
	obj client.Object,
) (violations []Violation, err error)

type Violation

type Violation struct {
	// Position the violation was found.
	Position string
	// Error describing the violation.
	Error string
}

func CheckAll added in v1.4.0

func CheckAll(
	ctx context.Context, checker checker,
	owner client.Object, objs []client.Object,
) (violations []Violation, err error)

func CheckAllInPhase added in v1.4.0

func CheckAllInPhase(
	ctx context.Context, checker checker,
	owner client.Object,
	phase corev1alpha1.ObjectSetTemplatePhase,
	objs []unstructured.Unstructured,
) (violations []Violation, err error)

func (*Violation) String

func (v *Violation) String() string

Jump to

Keyboard shortcuts

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