Merge pull request #8611 from Lyndon-Li/distribute-dd-evenly
Some checks failed
Run the E2E test on kind / build (push) Failing after 5m35s
Run the E2E test on kind / setup-test-matrix (push) Successful in 3s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 34s
Close stale issues and PRs / stale (push) Successful in 9s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 58s
Trivy Nightly Scan / Trivy nightly scan (velero-restore-helper, main) (push) Failing after 40s

Distribute dd evenly across nodes
This commit is contained in:
lyndon-li
2025-01-14 17:21:45 +08:00
committed by GitHub
3 changed files with 23 additions and 4 deletions

View File

@@ -0,0 +1 @@
Fix issue #8242, distribute dd evenly across nodes

View File

@@ -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{

View File

@@ -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.