Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/v1alpha1/dataprotectionapplication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ type VeleroConfig struct {
// LoadAffinityConfig is the config for data path load affinity.
// +optional
LoadAffinityConfig []*LoadAffinity `json:"loadAffinity,omitempty"`
// set DisableCSISnapshotEarlyFrequentPolling to true to omit
// the 1-second polling interval for the first 10 seconds while waiting
// for the snaphandle
// +optional
DisableCSISnapshotEarlyFrequentPolling bool `json:"disableCSISnapshotEarlyFrequentPolling,omitempty"`
}

// PodConfig defines the pod configuration options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,12 @@ spec:
Use pod volume file system backup by default for volumes.
Matches backup.spec.defaultVolumesToFsBackup in Velero API.
type: boolean
disableCSISnapshotEarlyFrequentPolling:
description: |-
set DisableCSISnapshotEarlyFrequentPolling to true to omit
the 1-second polling interval for the first 10 seconds while waiting
for the snaphandle
type: boolean
disableFsBackup:
default: false
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,12 @@ spec:
Use pod volume file system backup by default for volumes.
Matches backup.spec.defaultVolumesToFsBackup in Velero API.
type: boolean
disableCSISnapshotEarlyFrequentPolling:
description: |-
set DisableCSISnapshotEarlyFrequentPolling to true to omit
the 1-second polling interval for the first 10 seconds while waiting
for the snaphandle
type: boolean
disableFsBackup:
default: false
description: |-
Expand Down
6 changes: 6 additions & 0 deletions internal/controller/velero.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,12 @@ func (r *DataProtectionApplicationReconciler) customizeVeleroContainer(veleroCon
Value: "true",
}})
}
if dpa.Spec.Configuration.Velero == nil || !dpa.Spec.Configuration.Velero.DisableCSISnapshotEarlyFrequentPolling {
veleroContainer.Env = common.AppendUniqueEnvVars(veleroContainer.Env, []corev1.EnvVar{{
Name: "CSI_SNAPSHOT_EARLY_FREQUENT_POLLING",
Value: "true",
}})
}

// Add Azure workload identity environment variables if using Azure STS
azureClientID := os.Getenv(stsflow.ClientIDEnvKey)
Expand Down
50 changes: 50 additions & 0 deletions internal/controller/velero_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ var (
},
{Name: common.LDLibraryPathEnvKey, Value: "/plugins"},
{Name: "OPENSHIFT_IMAGESTREAM_BACKUP", Value: "true"},
{Name: "CSI_SNAPSHOT_EARLY_FREQUENT_POLLING", Value: "true"},
}

baseVolumeMounts = []corev1.VolumeMount{
Expand Down Expand Up @@ -2574,6 +2575,55 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) {
},
{Name: common.LDLibraryPathEnvKey, Value: "/plugins"},
// Note: OPENSHIFT_IMAGESTREAM_BACKUP is NOT included when BackupImages is false
{Name: "CSI_SNAPSHOT_EARLY_FREQUENT_POLLING", Value: "true"},
},
}),
},
{
name: "valid DPA CR with DisableCSISnapshotEarlyFrequentPolling true, no CSI_SNAPSHOT_EARLY_FREQUENT_POLLING",
dpa: createTestDpaWith(
nil,
oadpv1alpha1.DataProtectionApplicationSpec{
Configuration: &oadpv1alpha1.ApplicationConfig{
Velero: &oadpv1alpha1.VeleroConfig{
DisableCSISnapshotEarlyFrequentPolling: true,
},
},
BackupImages: ptr.To(false),
BackupLocations: []oadpv1alpha1.BackupLocation{
{
Velero: &velerov1.BackupStorageLocationSpec{
Provider: "aws",
StorageType: velerov1.StorageType{
ObjectStorage: &velerov1.ObjectStorageLocation{
CACert: []byte("test-ca-cert"),
},
},
},
},
},
},
),
veleroDeployment: testVeleroDeployment.DeepCopy(),
wantVeleroDeployment: createTestBuiltVeleroDeployment(TestBuiltVeleroDeploymentOptions{
args: []string{
defaultFileSystemBackupTimeout,
defaultRestoreResourcePriorities,
defaultDisableInformerCache,
},
// When BackupImages is false, OPENSHIFT_IMAGESTREAM_BACKUP env var is not set
env: []corev1.EnvVar{
{Name: common.VeleroScratchDirEnvKey, Value: "/scratch"},
{
Name: common.VeleroNamespaceEnvKey,
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
APIVersion: "v1",
FieldPath: "metadata.namespace",
},
},
},
{Name: common.LDLibraryPathEnvKey, Value: "/plugins"},
},
}),
},
Expand Down