Documentation
¶
Overview ¶
Package v1alpha1 provide functions to select resources
Index ¶
- func FilterGenericResources[T any](n BaseFilterRule, objs []T) []T
- func GetClustersBasedOnFilter(ctx context.Context, clt dynamic.Interface, clusterFilter *ClusterFilter) (clusters []corev1.ObjectReference, err error)
- func GetNamespacesBasedOnFilter(ctx context.Context, clt client.Client, nsFilter NamespaceFilter) (namespaces []corev1.Namespace, err error)
- func RemoveDuplicatesFromList[T any](anyList []T) []T
- type BaseFilter
- type BaseFilterRule
- type ClusterFilter
- type ClusterFilterRule
- type NamespaceFilter
- type NamespaceFilterRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterGenericResources ¶
func FilterGenericResources[T any](n BaseFilterRule, objs []T) []T
FilterGenericResources filter generic resources by BaseFilterRule
func GetClustersBasedOnFilter ¶
func GetClustersBasedOnFilter(ctx context.Context, clt dynamic.Interface, clusterFilter *ClusterFilter) (clusters []corev1.ObjectReference, err error)
GetClustersBasedOnFilter lists clusters based on the clusterFilter criteria
func GetNamespacesBasedOnFilter ¶
func GetNamespacesBasedOnFilter(ctx context.Context, clt client.Client, nsFilter NamespaceFilter) (namespaces []corev1.Namespace, err error)
GetNamespacesBasedOnFilter lists namespaces based on the namespaceFilter criteria
func RemoveDuplicatesFromList ¶
func RemoveDuplicatesFromList[T any](anyList []T) []T
RemoveDuplicatesFromList removes duplicate items from the list
Types ¶
type BaseFilter ¶
type BaseFilter struct { // selector is a label query over resources that match the filter. // It must match the resource's labels. // +optional Selector *metav1.LabelSelector `json:"selector,omitempty"` // a match rule to filter resources based on Selector or Refs // +optional Filter *BaseFilterRule `json:"filter,omitempty"` // Refs is a slice of specific references for resources // +optional Refs []corev1.ObjectReference `json:"refs,omitempty"` }
BaseFilter is the base filter struct Provide some general methods +k8s:deepcopy-gen=true
func (*BaseFilter) DeepCopy ¶
func (in *BaseFilter) DeepCopy() *BaseFilter
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BaseFilter.
func (*BaseFilter) DeepCopyInto ¶
func (in *BaseFilter) DeepCopyInto(out *BaseFilter)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*BaseFilter) MatchObject ¶
func (p *BaseFilter) MatchObject(obj client.Object) bool
MatchObject check if the object match the filter
type BaseFilterRule ¶
type BaseFilterRule struct { // Exact filter objects by attributes Exact map[string]string `json:"exact"` }
BaseFilterRule is the base filter rule +k8s:deepcopy-gen=true
func (*BaseFilterRule) DeepCopy ¶
func (in *BaseFilterRule) DeepCopy() *BaseFilterRule
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BaseFilterRule.
func (*BaseFilterRule) DeepCopyInto ¶
func (in *BaseFilterRule) DeepCopyInto(out *BaseFilterRule)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*BaseFilterRule) MatchExact ¶
func (n *BaseFilterRule) MatchExact(obj interface{}) bool
MatchExact match exact filter rule
type ClusterFilter ¶
type ClusterFilter struct { // The namespace where the clusters.clusterregistry.k8s.io exist, empty indicates the current namespace. // optional Namespace string `json:"namespace,omitempty"` // selector is a label query over clusters that match the filter. // It must match the clusters's labels. // +optional Selector *metav1.LabelSelector `json:"selector,omitempty"` // a match rule to filter cluster based on Selector or Refs // +optional Filter *ClusterFilterRule `json:"filter,omitempty"` // Refs is a slice of specific references for clusters // +optional Refs []corev1.ObjectReference `json:"refs,omitempty"` }
ClusterFilter filter options for clusters +k8s:deepcopy-gen=true
func (*ClusterFilter) DeepCopy ¶
func (in *ClusterFilter) DeepCopy() *ClusterFilter
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterFilter.
func (*ClusterFilter) DeepCopyInto ¶
func (in *ClusterFilter) DeepCopyInto(out *ClusterFilter)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ClusterFilterRule ¶
type ClusterFilterRule BaseFilterRule
ClusterFilterRule is alias of BaseFilterRule +k8s:deepcopy-gen=true
func (*ClusterFilterRule) DeepCopy ¶
func (in *ClusterFilterRule) DeepCopy() *ClusterFilterRule
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterFilterRule.
func (*ClusterFilterRule) DeepCopyInto ¶
func (in *ClusterFilterRule) DeepCopyInto(out *ClusterFilterRule)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (ClusterFilterRule) Filter ¶
func (n ClusterFilterRule) Filter(uClusters []unstructured.Unstructured) []corev1.ObjectReference
Filter is a filter for clusters
type NamespaceFilter ¶
type NamespaceFilter struct { // selector is a label query over namespaces that match the filter. // It must match the namespaces's labels. // +optional Selector *metav1.LabelSelector `json:"selector,omitempty"` // a match rule to filter namespace based on Selector or Refs // +optional Filter *NamespaceFilterRule `json:"filter,omitempty"` // Refs is a slice of specific references for namespaces // +optional Refs []corev1.ObjectReference `json:"refs,omitempty"` }
NamespaceFilter filter options for namespaces +k8s:deepcopy-gen=true
func (*NamespaceFilter) DeepCopy ¶
func (in *NamespaceFilter) DeepCopy() *NamespaceFilter
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceFilter.
func (*NamespaceFilter) DeepCopyInto ¶
func (in *NamespaceFilter) DeepCopyInto(out *NamespaceFilter)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NamespaceFilterRule ¶
type NamespaceFilterRule BaseFilterRule
NamespaceFilterRule is alias of BaseFilterRule +k8s:deepcopy-gen=true
func (*NamespaceFilterRule) DeepCopy ¶
func (in *NamespaceFilterRule) DeepCopy() *NamespaceFilterRule
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceFilterRule.
func (*NamespaceFilterRule) DeepCopyInto ¶
func (in *NamespaceFilterRule) DeepCopyInto(out *NamespaceFilterRule)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.