diff --git a/changelogs/unreleased/8611-Lyndon-Li b/changelogs/unreleased/8611-Lyndon-Li new file mode 100644 index 0000000000..6f218b11f3 --- /dev/null +++ b/changelogs/unreleased/8611-Lyndon-Li @@ -0,0 +1 @@ +Fix issue #8242, distribute dd evenly across nodes \ No newline at end of file diff --git a/pkg/exposer/generic_restore.go b/pkg/exposer/generic_restore.go index 5dc39e5a90..e5f65e55ed 100644 --- a/pkg/exposer/generic_restore.go +++ b/pkg/exposer/generic_restore.go @@ -400,6 +400,11 @@ func (e *genericRestoreExposer) createRestorePod(ctx context.Context, ownerObjec }} volumes = append(volumes, podInfo.volumes...) + if label == nil { + label = make(map[string]string) + } + label[podGroupLabel] = podGroupGenericRestore + volumeMode := corev1.PersistentVolumeFilesystem if targetPVC.Spec.VolumeMode != nil { volumeMode = *targetPVC.Spec.VolumeMode @@ -462,6 +467,18 @@ func (e *genericRestoreExposer) createRestorePod(ctx context.Context, ownerObjec Labels: label, }, Spec: corev1.PodSpec{ + TopologySpreadConstraints: []corev1.TopologySpreadConstraint{ + { + MaxSkew: 1, + TopologyKey: "kubernetes.io/hostname", + WhenUnsatisfiable: corev1.ScheduleAnyway, + LabelSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{ + podGroupLabel: podGroupGenericRestore, + }, + }, + }, + }, NodeSelector: nodeSelector, OS: &podOS, Containers: []corev1.Container{ diff --git a/pkg/exposer/types.go b/pkg/exposer/types.go index 670c8b661a..e62a564fa6 100644 --- a/pkg/exposer/types.go +++ b/pkg/exposer/types.go @@ -21,10 +21,11 @@ import ( ) const ( - AccessModeFileSystem = "by-file-system" - AccessModeBlock = "by-block-device" - podGroupLabel = "velero.io/exposer-pod-group" - podGroupSnapshot = "snapshot-exposer" + AccessModeFileSystem = "by-file-system" + AccessModeBlock = "by-block-device" + podGroupLabel = "velero.io/exposer-pod-group" + podGroupSnapshot = "snapshot-exposer" + podGroupGenericRestore = "generic-restore-exposer" ) // ExposeResult defines the result of expose.