filter

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

View Source
const DependencyFilterName = "DependencyFilter"
View Source
const PreventRemoveFilterName = "PreventRemoveFilter"

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnotationPreventedDeletionError added in v0.30.0

type AnnotationPreventedDeletionError struct {
	Annotation string
	Value      string
}

func (*AnnotationPreventedDeletionError) Error added in v0.30.0

func (*AnnotationPreventedDeletionError) Is added in v0.30.0

type ApplyPreventedDeletionError added in v0.30.0

type ApplyPreventedDeletionError struct {
	UID types.UID
}

func (*ApplyPreventedDeletionError) Error added in v0.30.0

func (*ApplyPreventedDeletionError) Is added in v0.30.0

type CurrentUIDFilter

type CurrentUIDFilter struct {
	CurrentUIDs sets.String // nolint:staticcheck
}

CurrentUIDFilter implements ValidationFilter interface to determine if an object should not be pruned (deleted) because it has recently been applied.

func (CurrentUIDFilter) Filter

Filter returns a ApplyPreventedDeletionError if the object prune/delete should be skipped.

func (CurrentUIDFilter) Name

func (cuf CurrentUIDFilter) Name() string

Name returns a filter identifier for logging.

type DependencyActuationMismatchError added in v0.30.0

type DependencyActuationMismatchError struct {
	Object       object.ObjMetadata
	Strategy     actuation.ActuationStrategy
	Relationship Relationship

	Relation         object.ObjMetadata
	RelationStrategy actuation.ActuationStrategy
}

func (*DependencyActuationMismatchError) Error added in v0.30.0

func (*DependencyActuationMismatchError) Is added in v0.30.0

type DependencyFilter added in v0.29.0

type DependencyFilter struct {
	TaskContext       *taskrunner.TaskContext
	ActuationStrategy actuation.ActuationStrategy
	DryRunStrategy    common.DryRunStrategy
}

DependencyFilter implements ValidationFilter interface to determine if an object can be applied or deleted based on the status of it's dependencies.

func (DependencyFilter) Filter added in v0.29.0

func (dnrf DependencyFilter) Filter(obj *unstructured.Unstructured) error

Filter returns an error if the specified object should be skipped because at least one of its dependencies is Not Found or Not Reconciled. Typed Errors: - DependencyPreventedActuationError - DependencyActuationMismatchError

func (DependencyFilter) Name added in v0.29.0

func (dnrf DependencyFilter) Name() string

Name returns the name of the filter for logs and events.

type DependencyPreventedActuationError added in v0.30.0

type DependencyPreventedActuationError struct {
	Object       object.ObjMetadata
	Strategy     actuation.ActuationStrategy
	Relationship Relationship

	Relation                object.ObjMetadata
	RelationPhase           Phase
	RelationActuationStatus actuation.ActuationStatus
	RelationReconcileStatus actuation.ReconcileStatus
}

func (*DependencyPreventedActuationError) Error added in v0.30.0

func (*DependencyPreventedActuationError) Is added in v0.30.0

type FatalError added in v0.30.0

type FatalError struct {
	Err error
}

FatalError is a wrapper for filters to indicate an error is unrecoverable, not just a reason to skip actuation.

func NewFatalError added in v0.30.0

func NewFatalError(err error) *FatalError

func (*FatalError) Error added in v0.30.0

func (e *FatalError) Error() string

func (*FatalError) Is added in v0.30.0

func (e *FatalError) Is(err error) bool

type InventoryPolicyApplyFilter

type InventoryPolicyApplyFilter struct {
	Client    dynamic.Interface
	Mapper    meta.RESTMapper
	Inv       inventory.Info
	InvPolicy inventory.Policy
}

InventoryPolicyApplyFilter implements ValidationFilter interface to determine if an object should be applied based on the cluster object's inventory id, the id for the inventory object, and the inventory policy.

func (InventoryPolicyApplyFilter) Filter

Filter returns an inventory.PolicyPreventedActuationError if the object apply should be skipped.

func (InventoryPolicyApplyFilter) Name

func (ipaf InventoryPolicyApplyFilter) Name() string

Name returns a filter identifier for logging.

type InventoryPolicyPruneFilter added in v0.30.0

type InventoryPolicyPruneFilter struct {
	Inv       inventory.Info
	InvPolicy inventory.Policy
}

InventoryPolicyPruneFilter implements ValidationFilter interface to determine if an object should be pruned (deleted) because of the InventoryPolicy and if the objects owning inventory identifier matchs the inventory id.

func (InventoryPolicyPruneFilter) Filter added in v0.30.0

Filter returns an inventory.PolicyPreventedActuationError if the object prune/delete should be skipped.

func (InventoryPolicyPruneFilter) Name added in v0.30.0

Name returns a filter identifier for logging.

type LocalNamespacesFilter

type LocalNamespacesFilter struct {
	LocalNamespaces sets.String // nolint:staticcheck
}

LocalNamespacesFilter encapsulates the set of namespaces that are currently in use. Used to ensure we do not delete namespaces with currently applied objects in them.

func (LocalNamespacesFilter) Filter

Filter returns a NamespaceInUseError if the object prune/delete should be skipped.

func (LocalNamespacesFilter) Name

func (lnf LocalNamespacesFilter) Name() string

Name returns a filter identifier for logging.

type NamespaceInUseError added in v0.30.0

type NamespaceInUseError struct {
	Namespace string
}

func (*NamespaceInUseError) Error added in v0.30.0

func (e *NamespaceInUseError) Error() string

func (*NamespaceInUseError) Is added in v0.30.0

func (e *NamespaceInUseError) Is(err error) bool

type Phase added in v0.30.0

type Phase int
const (
	PhaseActuation Phase = iota // Actuation
	PhaseReconcile              // Reconcile
)

func (Phase) String added in v0.30.0

func (i Phase) String() string

type PreventRemoveFilter

type PreventRemoveFilter struct{}

PreventRemoveFilter implements ValidationFilter interface to determine if an object should not be pruned (deleted) because of a "prevent remove" annotation.

func (PreventRemoveFilter) Filter

Filter returns a AnnotationPreventedDeletionError if the object prune/delete should be skipped.

func (PreventRemoveFilter) Name

func (prf PreventRemoveFilter) Name() string

Name returns the preferred name for the filter. Usually used for logging.

type Relationship added in v0.29.0

type Relationship int
const (
	RelationshipDependent  Relationship = iota // Dependent
	RelationshipDependency                     // Dependency
)

func (Relationship) String added in v0.29.0

func (i Relationship) String() string

type ValidationFilter

type ValidationFilter interface {
	// Name returns a filter name (usually for logging).
	Name() string
	// Filter returns an error if validation fails, indicating that actuation
	// should be skipped for this object.
	Filter(obj *unstructured.Unstructured) error
}

ValidationFilter interface decouples apply/prune validation from the concrete structs used for validation. The apply/prune functionality will run validation filters to remove objects which should not be applied or pruned.

Jump to

Keyboard shortcuts

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