selectorutils

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ObjectSelectorExpressionsAndLabelsWarning = eris.New("cannot use both labels and expressions within the " +
		"same selector")
	ObjectSelectorInvalidExpressionWarning = eris.New("the object selector expression is invalid")

	// Map connecting Objects expression operator values and Kubernetes expression operator string values.
	ObjectExpressionOperatorValues = map[v1.ObjectSelector_Expression_Operator]selection.Operator{
		v1.ObjectSelector_Expression_Equals:       selection.Equals,
		v1.ObjectSelector_Expression_DoubleEquals: selection.DoubleEquals,
		v1.ObjectSelector_Expression_NotEquals:    selection.NotEquals,
		v1.ObjectSelector_Expression_In:           selection.In,
		v1.ObjectSelector_Expression_NotIn:        selection.NotIn,
		v1.ObjectSelector_Expression_Exists:       selection.Exists,
		v1.ObjectSelector_Expression_DoesNotExist: selection.DoesNotExist,
		v1.ObjectSelector_Expression_GreaterThan:  selection.GreaterThan,
		v1.ObjectSelector_Expression_LessThan:     selection.LessThan,
	}
)

Functions

func IdentityMatchesWorkload

func IdentityMatchesWorkload(selectors []*commonv1.IdentitySelector, workload *discoveryv1.Workload) bool

func SelectorMatchesDestination added in v1.1.0

func SelectorMatchesDestination(selectors []*commonv1.DestinationSelector, destination *discoveryv1.Destination) bool

func SelectorMatchesObject added in v1.1.0

func SelectorMatchesObject(
	candidate ezkube.Object,
	selector *v1.ObjectSelector,
	ownerNamespace string,
) bool

TODO: validate the logic contained here

func SelectorMatchesWorkload

func SelectorMatchesWorkload(ctx context.Context, selectors []*commonv1.WorkloadSelector, workload *discoveryv1.Workload) bool

func ValidateSelector added in v1.1.0

func ValidateSelector(
	selector *v1.ObjectSelector,
) error

used in enterprise

func WorkloadSelectorContainsCluster

func WorkloadSelectorContainsCluster(selectors []*commonv1.WorkloadSelector, clusterName string) bool

Return true if any WorkloadSelector selects the specified clusterName

Types

This section is empty.

Jump to

Keyboard shortcuts

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