Skip to content

Commit

Permalink
Merge pull request #8611 from Lyndon-Li/distribute-dd-evenly
Browse files Browse the repository at this point in the history
Distribute dd evenly across nodes
  • Loading branch information
Lyndon-Li authored Jan 14, 2025
2 parents 2ef7711 + b52b450 commit 1d3af6d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/8611-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix issue #8242, distribute dd evenly across nodes
17 changes: 17 additions & 0 deletions pkg/exposer/generic_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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{
Expand Down
9 changes: 5 additions & 4 deletions pkg/exposer/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1d3af6d

Please sign in to comment.