filter

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const PreventRemoveFilterName = "PreventRemoveFilter"

Variables

This section is empty.

Functions

This section is empty.

Types

type CurrentUIDFilter

type CurrentUIDFilter struct {
	CurrentUIDs sets.String
}

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 true if the passed object should NOT be pruned (deleted) because it has recently been applied.

func (CurrentUIDFilter) Name

func (cuf CurrentUIDFilter) Name() string

Name returns a filter identifier for logging.

type InventoryPolicyApplyFilter

type InventoryPolicyApplyFilter struct {
	Client    dynamic.Interface
	Mapper    meta.RESTMapper
	Inv       inventory.InventoryInfo
	InvPolicy inventory.InventoryPolicy
}

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 true if the passed object should be filtered (NOT applied) and a filter reason string; false otherwise. Returns an error if one occurred during the filter calculation

func (InventoryPolicyApplyFilter) Name

func (ipaf InventoryPolicyApplyFilter) Name() string

Name returns a filter identifier for logging.

type InventoryPolicyFilter

type InventoryPolicyFilter struct {
	Inv       inventory.InventoryInfo
	InvPolicy inventory.InventoryPolicy
}

InventoryPolicyFilter 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 (InventoryPolicyFilter) Filter

Filter returns true if the passed object should NOT be pruned (deleted) because the "prevent remove" annotation is present; otherwise returns false. Never returns an error.

func (InventoryPolicyFilter) Name

func (ipf InventoryPolicyFilter) Name() string

Name returns a filter identifier for logging.

type LocalNamespacesFilter

type LocalNamespacesFilter struct {
	LocalNamespaces sets.String
}

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 true if the passed object should NOT be pruned (deleted) because the it is a namespace that objects still reside in; otherwise returns false. This filter should not be added to the list of filters for "destroying", since every object is being delete. Never returns an error.

func (LocalNamespacesFilter) Name

func (lnf LocalNamespacesFilter) Name() string

Name returns a filter identifier for logging.

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 true if the passed object should NOT be pruned (deleted) because the "prevent remove" annotation is present; otherwise returns false. Never returns an error.

func (PreventRemoveFilter) Name

func (prf PreventRemoveFilter) Name() string

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

type ValidationFilter

type ValidationFilter interface {
	// Name returns a filter name (usually for logging).
	Name() string
	// Filter returns true if validation fails. If true a
	// reason string is included in the return. If an error happens
	// during filtering it is returned.
	Filter(obj *unstructured.Unstructured) (bool, string, 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