Documentation
¶
Index ¶
- func CombineSelectors(selectors ...labels.Selector) labels.Selector
- func GetNamespacesMatchingSelectors(ctx context.Context, c client.Reader, namespaceSelector []NamespaceSelector) (namespaces []corev1.Namespace, err error)
- func GetNamespacesMatchingSelectorsStrings(ctx context.Context, c client.Reader, namespaceSelector []NamespaceSelector) ([]string, error)
- func ListBySelectors[T client.Object](ctx context.Context, c client.Reader, list client.ObjectList, ...) ([]T, error)
- func MatchesSelector(objLabels labels.Set, selector metav1.LabelSelector) (bool, error)
- func MatchesSelectors(objLabels labels.Set, selectors []metav1.LabelSelector) bool
- type CompiledFieldSelector
- type CompiledSelectorWithFields
- type FieldSelectorOperator
- type NamespaceSelector
- type SelectorWithFields
- type SelectorWithNamespaceSelector
- func (in *SelectorWithNamespaceSelector) DeepCopy() *SelectorWithNamespaceSelector
- func (in *SelectorWithNamespaceSelector) DeepCopyInto(out *SelectorWithNamespaceSelector)
- func (s *SelectorWithNamespaceSelector) MatchObjects(ctx context.Context, c client.Reader, objects []metav1.Object) ([]metav1.Object, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNamespacesMatchingSelectors ¶
func GetNamespacesMatchingSelectors( ctx context.Context, c client.Reader, namespaceSelector []NamespaceSelector, ) (namespaces []corev1.Namespace, err error)
Takes a list of NamespaceSelectors and returns unique ordered Namespaces.
func ListBySelectors ¶
func ListBySelectors[T client.Object]( ctx context.Context, c client.Reader, list client.ObjectList, selectors []*metav1.LabelSelector, ) ([]T, error)
ListBySelectors lists objects of type T (using list L), then returns all items that match ANY of the provided LabelSelectors. The result is unique by namespace/name.
func MatchesSelector ¶
Attempt so verify multiple selector objects against a labels.Set If selectors are not set, it is always considered a match.
func MatchesSelectors ¶
func MatchesSelectors(objLabels labels.Set, selectors []metav1.LabelSelector) bool
Attempt so verify multiple selector objects against a labels.Set If selectors are not set, it is always considered a match.
Types ¶
type CompiledFieldSelector ¶ added in v0.13.4
type CompiledFieldSelector struct {
Raw string
Path string
Operator FieldSelectorOperator
Value string
Compiled *jsonpath.CompiledJSONPath
}
type CompiledSelectorWithFields ¶
type CompiledSelectorWithFields struct {
LabelSelector labels.Selector
FieldMatchers []CompiledFieldSelector
}
type FieldSelectorOperator ¶ added in v0.13.4
type FieldSelectorOperator string
const ( FieldSelectorTruthy FieldSelectorOperator = "truthy" FieldSelectorEquals FieldSelectorOperator = "equals" FieldSelectorNotEquals FieldSelectorOperator = "not-equals" )
type NamespaceSelector ¶
type NamespaceSelector struct {
// Select Items based on their labels. If the namespaceSelector is also set, the selector is applied
// to items within the selected namespaces. Otherwise for all the items.
*metav1.LabelSelector `json:",inline"`
}
Selector for resources and their labels or selecting origin namespaces +kubebuilder:object:generate=true
func (*NamespaceSelector) DeepCopy ¶
func (in *NamespaceSelector) DeepCopy() *NamespaceSelector
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceSelector.
func (*NamespaceSelector) DeepCopyInto ¶
func (in *NamespaceSelector) DeepCopyInto(out *NamespaceSelector)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*NamespaceSelector) GetMatchingNamespaces ¶
func (s *NamespaceSelector) GetMatchingNamespaces( ctx context.Context, c client.Reader, ) ([]corev1.Namespace, error)
GetMatchingNamespaces retrieves the list of namespaces that match the NamespaceSelector.
type SelectorWithFields ¶
type SelectorWithFields struct {
// Select Items based on their labels.
*metav1.LabelSelector `json:",inline"`
// Additional boolean JSONPath expressions.
// All must evaluate to true for this selector to match.
// +optional
FieldSelectors []string `json:"fieldSelectors,omitempty"`
}
+kubebuilder:object:generate=true
func (*SelectorWithFields) DeepCopy ¶
func (in *SelectorWithFields) DeepCopy() *SelectorWithFields
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelectorWithFields.
func (*SelectorWithFields) DeepCopyInto ¶
func (in *SelectorWithFields) DeepCopyInto(out *SelectorWithFields)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SelectorWithNamespaceSelector ¶
type SelectorWithNamespaceSelector struct {
// Select Items based on their labels. If the namespaceSelector is also set, the selector is applied
// to items within the selected namespaces. Otherwise for all the items.
*metav1.LabelSelector `json:",inline"`
// NamespaceSelector for filtering namespaces by labels where items can be located in
NamespaceSelector *NamespaceSelector `json:"namespaceSelector,omitempty"`
}
Selector for resources and their labels or selecting origin namespaces +kubebuilder:object:generate=true
func (*SelectorWithNamespaceSelector) DeepCopy ¶
func (in *SelectorWithNamespaceSelector) DeepCopy() *SelectorWithNamespaceSelector
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelectorWithNamespaceSelector.
func (*SelectorWithNamespaceSelector) DeepCopyInto ¶
func (in *SelectorWithNamespaceSelector) DeepCopyInto(out *SelectorWithNamespaceSelector)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.