preflight

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 14 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

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 restMapper, sub preflightChecker) *APIExistence

func (*APIExistence) Check

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

type CheckerFn

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

func (CheckerFn) Check

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

type DryRun

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

func NewDryRun

func NewDryRun(client client.Writer) *DryRun

func (*DryRun) Check

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

type EmptyNamespaceNoDefault

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

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

func NewEmptyNamespaceNoDefault

func NewEmptyNamespaceNoDefault(restMapper meta.RESTMapper) *EmptyNamespaceNoDefault

func (*EmptyNamespaceNoDefault) Check

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

type Error

type Error struct {
	Violations []Violation
}

func (*Error) Error

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 NoOwnerReferences added in v1.11.0

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

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

func NewNoOwnerReferences added in v1.11.0

func NewNoOwnerReferences(restMapper meta.RESTMapper) *NoOwnerReferences

func (*NoOwnerReferences) Check added in v1.11.0

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

type ObjectDuplicate added in v1.8.4

type ObjectDuplicate struct{}

func NewObjectDuplicate added in v1.8.4

func NewObjectDuplicate() *ObjectDuplicate

func (*ObjectDuplicate) Check added in v1.8.4

func (od *ObjectDuplicate) Check(
	_ context.Context, phases []corev1alpha1.ObjectSetTemplatePhase,
) (violations []Violation, err error)

type PhasesCheckerList added in v1.8.4

type PhasesCheckerList []phasesChecker

func (PhasesCheckerList) Check added in v1.8.4

func (l PhasesCheckerList) Check(
	ctx context.Context, phases []corev1alpha1.ObjectSetTemplatePhase,
) (violations []Violation, err error)

type Violation

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

func CheckAll

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

func CheckAllInPhase

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