labels

package
v0.0.0-...-e1628ab Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equals

func Equals(extendLabels1, extendLabels2 map[string][]string) bool

Equals returns true if two extend labels are same

Types

type Selector

type Selector struct {
	metav1.LabelSelector `json:",inline"`

	// ExtendMatchLabels allows match labels with the same key but different value.
	// e.g. {key: [v1, v2]} matches labels: {key: v1, key: v2} and {key: v1, key: v2, key: v3}
	// +optional
	ExtendMatchLabels map[string][]string `json:"extendMatchLabels,omitempty"`

	// MatchNothing does not match any labels when set to true
	MatchNothing bool `json:"matchNothing,omitempty"`
}

Selector extends metav1.LabelSelector, it allows select multiple labels with same key but different value. The result of matchLabels and matchExpressions and extendMatchLabels are ANDed. An empty selector matches all objects. A null selector matches no objects. The matched labels MUST be the superset of the MatchLabels and ExtendMatchLabels. +k8s:deepcopy-gen=true

func FromLabelSelector

func FromLabelSelector(labelSelector *metav1.LabelSelector) *Selector

FromLabelSelector covert metav1.LabelSelector to Selector

func (*Selector) DeepCopy

func (in *Selector) DeepCopy() *Selector

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Selector.

func (*Selector) DeepCopyInto

func (in *Selector) DeepCopyInto(out *Selector)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Selector) IsValid

func (in *Selector) IsValid() (bool, string)

IsValid checks if the selector is valid, and give a detailed error message if not.

func (*Selector) Matches

func (in *Selector) Matches(labelSet Set) bool

Matches returns true if the labelSet match the selector. We suppose the selector and labelSet are valid, otherwise the result is undefined.

type Set

type Set map[string]sets.String

Set contains a set of labels

func AsSet

func AsSet(labels map[string]string, extendLabels map[string][]string) (Set, error)

AsSet converts a map of labels and extend labels to a label set

Jump to

Keyboard shortcuts

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