Documentation
¶
Index ¶
- Constants
- Variables
- func CreateOrUpdateDataProtectionAppliation(ctx context.Context, dpa *unstructured.Unstructured, c client.Client) error
- func CreateOrUpdateSecret(ctx context.Context, secret *corev1.Secret, c client.Client) error
- func IsBRFailedError(err error) bool
- func IsBRFailedValidationError(err error) bool
- func IsBRStorageBackendUnavailableError(err error) bool
- func IsDPAReconciled(dpa *unstructured.Unstructured) bool
- func ReadOadpDataProtectionApplication(dpaYamlDir string) (*unstructured.Unstructured, error)
- type BRHandler
- func (h *BRHandler) CheckOadpMinimumVersion(ctx context.Context) (bool, error)
- func (h *BRHandler) CheckOadpOperatorAvailability(ctx context.Context) error
- func (h *BRHandler) CleanupBackups(ctx context.Context) error
- func (h *BRHandler) CleanupDeleteBackupRequests(ctx context.Context) error
- func (h *BRHandler) CleanupStaleBackups(ctx context.Context, backups []*velerov1.Backup) error
- func (h *BRHandler) EnsureOadpConfiguration(ctx context.Context) error
- func (h *BRHandler) ExportOadpConfigurationToDir(ctx context.Context, toDir, oadpNamespace string) error
- func (h *BRHandler) ExportRestoresToDir(ctx context.Context, configMaps []ibuv1.ConfigMapRef, toDir string) error
- func (h *BRHandler) GetDataProtectionApplicationList(ctx context.Context) (*unstructured.UnstructuredList, error)
- func (h *BRHandler) GetSortedBackupsFromConfigmap(ctx context.Context, content []ibuv1.ConfigMapRef) ([][]*velerov1.Backup, error)
- func (h *BRHandler) IsOadpInstalled(ctx context.Context) bool
- func (h *BRHandler) LoadRestoresFromOadpRestorePath() ([][]*velerov1.Restore, error)
- func (h *BRHandler) PatchPVsReclaimPolicy(ctx context.Context) error
- func (h *BRHandler) RestorePVsReclaimPolicy(ctx context.Context) error
- func (h *BRHandler) StartOrTrackBackup(ctx context.Context, backups []*velerov1.Backup) (*BackupTracker, error)
- func (h *BRHandler) StartOrTrackRestore(ctx context.Context, restores []*velerov1.Restore) (*RestoreTracker, error)
- func (h *BRHandler) ValidateOadpConfigmaps(ctx context.Context, content []ibuv1.ConfigMapRef) error
- type BRStatusError
- type BackupTracker
- type BackuperRestorer
- type ObjMetadata
- type RestoreTracker
Constants ¶
const ( OadpPath = "/opt/OADP" OadpRestorePath = OadpPath + "/veleroRestore" OadpDpaPath = OadpPath + "/dpa" OadpSecretPath = OadpPath + "/secret" // OadpNs is the namespace used for everything related OADP e.g configsMaps, DataProtectionApplicationm, Restore, etc OadpNs = "openshift-adp" OadpMinSupportedVersion = "1.3.1" )
Variables ¶
var ( DpaGvk = schema.GroupVersionKind{Group: "oadp.openshift.io", Kind: "DataProtectionApplication", Version: "v1alpha1"} DpaGvkList = schema.GroupVersionKind{Group: "oadp.openshift.io", Kind: "DataProtectionApplicationList", Version: "v1alpha1"} )
Functions ¶
func CreateOrUpdateDataProtectionAppliation ¶
func CreateOrUpdateDataProtectionAppliation(ctx context.Context, dpa *unstructured.Unstructured, c client.Client) error
func CreateOrUpdateSecret ¶
func IsBRFailedError ¶
func IsDPAReconciled ¶
func IsDPAReconciled(dpa *unstructured.Unstructured) bool
func ReadOadpDataProtectionApplication ¶
func ReadOadpDataProtectionApplication(dpaYamlDir string) (*unstructured.Unstructured, error)
Types ¶
type BRHandler ¶
BRHandler handles the backup and restore
func (*BRHandler) CheckOadpMinimumVersion ¶
CheckOadpMinimumVersion checks the minimum supported version for the OADP operator version from the installed CSV.
func (*BRHandler) CheckOadpOperatorAvailability ¶
func (*BRHandler) CleanupBackups ¶
CleanupBackups deletes all backups for this cluster from object storage
func (*BRHandler) CleanupDeleteBackupRequests ¶
CleanupDeleteBackupRequests deletes all DeleteBackupRequest for this cluster from object storage
func (*BRHandler) CleanupStaleBackups ¶
CleanupStaleBackups checks and deletes if there are any stale Backups (with the same name) that may be available in the object storage but do not belong to this cluster.
func (*BRHandler) EnsureOadpConfiguration ¶
EnsureOadpConfiguration ensures the expected OADP configuration is present
func (*BRHandler) ExportOadpConfigurationToDir ¶
func (h *BRHandler) ExportOadpConfigurationToDir(ctx context.Context, toDir, oadpNamespace string) error
ExportOadpConfigurationToDir exports the OADP DataProtectionApplication CR and required storage creds to a given location
func (*BRHandler) ExportRestoresToDir ¶
func (h *BRHandler) ExportRestoresToDir(ctx context.Context, configMaps []ibuv1.ConfigMapRef, toDir string) error
ExportRestoresToDir extracts all restore CRs from oadp configmaps and write them to a given location returns: error
func (*BRHandler) GetDataProtectionApplicationList ¶
func (h *BRHandler) GetDataProtectionApplicationList(ctx context.Context) (*unstructured.UnstructuredList, error)
func (*BRHandler) GetSortedBackupsFromConfigmap ¶
func (h *BRHandler) GetSortedBackupsFromConfigmap(ctx context.Context, content []ibuv1.ConfigMapRef) ([][]*velerov1.Backup, error)
GetSortedBackupsFromConfigmap returns a list of sorted backup CRs extracted from configmap
func (*BRHandler) IsOadpInstalled ¶
IsOadpInstalled a simple function to determine if OADP is installed by checking the presence of its CSV and at least one OADP defined CRD
func (*BRHandler) LoadRestoresFromOadpRestorePath ¶
func (*BRHandler) PatchPVsReclaimPolicy ¶
PatchPVsReclaimPolicy - when LVMS is configured, we need to patch PVs with Retain as the persistentVolumeReclaimPolicy due to https://github.com/vmware-tanzu/velero/issues/2739.
func (*BRHandler) RestorePVsReclaimPolicy ¶
RestorePVsReclaimPolicy restores the persistentVolumeReclaimPolicy field back to its original value, in PVs created by LVMS (this field was updated during pre-pivot by LCA).
func (*BRHandler) StartOrTrackBackup ¶
func (h *BRHandler) StartOrTrackBackup(ctx context.Context, backups []*velerov1.Backup) (*BackupTracker, error)
StartOrTrackBackup start backup or track backup status
func (*BRHandler) StartOrTrackRestore ¶
func (h *BRHandler) StartOrTrackRestore(ctx context.Context, restores []*velerov1.Restore, ) ( *RestoreTracker, error, )
StartOrTrackRestore start restore or track restore status
func (*BRHandler) ValidateOadpConfigmaps ¶
type BRStatusError ¶
BRStatusError type
func NewBRFailedError ¶
func NewBRFailedError(brType, msg string) *BRStatusError
func NewBRFailedValidationError ¶
func NewBRFailedValidationError(brType, msg string) *BRStatusError
func NewBRStorageBackendUnavailableError ¶
func NewBRStorageBackendUnavailableError(msg string) *BRStatusError
func (*BRStatusError) Error ¶
func (e *BRStatusError) Error() string
type BackupTracker ¶
type BackuperRestorer ¶
type BackuperRestorer interface { CleanupBackups(ctx context.Context) error CleanupStaleBackups(ctx context.Context, backups []*velerov1.Backup) error CleanupDeleteBackupRequests(ctx context.Context) error CheckOadpOperatorAvailability(ctx context.Context) error PatchPVsReclaimPolicy(ctx context.Context) error RestorePVsReclaimPolicy(ctx context.Context) error EnsureOadpConfiguration(ctx context.Context) error ExportOadpConfigurationToDir(ctx context.Context, toDir, oadpNamespace string) error ExportRestoresToDir(ctx context.Context, configMaps []ibuv1.ConfigMapRef, toDir string) error GetSortedBackupsFromConfigmap(ctx context.Context, content []ibuv1.ConfigMapRef) ([][]*velerov1.Backup, error) LoadRestoresFromOadpRestorePath() ([][]*velerov1.Restore, error) StartOrTrackBackup(ctx context.Context, backups []*velerov1.Backup) (*BackupTracker, error) StartOrTrackRestore(ctx context.Context, restores []*velerov1.Restore) (*RestoreTracker, error) ValidateOadpConfigmaps(ctx context.Context, content []ibuv1.ConfigMapRef) error IsOadpInstalled(ctx context.Context) bool GetDataProtectionApplicationList(ctx context.Context) (*unstructured.UnstructuredList, error) CheckOadpMinimumVersion(ctx context.Context) (bool, error) }
BackuperRestorer interface also used for mocks