Documentation
¶
Overview ¶
Package nodeselector provides a mechanism to match node based on node selector rules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Match ¶
func Match(rules []NodeSelectorTerm, fields map[string]string) (bool, error)
Match returns true if the node metadata matches the node selector rules.
func MatchExpressions ¶
func MatchExpressions(rules []NodeSelectorRequirement, fields map[string]string) (bool, error)
MatchExpressions returns true if the node metadata matches the node selector expressions.
Types ¶
type NodeSelectorOperator ¶
type NodeSelectorOperator string
NodeSelectorOperator is the set of operators that can be used in a node selector requirement.
const ( NodeSelectorOpIn NodeSelectorOperator = "In" NodeSelectorOpNotIn NodeSelectorOperator = "NotIn" NodeSelectorOpExists NodeSelectorOperator = "Exists" NodeSelectorOpDoesNotExist NodeSelectorOperator = "DoesNotExist" NodeSelectorOpGt NodeSelectorOperator = "Gt" NodeSelectorOpLt NodeSelectorOperator = "Lt" NodeSelectorOpRegexp NodeSelectorOperator = "Regexp" )
These are valid values of NodeSelectorOperator.
type NodeSelectorRequirement ¶
type NodeSelectorRequirement struct {
// The label key that the selector applies to.
Key string `yaml:"key,omitempty"`
// Represents a key's relationship to a set of values.
// Valid operators are In, NotIn, Exists, DoesNotExist. Gt, and Lt.
Operator NodeSelectorOperator `yaml:"operator,omitempty"`
// An array of string values. If the operator is In or NotIn,
// the values array must be non-empty. If the operator is Exists or DoesNotExist,
// the values array must be empty. If the operator is Gt or Lt, the values
// array must have a single element, which will be interpreted as an integer.
// This array is replaced during a strategic merge patch.
// +optional
Values []string `yaml:"values,omitempty"`
}
NodeSelectorRequirement is a selector that contains values, a key, and an operator that relates the key and values.
type NodeSelectorTerm ¶
type NodeSelectorTerm struct {
// A list of node selector requirements by node's labels.
MatchExpressions []NodeSelectorRequirement `yaml:"matchExpressions,omitempty"`
}
NodeSelectorTerm represents expressions and fields required to select nodes. A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm.