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 GetResourceGroupInstanceGVK(apiVersion, kind string) schema.GroupVersionKind
- func GetResourceGroupInstanceGVR(apiVersion, kind string) schema.GroupVersionResource
- func HasInstanceFinalizer(obj metav1.Object, uid types.UID) bool
- func HasInstanceFinalizerUnstructured(obj *unstructured.Unstructured, uid types.UID) (bool, error)
- func HasResourceGroupFinalizer(obj metav1.Object) bool
- func IsKroOwned(meta metav1.ObjectMeta) bool
- func NewInstanceAndResourceGroupSelector(instance metav1.Object, resourceGroup metav1.Object) metav1.LabelSelector
- func NewInstanceOwnerReference(gvk schema.GroupVersionKind, name string, uid types.UID) metav1.OwnerReference
- func NewInstanceSelector(instance metav1.Object) metav1.LabelSelector
- func NewNodeAndInstanceAndResourceGroupSelector(node metav1.Object, instance metav1.Object, resourceGroup metav1.Object) metav1.LabelSelector
- func NewResourceGroupOwnerReference(name string, uid types.UID) metav1.OwnerReference
- func NewResourceGroupSelector(resourceGroup metav1.Object) metav1.LabelSelector
- func RemoveInstanceFinalizer(obj metav1.Object, uid types.UID)
- func RemoveInstanceFinalizerUnstructured(obj *unstructured.Unstructured, uid types.UID) error
- func RemoveResourceGroupFinalizer(obj metav1.Object)
- func SetInstanceFinalizer(obj metav1.Object, uid types.UID)
- func SetInstanceFinalizerUnstructured(obj *unstructured.Unstructured, uid types.UID) error
- func SetKroOwned(meta metav1.ObjectMeta)
- func SetKroUnowned(meta metav1.ObjectMeta)
- func SetResourceGroupFinalizer(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" ResourceGroupIDLabel = LabelKroPrefix + "resource-group-id" ResourceGroupNameLabel = LabelKroPrefix + "resource-group-name" ResourceGroupNamespaceLabel = LabelKroPrefix + "resource-group-namespace" ResourceGroupVersionLabel = LabelKroPrefix + "resource-group-version" )
const (
KroInstancesGroupSuffix = v1alpha1.KroDomainName
)
const ( // LabelKro is the label key used to identify Kro owned resources. LabelKroPrefix = v1alpha1.KroDomainName + "/" )
Variables ¶
var ( KRORGOwnerReferenceKind = "ResourceGroup" 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 GetResourceGroupInstanceGVK ¶
func GetResourceGroupInstanceGVK(apiVersion, kind string) schema.GroupVersionKind
func GetResourceGroupInstanceGVR ¶
func GetResourceGroupInstanceGVR(apiVersion, kind string) schema.GroupVersionResource
func HasInstanceFinalizer ¶
HasInstanceFinalizer checks if the object has an instance-specific finalizer.
func HasInstanceFinalizerUnstructured ¶
func HasInstanceFinalizerUnstructured(obj *unstructured.Unstructured, uid types.UID) (bool, error)
HasInstanceFinalizerUnstructured checks if an unstructured object has an instance-specific finalizer.
func HasResourceGroupFinalizer ¶
HasResourceGroupFinalizer 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 NewResourceGroupOwnerReference ¶
func NewResourceGroupOwnerReference(name string, uid types.UID) metav1.OwnerReference
stamped on the CRD and RGIs
func NewResourceGroupSelector ¶
func NewResourceGroupSelector(resourceGroup metav1.Object) metav1.LabelSelector
func RemoveInstanceFinalizer ¶
RemoveInstanceFinalizer removes an instance-specific finalizer from the object.
func RemoveInstanceFinalizerUnstructured ¶
func RemoveInstanceFinalizerUnstructured(obj *unstructured.Unstructured, uid types.UID) error
RemoveInstanceFinalizerUnstructured removes an instance-specific finalizer from an unstructured object.
func RemoveResourceGroupFinalizer ¶
RemoveResourceGroupFinalizer removes the Kro finalizer from the object.
func SetInstanceFinalizer ¶
SetInstanceFinalizer adds an instance-specific finalizer to the object.
func SetInstanceFinalizerUnstructured ¶
func SetInstanceFinalizerUnstructured(obj *unstructured.Unstructured, uid types.UID) 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 SetResourceGroupFinalizer ¶
SetResourceGroupFinalizer 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 NewResourceGroupLabeler ¶
func NewResourceGroupLabeler(rgMeta metav1.Object) GenericLabeler
NewResourceGroupLabeler returns a new labeler that sets the ResourceGroupLabel and ResourceGroupIDLabel 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.