labels

package
v2.22.0-test.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const NameLabelKey = "kubernetes.io/metadata.name"

Variables

This section is empty.

Functions

func NewLabelsSelector

func NewLabelsSelector(es []*Requirement) (labels.Selector, error)

Types

type Operator

type Operator string
const (
	OperatorIn     Operator = "In"
	OperatorNotIn  Operator = "NotIn"
	OperatorExists Operator = "Exists"
)

These are the camel-cased operators that are valid in a kubernetes namespaceSelector.

NOTE! The lowercase variants in the k8s.io/apimachinery/pkg/selection are intended for the selector string representation only. They are invalid in a YAML/JSON manifest!

func (Operator) AsSelectionOperator

func (op Operator) AsSelectionOperator() selection.Operator

func (Operator) String

func (op Operator) String() string

type Requirement

type Requirement struct {
	Key      string   `json:"key"`
	Operator Operator `json:"operator"`
	Values   []string `json:"values"`
}

type Selector

type Selector struct {
	MatchLabels      map[string]string `json:"matchLabels,omitempty"`
	MatchExpressions []*Requirement    `json:"matchExpressions,omitempty"`
}

func SelectorFromNames

func SelectorFromNames(names ...string) *Selector

func UnmarshalSelector

func UnmarshalSelector(data []byte) (*Selector, error)

func UnmarshalSelectorJSON

func UnmarshalSelectorJSON(data []byte) (*Selector, error)

func (*Selector) GetAllRequirements

func (sel *Selector) GetAllRequirements() []*Requirement

GetAllRequirements transforms the "<key>=<value>" MatchableLabels into "<key> in [<value>]" MatchRequirements and returns the sorted sum of all requirements.

func (*Selector) LabelsSelector

func (sel *Selector) LabelsSelector() (labels.Selector, error)

func (*Selector) Static

func (sel *Selector) Static() bool

func (*Selector) StaticNames

func (sel *Selector) StaticNames() []string

Jump to

Keyboard shortcuts

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