Documentation ¶
Index ¶
- Constants
- type GroupVersionResourceList
- type Resource
- type ResourceList
- type ResourceMatcher
- func (rm ResourceMatcher) All(name string, gvr schema.GroupVersionResource, resourceLabels map[string]string) bool
- func (rm ResourceMatcher) Any(name string, gvr schema.GroupVersionResource, resourceLabels map[string]string) bool
- func (rm ResourceMatcher) Empty() bool
- func (rm ResourceMatcher) TypeMatcher(usageInclusion bool) ResourceTypeMatcher
- type ResourceRequirement
- type ResourceTypeMatcher
- type ResourceTypeRequirement
- type Specs
Constants ¶
const K8sCoreGroupExactMatch = "core"
K8sCoreGroupExactMatch is sentinel value that only matches K8s core group of ""
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GroupVersionResourceList ¶
type GroupVersionResourceList []schema.GroupVersionResource
GroupVersionResourceList is a collection of GroupVersionResource objects
func (GroupVersionResourceList) Exclude ¶
func (g GroupVersionResourceList) Exclude(ms ...ResourceTypeMatcher) GroupVersionResourceList
Exclude returns a GroupVersionResourceList with resources removed that should be excluded according to the ResourceTypeMatcher filter
func (GroupVersionResourceList) Include ¶
func (g GroupVersionResourceList) Include(ms ...ResourceTypeMatcher) GroupVersionResourceList
Include returns a GroupVersionResourceList that should be included according to the ResourceTypeMatcher filter
type Resource ¶
type Resource struct { Name string GVR schema.GroupVersionResource ResourceLabels map[string]string }
Resource represents a named Kubernetes object (name + GVR). This provides methods to use for filtering/selection.
Note: This does not include 'Namespace'. The assumption is that the caller is responsible for determining what namespace scope to use for filtering
type ResourceList ¶
type ResourceList []Resource
ResourceList is a collection of Resource objects
func (ResourceList) Exclude ¶
func (rl ResourceList) Exclude(m ResourceMatcher) ResourceList
Exclude returns any resources from the ResourceList that do not match the criteria in the specified ResourceMatcher
func (ResourceList) Include ¶
func (rl ResourceList) Include(m ResourceMatcher) ResourceList
Include returns any resources from the ResourceList that match the criteria in the specified ResourceMatcher
type ResourceMatcher ¶
type ResourceMatcher []ResourceRequirement
ResourceMatcher is a collection of ResourceRequirement objects for filtering resources
func (ResourceMatcher) All ¶
func (rm ResourceMatcher) All(name string, gvr schema.GroupVersionResource, resourceLabels map[string]string) bool
All returns true if the specified resource matches all of the requirements in `ResourceMatcher`
func (ResourceMatcher) Any ¶
func (rm ResourceMatcher) Any(name string, gvr schema.GroupVersionResource, resourceLabels map[string]string) bool
Any returns true if the specified resource matches any of the requirements in `ResourceMatcher`
func (ResourceMatcher) Empty ¶
func (rm ResourceMatcher) Empty() bool
Empty returns true if ResourceMatcher has no ResourceRequirements
func (ResourceMatcher) TypeMatcher ¶
func (rm ResourceMatcher) TypeMatcher(usageInclusion bool) ResourceTypeMatcher
TypeMatcher constructs a resource type matcher based on a `ResourceMatcher`
The `usageInclusion` flag should be set to true if the type matcher will be used as an include filter
type ResourceRequirement ¶
type ResourceRequirement struct { // Provides the Name of the resource object corev1.LocalObjectReference `json:",inline,omitempty"` // Provides the Group, Version, and Resource values (GVR) ResourceTypeRequirement `json:",inline,omitempty"` // Specifies a set of label requirements to be used as filters for matches metav1.LabelSelector `json:",inline,omitempty"` }
ResourceRequirement allows specifying a resource requirement by type and/or name
func (ResourceRequirement) DeepCopyInto ¶
func (r ResourceRequirement) DeepCopyInto(out *ResourceRequirement)
DeepCopyInto provides explicit deep copy implementation to avoid
func (ResourceRequirement) Matches ¶
func (r ResourceRequirement) Matches(name string, gvr schema.GroupVersionResource, resourceLabels map[string]string) bool
Matches returns true if the specified resource name/GVR/labels matches the requirement
type ResourceTypeMatcher ¶
type ResourceTypeMatcher []ResourceTypeRequirement
ResourceTypeMatcher is a collection of ResourceTypeRequirement objects
func JoinResourceTypeMatchers ¶
func JoinResourceTypeMatchers(ms ...ResourceTypeMatcher) ResourceTypeMatcher
JoinResourceTypeMatchers joins multiple ResourceTypeMatchers into one
func (ResourceTypeMatcher) All ¶
func (rtm ResourceTypeMatcher) All(gvr schema.GroupVersionResource) bool
All returns true if all resources in the collection match
func (ResourceTypeMatcher) Any ¶
func (rtm ResourceTypeMatcher) Any(gvr schema.GroupVersionResource) bool
Any returns true if there are any GVR matches in the collection
func (ResourceTypeMatcher) Empty ¶
func (rtm ResourceTypeMatcher) Empty() bool
Empty returns true if ResourceTypeMatcher collection has no objects
func (ResourceTypeMatcher) ResourceMatcher ¶
func (rtm ResourceTypeMatcher) ResourceMatcher() ResourceMatcher
ResourceMatcher constructs a resource matcher based on a `ResourceTypeMatcher`
type ResourceTypeRequirement ¶
type ResourceTypeRequirement struct { Group string `json:"group,omitempty"` Version string `json:"version,omitempty"` Resource string `json:"resource,omitempty"` }
ResourceTypeRequirement contains group, version and resource values
func (ResourceTypeRequirement) Empty ¶
func (rtr ResourceTypeRequirement) Empty() bool
Empty returns true if ResourceTypeRequirement has no fields set
func (ResourceTypeRequirement) Matches ¶
func (r ResourceTypeRequirement) Matches(gvr schema.GroupVersionResource) bool
Matches returns true if group, version and resource values match or are empty Group value of K8sCoreGroupExactMatch only matches K8s core group of ""
type Specs ¶
type Specs map[schema.GroupVersionResource][]unstructured.Unstructured
func (Specs) Exclude ¶
func (s Specs) Exclude(ms ...ResourceTypeMatcher) Specs
func (Specs) Include ¶
func (s Specs) Include(ms ...ResourceTypeMatcher) Specs