Documentation ¶
Overview ¶
Package function contains all common functions used in the project
Index ¶
- func CheckVeleroBackupMetadata(obj client.Object) bool
- func GenerateNacObjectUUID(namespace, nacName string) string
- func GetLogger(ctx context.Context, obj client.Object, key string) logr.Logger
- func GetNonAdminBackupAnnotations(objectMeta metav1.ObjectMeta) map[string]string
- func GetNonAdminLabels() map[string]string
- func GetVeleroBackupByLabel(ctx context.Context, clientInstance client.Client, namespace string, ...) (*velerov1.Backup, error)
- func GetVeleroDeleteBackupRequestByLabel(ctx context.Context, clientInstance client.Client, namespace string, ...) (*velerov1.DeleteBackupRequest, error)
- func ListObjectsByLabel(ctx context.Context, clientInstance client.Client, namespace string, ...) error
- func ValidateBackupSpec(nonAdminBackup *nacv1alpha1.NonAdminBackup, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckVeleroBackupMetadata ¶
CheckVeleroBackupMetadata return true if Velero Backup object has required Non Admin labels and annotations, false otherwise
func GenerateNacObjectUUID ¶
GenerateNacObjectUUID generates a unique name based on the provided namespace and object origin name. It includes a UUID suffix. If the name exceeds the maximum length, it truncates nacName first, then namespace.
func GetLogger ¶
GetLogger return a logger from input ctx, with additional key/value pairs being input key and input obj name and namespace
func GetNonAdminBackupAnnotations ¶
func GetNonAdminBackupAnnotations(objectMeta metav1.ObjectMeta) map[string]string
GetNonAdminBackupAnnotations return the required Non Admin annotations
func GetNonAdminLabels ¶
GetNonAdminLabels return the required Non Admin labels
func GetVeleroBackupByLabel ¶
func GetVeleroBackupByLabel(ctx context.Context, clientInstance client.Client, namespace string, labelValue string) (*velerov1.Backup, error)
GetVeleroBackupByLabel retrieves a VeleroBackup object based on a specified label within a given namespace. It returns the VeleroBackup only when exactly one object is found, throws an error if multiple backups are found, or returns nil if no matches are found.
func GetVeleroDeleteBackupRequestByLabel ¶
func GetVeleroDeleteBackupRequestByLabel(ctx context.Context, clientInstance client.Client, namespace string, labelValue string) (*velerov1.DeleteBackupRequest, error)
GetVeleroDeleteBackupRequestByLabel retrieves a DeleteBackupRequest object based on a specified label within a given namespace. It returns the DeleteBackupRequest only when exactly one object is found, throws an error if multiple backups are found, or returns nil if no matches are found.
func ListObjectsByLabel ¶
func ListObjectsByLabel(ctx context.Context, clientInstance client.Client, namespace string, labelKey string, labelValue string, objectList client.ObjectList) error
ListObjectsByLabel retrieves a list of Kubernetes objects in a specified namespace that match a given label key-value pair.
func ValidateBackupSpec ¶
func ValidateBackupSpec(nonAdminBackup *nacv1alpha1.NonAdminBackup, enforcedBackupSpec *velerov1.BackupSpec) error
ValidateBackupSpec return nil, if NonAdminBackup is valid; error otherwise
Types ¶
This section is empty.