Documentation
¶
Index ¶
- Constants
- Variables
- func ExtractGVKFromUnstructured(unstructured map[string]interface{}) (schema.GroupVersionKind, error)
- func GVKtoGVR(gvk schema.GroupVersionKind) schema.GroupVersionResource
- func GVRtoGVK(gvr schema.GroupVersionResource) schema.GroupVersionKind
- func GetResourceGraphDefinitionInstanceGVK(group, apiVersion, kind string) schema.GroupVersionKind
- func GetResourceGraphDefinitionInstanceGVR(group, apiVersion, kind string) schema.GroupVersionResource
- func HasInstanceFinalizerUnstructured(obj *unstructured.Unstructured) (bool, error)
- func HasResourceGraphDefinitionFinalizer(obj metav1.Object) bool
- func IsKroOwned(meta metav1.ObjectMeta) bool
- func NewInstanceAndResourceGraphDefinitionSelector(instance metav1.Object, resourceGraphDefinition metav1.Object) metav1.LabelSelector
- func NewInstanceOwnerReference(gvk schema.GroupVersionKind, name string, uid types.UID) metav1.OwnerReference
- func NewInstanceSelector(instance metav1.Object) metav1.LabelSelector
- func NewNodeAndInstanceAndResourceGraphDefinitionSelector(node metav1.Object, instance metav1.Object, ...) metav1.LabelSelector
- func NewResourceGraphDefinitionOwnerReference(name string, uid types.UID) metav1.OwnerReference
- func NewResourceGraphDefinitionSelector(resourceGraphDefinition metav1.Object) metav1.LabelSelector
- func RemoveInstanceFinalizerUnstructured(obj *unstructured.Unstructured) error
- func RemoveResourceGraphDefinitionFinalizer(obj metav1.Object)
- func SetInstanceFinalizerUnstructured(obj *unstructured.Unstructured) error
- func SetKroOwned(meta metav1.ObjectMeta)
- func SetKroUnowned(meta metav1.ObjectMeta)
- func SetResourceGraphDefinitionFinalizer(obj metav1.Object)
- type GenericLabeler
- type Labeler
Constants ¶
const ( NodeIDLabel = LabelKroPrefix + "node-id" OwnedLabel = LabelKroPrefix + "owned" KroVersionLabel = LabelKroPrefix + "kro-version" ControllerPodIDLabel = LabelKroPrefix + "controller-pod-id" InstanceIDLabel = LabelKroPrefix + "instance-id" InstanceLabel = LabelKroPrefix + "instance-name" InstanceNamespaceLabel = LabelKroPrefix + "instance-namespace" ResourceGraphDefinitionIDLabel = LabelKroPrefix + "resource-graph-definition-id" ResourceGraphDefinitionNameLabel = LabelKroPrefix + "resource-graph-definition-name" ResourceGraphDefinitionNamespaceLabel = LabelKroPrefix + "resource-graph-definition-namespace" ResourceGraphDefinitionVersionLabel = LabelKroPrefix + "resource-graph-definition-version" )
const (
KroInstancesGroupSuffix = v1alpha1.KroDomainName
)
const ( // LabelKro is the label key used to identify Kro owned resources. LabelKroPrefix = v1alpha1.KroDomainName + "/" )
Variables ¶
var ( KRORGOwnerReferenceKind = "ResourceGraphDefinition" KRORGOwnerReferenceAPIVersion = v1alpha1.GroupVersion.String() )
var (
ErrDuplicatedLabels = errors.New("duplicate labels")
)
Functions ¶
func ExtractGVKFromUnstructured ¶
func ExtractGVKFromUnstructured(unstructured map[string]interface{}) (schema.GroupVersionKind, error)
ExtractGVKFromUnstructured extracts the GroupVersionKind from an unstructured object.
func GVKtoGVR ¶
func GVKtoGVR(gvk schema.GroupVersionKind) schema.GroupVersionResource
func GVRtoGVK ¶
func GVRtoGVK(gvr schema.GroupVersionResource) schema.GroupVersionKind
func GetResourceGraphDefinitionInstanceGVK ¶
func GetResourceGraphDefinitionInstanceGVK(group, apiVersion, kind string) schema.GroupVersionKind
func GetResourceGraphDefinitionInstanceGVR ¶
func GetResourceGraphDefinitionInstanceGVR(group, apiVersion, kind string) schema.GroupVersionResource
func HasInstanceFinalizerUnstructured ¶
func HasInstanceFinalizerUnstructured(obj *unstructured.Unstructured) (bool, error)
HasInstanceFinalizerUnstructured checks if an unstructured object has an instance-specific finalizer.
func HasResourceGraphDefinitionFinalizer ¶
HasResourceGraphDefinitionFinalizer checks if the object has the Kro finalizer.
func IsKroOwned ¶
func IsKroOwned(meta metav1.ObjectMeta) bool
IsKroOwned returns true if the resource is owned by Kro.
func NewInstanceOwnerReference ¶
func NewInstanceOwnerReference(gvk schema.GroupVersionKind, name string, uid types.UID) metav1.OwnerReference
stamped on the RGI child resources
func NewInstanceSelector ¶
func NewInstanceSelector(instance metav1.Object) metav1.LabelSelector
func NewResourceGraphDefinitionOwnerReference ¶
func NewResourceGraphDefinitionOwnerReference(name string, uid types.UID) metav1.OwnerReference
stamped on the CRD and RGIs
func NewResourceGraphDefinitionSelector ¶
func NewResourceGraphDefinitionSelector(resourceGraphDefinition metav1.Object) metav1.LabelSelector
func RemoveInstanceFinalizerUnstructured ¶
func RemoveInstanceFinalizerUnstructured(obj *unstructured.Unstructured) error
RemoveInstanceFinalizerUnstructured removes an instance-specific finalizer from an unstructured object.
func RemoveResourceGraphDefinitionFinalizer ¶
RemoveResourceGraphDefinitionFinalizer removes the Kro finalizer from the object.
func SetInstanceFinalizerUnstructured ¶
func SetInstanceFinalizerUnstructured(obj *unstructured.Unstructured) error
SetInstanceFinalizerUnstructured adds an instance-specific finalizer to an unstructured object.
func SetKroOwned ¶
func SetKroOwned(meta metav1.ObjectMeta)
SetKroOwned sets the OwnedLabel to true on the resource.
func SetKroUnowned ¶
func SetKroUnowned(meta metav1.ObjectMeta)
SetKroUnowned sets the OwnedLabel to false on the resource.
func SetResourceGraphDefinitionFinalizer ¶
SetResourceGraphDefinitionFinalizer adds the Kro finalizer to the object if it's not already present.
Types ¶
type GenericLabeler ¶
GenericLabeler is a map of labels that can be applied to a resource. It implements the Labeler interface.
func NewInstanceLabeler ¶
func NewInstanceLabeler(instanceMeta metav1.Object) GenericLabeler
NewInstanceLabeler returns a new labeler that sets the InstanceLabel and InstanceIDLabel labels on a resource. The InstanceLabel is the namespace and name of the instance that was reconciled to create the resource.
func NewKroMetaLabeler ¶
func NewKroMetaLabeler( kroVersion string, controllerPodID string, ) GenericLabeler
NewKroMetaLabeler returns a new labeler that sets the OwnedLabel, KroVersion, and ControllerPodID labels on a resource.
func NewResourceGraphDefinitionLabeler ¶
func NewResourceGraphDefinitionLabeler(rgMeta metav1.Object) GenericLabeler
NewResourceGraphDefinitionLabeler returns a new labeler that sets the ResourceGraphDefinitionLabel and ResourceGraphDefinitionIDLabel labels on a resource.
func (GenericLabeler) ApplyLabels ¶
func (gl GenericLabeler) ApplyLabels(meta metav1.Object)
ApplyLabels applies the labels to the resource.
func (GenericLabeler) Copy ¶
func (gl GenericLabeler) Copy() map[string]string
Copy returns a copy of the labels.
func (GenericLabeler) Labels ¶
func (gl GenericLabeler) Labels() map[string]string
Labels returns the labels.