Documentation
¶
Overview ¶
Package function contains all common functions used in the project
Index ¶
- func CheckLabelAnnotationValueIsValid(labelsOrAnnotations map[string]string, key string) bool
- func CheckVeleroBackupAnnotations(obj client.Object) bool
- func CheckVeleroBackupMetadata(obj client.Object) bool
- func CheckVeleroBackupStorageLocationAnnotations(obj client.Object) bool
- func CheckVeleroBackupStorageLocationMetadata(obj client.Object) bool
- func CheckVeleroRestoreAnnotations(obj client.Object) bool
- func CheckVeleroRestoreMetadata(obj client.Object) bool
- func ComputePrefixForObjectStorage(namespace, customPrefix string) string
- func GenerateNacObjectUUID(namespace, nacName string) string
- func GetActiveVeleroBackupsByLabel(ctx context.Context, clientInstance client.Client, ...) ([]velerov1.Backup, error)
- func GetActiveVeleroRestoresByLabel(ctx context.Context, clientInstance client.Client, ...) ([]velerov1.Restore, error)
- func GetBackupQueueInfo(ctx context.Context, clientInstance client.Client, namespace string, ...) (nacv1alpha1.QueueInfo, error)
- func GetBslSecretByLabel(ctx context.Context, clientInstance client.Client, namespace string, ...) (*corev1.Secret, error)
- func GetLogger(ctx context.Context, obj client.Object, key string) logr.Logger
- func GetNabslRequestByLabel(ctx context.Context, clientInstance client.Client, namespace string, ...) (*nacv1alpha1.NonAdminBackupStorageLocationRequest, error)
- func GetNonAdminBackupAnnotations(objectMeta metav1.ObjectMeta) map[string]string
- func GetNonAdminBackupStorageLocationAnnotations(objectMeta metav1.ObjectMeta) map[string]string
- func GetNonAdminDownloadRequestAnnotations(objectMeta *nacv1alpha1.NonAdminDownloadRequest) map[string]string
- func GetNonAdminLabels() map[string]string
- func GetNonAdminRestoreAnnotations(objectMeta metav1.ObjectMeta) map[string]string
- func GetNonAdminRestoreLabels(uniqueIdentifier string) map[string]string
- func GetRestoreQueueInfo(ctx context.Context, clientInstance client.Client, namespace string, ...) (nacv1alpha1.QueueInfo, error)
- func GetVeleroBackupByLabel(ctx context.Context, clientInstance client.Client, namespace string, ...) (*velerov1.Backup, error)
- func GetVeleroBackupStorageLocationByLabel(ctx context.Context, clientInstance client.Client, namespace string, ...) (*velerov1.BackupStorageLocation, error)
- func GetVeleroDeleteBackupRequestByLabel(ctx context.Context, clientInstance client.Client, namespace string, ...) (*velerov1.DeleteBackupRequest, error)
- func GetVeleroRestoreByLabel(ctx context.Context, clientInstance client.Client, namespace string, ...) (*velerov1.Restore, error)
- func ListObjectsByLabel(ctx context.Context, clientInstance client.Client, namespace string, ...) error
- func ValidateBackupSpec(ctx context.Context, clientInstance client.Client, oadpNamespace string, ...) error
- func ValidateBslSpec(ctx context.Context, clientInstance client.Client, ...) error
- func ValidateRestoreSpec(ctx context.Context, clientInstance client.Client, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLabelAnnotationValueIsValid ¶
CheckLabelAnnotationValueIsValid return true if key exists among labels/annotations and has a valid length, false otherwise
func CheckVeleroBackupAnnotations ¶
CheckVeleroBackupAnnotations return true if Velero Backup object has required Non Admin annotations, false otherwise
func CheckVeleroBackupMetadata ¶
CheckVeleroBackupMetadata return true if Velero Backup object has required Non Admin labels and annotations, false otherwise
func CheckVeleroBackupStorageLocationAnnotations ¶
CheckVeleroBackupStorageLocationAnnotations return true if Velero BackupStorageLocation object has required Non Admin annotations, false otherwise
func CheckVeleroBackupStorageLocationMetadata ¶
CheckVeleroBackupStorageLocationMetadata return true if Velero BackupStorageLocation object has required Non Admin labels and annotations, false otherwise
func CheckVeleroRestoreAnnotations ¶
CheckVeleroRestoreAnnotations return true if Velero Restore object has required Non Admin annotations, false otherwise
func CheckVeleroRestoreMetadata ¶
CheckVeleroRestoreMetadata return true if Velero Restore object has required Non Admin labels and annotations, false otherwise
func ComputePrefixForObjectStorage ¶
ComputePrefixForObjectStorage returns the prefix to be used for the BackupStorageLocation. If a custom prefix is provided, it returns "<namespace>/<customPrefix>". Otherwise, it returns the namespace name.
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 GetActiveVeleroBackupsByLabel ¶
func GetActiveVeleroBackupsByLabel(ctx context.Context, clientInstance client.Client, namespace, labelKey, labelValue string) ([]velerov1.Backup, error)
GetActiveVeleroBackupsByLabel retrieves all VeleroBackup objects based on a specified label within a given namespace. It returns a slice of VeleroBackup objects or nil if none are found.
func GetActiveVeleroRestoresByLabel ¶
func GetActiveVeleroRestoresByLabel(ctx context.Context, clientInstance client.Client, namespace, labelKey, labelValue string) ([]velerov1.Restore, error)
GetActiveVeleroRestoresByLabel retrieves all VeleroRestore objects based on a specified label within a given namespace. It returns a slice of VeleroRestore objects or nil if none are found.
func GetBackupQueueInfo ¶
func GetBackupQueueInfo(ctx context.Context, clientInstance client.Client, namespace string, targetBackup *velerov1.Backup) (nacv1alpha1.QueueInfo, error)
GetBackupQueueInfo determines the queue position of the specified VeleroBackup. It calculates how many queued Backups exist in the namespace that were created before this one.
func GetBslSecretByLabel ¶
func GetBslSecretByLabel(ctx context.Context, clientInstance client.Client, namespace string, labelValue string) (*corev1.Secret, error)
GetBslSecretByLabel retrieves a Secret object based on a specified label within a given namespace. It returns the Secret only when exactly one object is found, throws an error if multiple secrets are found, or returns nil if no matches are found.
func GetLogger ¶
GetLogger return a logger from input ctx, with additional key/value pairs being input key and input obj name and namespace
func GetNabslRequestByLabel ¶
func GetNabslRequestByLabel(ctx context.Context, clientInstance client.Client, namespace string, labelValue string) (*nacv1alpha1.NonAdminBackupStorageLocationRequest, error)
GetNabslRequestByLabel retrieves a NonAdminBackupStorageLocationRequest object based on a specified label within a given namespace. It returns the NonAdminBackupStorageLocationRequest only when exactly one object is found, throws an error if multiple NonAdminBackupStorageLocationRequests are found, or returns nil if no matches are found.
func GetNonAdminBackupAnnotations ¶
func GetNonAdminBackupAnnotations(objectMeta metav1.ObjectMeta) map[string]string
GetNonAdminBackupAnnotations return the required Non Admin annotations
func GetNonAdminBackupStorageLocationAnnotations ¶
func GetNonAdminBackupStorageLocationAnnotations(objectMeta metav1.ObjectMeta) map[string]string
GetNonAdminBackupStorageLocationAnnotations return the required Non Admin annotations
func GetNonAdminDownloadRequestAnnotations ¶
func GetNonAdminDownloadRequestAnnotations(objectMeta *nacv1alpha1.NonAdminDownloadRequest) map[string]string
GetNonAdminDownloadRequestAnnotations return the required Non Admin annotations
func GetNonAdminLabels ¶
GetNonAdminLabels return the required Non Admin labels
func GetNonAdminRestoreAnnotations ¶
func GetNonAdminRestoreAnnotations(objectMeta metav1.ObjectMeta) map[string]string
GetNonAdminRestoreAnnotations return the required Non Admin restore annotations
func GetNonAdminRestoreLabels ¶
GetNonAdminRestoreLabels return the required Non Admin restore labels
func GetRestoreQueueInfo ¶
func GetRestoreQueueInfo(ctx context.Context, clientInstance client.Client, namespace string, targetRestore *velerov1.Restore) (nacv1alpha1.QueueInfo, error)
GetRestoreQueueInfo determines the queue position of the specified VeleroRestore. It calculates how many queued Restores exist in the namespace that were created before this one.
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 GetVeleroBackupStorageLocationByLabel ¶
func GetVeleroBackupStorageLocationByLabel(ctx context.Context, clientInstance client.Client, namespace string, labelValue string) (*velerov1.BackupStorageLocation, error)
GetVeleroBackupStorageLocationByLabel retrieves a VeleroBackupStorageLocation object based on a specified label within a given namespace. It returns the VeleroBackupStorageLocation only when exactly one object is found, throws an error if multiple VeleroBackupStorageLocation 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 GetVeleroRestoreByLabel ¶
func GetVeleroRestoreByLabel(ctx context.Context, clientInstance client.Client, namespace string, labelValue string) (*velerov1.Restore, error)
GetVeleroRestoreByLabel retrieves a VeleroRestore object based on a specified label within a given namespace. It returns the VeleroRestore only when exactly one object is found, throws an error if multiple restores 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(ctx context.Context, clientInstance client.Client, oadpNamespace string, nonAdminBackup *nacv1alpha1.NonAdminBackup, enforcedBackupSpec *velerov1.BackupSpec) error
ValidateBackupSpec return nil, if NonAdminBackup is valid; error otherwise
func ValidateBslSpec ¶
func ValidateBslSpec(ctx context.Context, clientInstance client.Client, nonAdminBsl *nacv1alpha1.NonAdminBackupStorageLocation, enforcedBSLSpec *oadpv1alpha1.EnforceBackupStorageLocationSpec, appliedBackupSyncPeriod time.Duration, defaultBackupSyncPeriod *time.Duration) error
ValidateBslSpec return nil, if NonAdminBackupStorageLocation is valid; error otherwise
func ValidateRestoreSpec ¶
func ValidateRestoreSpec(ctx context.Context, clientInstance client.Client, nonAdminRestore *nacv1alpha1.NonAdminRestore, enforcedRestoreSpec *velerov1.RestoreSpec) error
ValidateRestoreSpec return nil, if NonAdminRestore is valid; error otherwise
Types ¶
This section is empty.