selectors

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package selectors contains exceptions related utilities, including check the validity of selector, treeSelector, and noneSelector, and parsing these three selectors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllSelector added in v1.1.0

func GetAllSelector(inst *unstructured.Unstructured) (bool, error)

GetAllSelector returns true indicates that user do wants this object to be propagated

func GetAllSelectorAnnotation added in v1.1.0

func GetAllSelectorAnnotation(inst *unstructured.Unstructured) string

func GetNoneSelector

func GetNoneSelector(inst *unstructured.Unstructured) (bool, error)

GetNoneSelector returns true indicates that user do not want this object to be propagated

func GetNoneSelectorAnnotation

func GetNoneSelectorAnnotation(inst *unstructured.Unstructured) string

func GetSelector

func GetSelector(inst *unstructured.Unstructured) (labels.Selector, error)

GetSelector returns the selector on a given object if it exists

func GetSelectorAnnotation

func GetSelectorAnnotation(inst *unstructured.Unstructured) string

func GetTreeSelector

func GetTreeSelector(inst *unstructured.Unstructured) (labels.Selector, error)

GetTreeSelector is similar to a regular selector, except that it adds the LabelTreeDepthSuffix to every string To transform a tree selector into a regular label selector, we follow these steps: 1. get the treeSelector annotation if it exists 2. convert the annotation string to a slice of strings seperated by comma, because user is allowed to put multiple selectors 3. append the LabelTreeDepthSuffix to each of the treeSelector string 4. combine them into a single string connected by comma

func GetTreeSelectorAnnotation

func GetTreeSelectorAnnotation(inst *unstructured.Unstructured) string

func ShouldPropagate

func ShouldPropagate(inst *unstructured.Unstructured, nsLabels labels.Set, mode api.SynchronizationMode) (bool, error)

ShouldPropagate returns true if the given object should be propagated based on the SynchronizationMode and on the selectors of the object. Propagation will be done only with 'Propagate' or 'AllowPropagate' modes. When selectors are set, 'AllowPropagate' follows the same logic as 'Propagate' mode, when they are not set, then if 'Propagate' mode is used then propagate by default; if 'AllowPropagate' mode is used then do not propagate by default.

Types

type ExclusionByAnnotationsSpec added in v1.0.0

type ExclusionByAnnotationsSpec struct {
	Key   string
	Value string
}

A annotation as a key, value pair, used to exclude resources matching this annotation

Jump to

Keyboard shortcuts

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