Skip to content

Commit f75a38d

Browse files
authored
dpa support for parallel backups (#2045)
1 parent 7a8aba0 commit f75a38d

File tree

5 files changed

+42
-3
lines changed

5 files changed

+42
-3
lines changed

api/v1alpha1/dataprotectionapplication_types.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,13 @@ type VeleroConfig struct {
323323
DisableInformerCache *bool `json:"disableInformerCache,omitempty"`
324324
// Number of workers in worker pool for processing item backup. This will allow multiple items within
325325
// a Velero backup to be backed up at the same time which may improve performance for backups with
326-
// a large number of items. Default is 1.
326+
// a large number of items. Workers are per backup if concurrent backups are enabled. Default is 1.
327327
// +optional
328328
ItemBlockWorkerCount int `json:"itemBlockWorkerCount,omitempty"`
329+
// Number of backups to process at the same time. Only backups which do not have any namespaces
330+
// in common will run at the same time. Default is 1.
331+
// +optional
332+
ConcurrentBackups int `json:"concurrentBackups,omitempty"`
329333
// resourceTimeout defines how long to wait for several Velero resources before timeout occurs,
330334
// such as Velero CRD availability, volumeSnapshot deletion, and repo availability.
331335
// Default is 10m

bundle/manifests/oadp.openshift.io_dataprotectionapplications.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,11 @@ spec:
11111111
client-qps:
11121112
description: maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100)
11131113
type: integer
1114+
concurrentBackups:
1115+
description: |-
1116+
Number of backups to process at the same time. Only backups which do not have any namespaces
1117+
in common will run at the same time. Default is 1.
1118+
type: integer
11141119
customPlugins:
11151120
description: customPlugins defines the custom plugin to be installed with Velero
11161121
items:
@@ -1166,7 +1171,7 @@ spec:
11661171
description: |-
11671172
Number of workers in worker pool for processing item backup. This will allow multiple items within
11681173
a Velero backup to be backed up at the same time which may improve performance for backups with
1169-
a large number of items. Default is 1.
1174+
a large number of items. Workers are per backup if concurrent backups are enabled. Default is 1.
11701175
type: integer
11711176
itemOperationSyncFrequency:
11721177
description: How often to check status on async backup/restore operations after backup processing. Default value is 2m.

config/crd/bases/oadp.openshift.io_dataprotectionapplications.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,11 @@ spec:
11111111
client-qps:
11121112
description: maximum number of requests per second by the server to the Kubernetes API once the burst limit has been reached. (default 100)
11131113
type: integer
1114+
concurrentBackups:
1115+
description: |-
1116+
Number of backups to process at the same time. Only backups which do not have any namespaces
1117+
in common will run at the same time. Default is 1.
1118+
type: integer
11141119
customPlugins:
11151120
description: customPlugins defines the custom plugin to be installed with Velero
11161121
items:
@@ -1166,7 +1171,7 @@ spec:
11661171
description: |-
11671172
Number of workers in worker pool for processing item backup. This will allow multiple items within
11681173
a Velero backup to be backed up at the same time which may improve performance for backups with
1169-
a large number of items. Default is 1.
1174+
a large number of items. Workers are per backup if concurrent backups are enabled. Default is 1.
11701175
type: integer
11711176
itemOperationSyncFrequency:
11721177
description: How often to check status on async backup/restore operations after backup processing. Default value is 2m.

internal/controller/velero.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ func (r *DataProtectionApplicationReconciler) customizeVeleroDeployment(veleroDe
409409
if dpa.Spec.Configuration.Velero.ItemBlockWorkerCount > 0 {
410410
veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--item-block-worker-count=%v", dpa.Spec.Configuration.Velero.ItemBlockWorkerCount))
411411
}
412+
if dpa.Spec.Configuration.Velero.ConcurrentBackups > 0 {
413+
veleroContainer.Args = append(veleroContainer.Args, fmt.Sprintf("--concurrent-backups=%v", dpa.Spec.Configuration.Velero.ConcurrentBackups))
414+
}
412415

413416
// check for backup-repository-configmap parameter
414417
if isBackupRepositoryCmRequired(dpa.Spec.Configuration.NodeAgent) {

internal/controller/velero_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,28 @@ func TestDPAReconciler_buildVeleroDeployment(t *testing.T) {
13631363
},
13641364
}),
13651365
},
1366+
{
1367+
name: "valid DPA CR with ConcurrentBackups set to 2, Velero Deployment is built with ConcurrentBackups set to 2",
1368+
dpa: createTestDpaWith(
1369+
nil,
1370+
oadpv1alpha1.DataProtectionApplicationSpec{
1371+
Configuration: &oadpv1alpha1.ApplicationConfig{
1372+
Velero: &oadpv1alpha1.VeleroConfig{
1373+
ConcurrentBackups: 2,
1374+
},
1375+
},
1376+
},
1377+
),
1378+
veleroDeployment: testVeleroDeployment.DeepCopy(),
1379+
wantVeleroDeployment: createTestBuiltVeleroDeployment(TestBuiltVeleroDeploymentOptions{
1380+
args: []string{
1381+
defaultFileSystemBackupTimeout,
1382+
defaultRestoreResourcePriorities,
1383+
defaultDisableInformerCache,
1384+
"--concurrent-backups=2",
1385+
},
1386+
}),
1387+
},
13661388
{
13671389
name: "valid DPA CR with DefaultItemOperationTimeout, Velero Deployment is built with DefaultItemOperationTimeout arg",
13681390
dpa: createTestDpaWith(

0 commit comments

Comments
 (0)