filter

package
v0.36.0-flux.5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

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

type AnnotationPreventedDeletionError struct {
	Annotation string
	Value      string
}

func (*AnnotationPreventedDeletionError) Error

func (*AnnotationPreventedDeletionError) Is

type ApplyPreventedDeletionError

type ApplyPreventedDeletionError struct {
	UID types.UID
}

func (*ApplyPreventedDeletionError) Error

func (*ApplyPreventedDeletionError) Is

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

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

	Relation         object.ObjMetadata
	RelationStrategy actuation.ActuationStrategy
}

func (*DependencyActuationMismatchError) Error

func (*DependencyActuationMismatchError) Is

type DependencyFilter

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

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

func (dnrf DependencyFilter) Name() string

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

type DependencyPreventedActuationError

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

func (*DependencyPreventedActuationError) Is

type FatalError

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

func NewFatalError(err error) *FatalError

func (*FatalError) Error

func (e *FatalError) Error() string

func (*FatalError) Is

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

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

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

func (InventoryPolicyPruneFilter) Name

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

type NamespaceInUseError struct {
	Namespace string
}

func (*NamespaceInUseError) Error

func (e *NamespaceInUseError) Error() string

func (*NamespaceInUseError) Is

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

type Phase

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

func (Phase) String

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

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

func (Relationship) String

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