Skip to content

Commit

Permalink
fix: Add old datamover fields back to DPA
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Jan 20, 2024
1 parent 8ee3d47 commit db11662
Show file tree
Hide file tree
Showing 5 changed files with 379 additions and 3 deletions.
95 changes: 93 additions & 2 deletions api/v1alpha1/oadp_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ const ReconcileCompleteMessage = "Reconcile complete"
const OadpOperatorLabel = "openshift.io/oadp"
const RegistryDeploymentLabel = "openshift.io/oadp-registry"

// +kubebuilder:validation:Enum=aws;gcp;azure;csi;openshift;kubevirt
// +kubebuilder:validation:Enum=aws;gcp;azure;csi;vsm;openshift;kubevirt
type DefaultPlugin string

const DefaultPluginAWS DefaultPlugin = "aws"
const DefaultPluginGCP DefaultPlugin = "gcp"
const DefaultPluginMicrosoftAzure DefaultPlugin = "azure"
const DefaultPluginCSI DefaultPlugin = "csi"
const DefaultPluginVSM DefaultPlugin = "vsm"
const DefaultPluginOpenShift DefaultPlugin = "openshift"
const DefaultPluginKubeVirt DefaultPlugin = "kubevirt"

Expand Down Expand Up @@ -221,8 +222,98 @@ type SnapshotLocation struct {
Velero *velero.VolumeSnapshotLocationSpec `json:"velero"`
}

// DataMover defines the various config for DPA data mover
type DataMover struct {
// enable flag is used to specify whether you want to deploy the volume snapshot mover controller
// +optional
Enable bool `json:"enable,omitempty"`
// User supplied Restic Secret name
// +optional
CredentialName string `json:"credentialName,omitempty"`
// User supplied timeout to be used for VolumeSnapshotBackup and VolumeSnapshotRestore to complete, default value is 10m
// +optional
Timeout string `json:"timeout,omitempty"`
// the number of batched volumeSnapshotBackups that can be inProgress at once, default value is 10
// +optional
MaxConcurrentBackupVolumes string `json:"maxConcurrentBackupVolumes,omitempty"`
// the number of batched volumeSnapshotRestores that can be inProgress at once, default value is 10
// +optional
MaxConcurrentRestoreVolumes string `json:"maxConcurrentRestoreVolumes,omitempty"`
// defines how often (in days) to prune the datamover snapshots from the repository
// +optional
PruneInterval string `json:"pruneInterval,omitempty"`
// defines configurations for data mover volume options for a storageClass
// +optional
VolumeOptionsForStorageClasses map[string]DataMoverVolumeOptions `json:"volumeOptionsForStorageClasses,omitempty"`
// defines the parameters that can be specified for retention of datamover snapshots
// +optional
SnapshotRetainPolicy *RetainPolicy `json:"snapshotRetainPolicy,omitempty"`
// schedule is a cronspec (https://en.wikipedia.org/wiki/Cron#Overview) that
// can be used to schedule datamover(volsync) synchronization to occur at regular, time-based
// intervals. For example, in order to enforce datamover SnapshotRetainPolicy at a regular interval you need to
// specify this Schedule trigger as a cron expression, by default the trigger is a manual trigger. For more details
// on Volsync triggers, refer: https://volsync.readthedocs.io/en/stable/usage/triggers.html
//+kubebuilder:validation:Pattern=`^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$`
//+optional
Schedule string `json:"schedule,omitempty"`
}

// RetainPolicy defines the fields for retention of datamover snapshots
type RetainPolicy struct {
// Hourly defines the number of snapshots to be kept hourly
//+optional
Hourly string `json:"hourly,omitempty"`
// Daily defines the number of snapshots to be kept daily
//+optional
Daily string `json:"daily,omitempty"`
// Weekly defines the number of snapshots to be kept weekly
//+optional
Weekly string `json:"weekly,omitempty"`
// Monthly defines the number of snapshots to be kept monthly
//+optional
Monthly string `json:"monthly,omitempty"`
// Yearly defines the number of snapshots to be kept yearly
//+optional
Yearly string `json:"yearly,omitempty"`
// Within defines the number of snapshots to be kept Within the given time period
//+optional
Within string `json:"within,omitempty"`
}

type DataMoverVolumeOptions struct {
SourceVolumeOptions *VolumeOptions `json:"sourceVolumeOptions,omitempty"`
DestinationVolumeOptions *VolumeOptions `json:"destinationVolumeOptions,omitempty"`
}

// VolumeOptions defines configurations for VolSync options
type VolumeOptions struct {
// storageClassName can be used to override the StorageClass of the source
// or destination PVC
//+optional
StorageClassName string `json:"storageClassName,omitempty"`
// accessMode can be used to override the accessMode of the source or
// destination PVC
//+optional
AccessMode corev1.PersistentVolumeAccessMode `json:"accessMode,omitempty"`
// cacheStorageClassName is the storageClass that should be used when provisioning
// the data mover cache volume
//+optional
CacheStorageClassName string `json:"cacheStorageClassName,omitempty"`
// cacheCapacity determines the size of the restic metadata cache volume
//+optional
CacheCapacity string `json:"cacheCapacity,omitempty"`
// cacheAccessMode is the access mode to be used to provision the cache volume
//+optional
CacheAccessMode string `json:"cacheAccessMode,omitempty"`
}

// Features defines the configuration for the DPA to enable the tech preview features
type Features struct{}
type Features struct {
// (do not use warning) dataMover is for backwards compatibility and
// will be removed in the future. Use Velero Built-in Data Mover instead
// +optional
DataMover *DataMover `json:"dataMover,omitempty"`
}

// DataProtectionApplicationSpec defines the desired state of Velero
type DataProtectionApplicationSpec struct {
Expand Down
89 changes: 88 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 94 additions & 0 deletions bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ spec:
- gcp
- azure
- csi
- vsm
- openshift
- kubevirt
type: string
Expand Down Expand Up @@ -822,6 +823,99 @@ spec:
type: object
features:
description: features defines the configuration for the DPA to enable the OADP tech preview features
properties:
dataMover:
description: (do not use warning) dataMover is for backwards compatibility and will be removed in the future. Use Velero Built-in Data Mover instead
properties:
credentialName:
description: User supplied Restic Secret name
type: string
enable:
description: enable flag is used to specify whether you want to deploy the volume snapshot mover controller
type: boolean
maxConcurrentBackupVolumes:
description: the number of batched volumeSnapshotBackups that can be inProgress at once, default value is 10
type: string
maxConcurrentRestoreVolumes:
description: the number of batched volumeSnapshotRestores that can be inProgress at once, default value is 10
type: string
pruneInterval:
description: defines how often (in days) to prune the datamover snapshots from the repository
type: string
schedule:
description: 'schedule is a cronspec (https://en.wikipedia.org/wiki/Cron#Overview) that can be used to schedule datamover(volsync) synchronization to occur at regular, time-based intervals. For example, in order to enforce datamover SnapshotRetainPolicy at a regular interval you need to specify this Schedule trigger as a cron expression, by default the trigger is a manual trigger. For more details on Volsync triggers, refer: https://volsync.readthedocs.io/en/stable/usage/triggers.html'
pattern: ^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$
type: string
snapshotRetainPolicy:
description: defines the parameters that can be specified for retention of datamover snapshots
properties:
daily:
description: Daily defines the number of snapshots to be kept daily
type: string
hourly:
description: Hourly defines the number of snapshots to be kept hourly
type: string
monthly:
description: Monthly defines the number of snapshots to be kept monthly
type: string
weekly:
description: Weekly defines the number of snapshots to be kept weekly
type: string
within:
description: Within defines the number of snapshots to be kept Within the given time period
type: string
yearly:
description: Yearly defines the number of snapshots to be kept yearly
type: string
type: object
timeout:
description: User supplied timeout to be used for VolumeSnapshotBackup and VolumeSnapshotRestore to complete, default value is 10m
type: string
volumeOptionsForStorageClasses:
additionalProperties:
properties:
destinationVolumeOptions:
description: VolumeOptions defines configurations for VolSync options
properties:
accessMode:
description: accessMode can be used to override the accessMode of the source or destination PVC
type: string
cacheAccessMode:
description: cacheAccessMode is the access mode to be used to provision the cache volume
type: string
cacheCapacity:
description: cacheCapacity determines the size of the restic metadata cache volume
type: string
cacheStorageClassName:
description: cacheStorageClassName is the storageClass that should be used when provisioning the data mover cache volume
type: string
storageClassName:
description: storageClassName can be used to override the StorageClass of the source or destination PVC
type: string
type: object
sourceVolumeOptions:
description: VolumeOptions defines configurations for VolSync options
properties:
accessMode:
description: accessMode can be used to override the accessMode of the source or destination PVC
type: string
cacheAccessMode:
description: cacheAccessMode is the access mode to be used to provision the cache volume
type: string
cacheCapacity:
description: cacheCapacity determines the size of the restic metadata cache volume
type: string
cacheStorageClassName:
description: cacheStorageClassName is the storageClass that should be used when provisioning the data mover cache volume
type: string
storageClassName:
description: storageClassName can be used to override the StorageClass of the source or destination PVC
type: string
type: object
type: object
description: defines configurations for data mover volume options for a storageClass
type: object
type: object
type: object
podAnnotations:
additionalProperties:
Expand Down
Loading

0 comments on commit db11662

Please sign in to comment.