From 5dedaca148ebd6e5cb9e33dd1b5f112931a37f7b Mon Sep 17 00:00:00 2001 From: Lyndon-Li Date: Mon, 13 Jan 2025 15:26:55 +0800 Subject: [PATCH] data mover pod misc enhancement for windows Signed-off-by: Lyndon-Li --- changelogs/unreleased/8606-Lyndon-Li | 1 + pkg/exposer/csi_snapshot.go | 9 +++++++++ pkg/exposer/generic_restore.go | 9 +++++++++ 3 files changed, 19 insertions(+) create mode 100644 changelogs/unreleased/8606-Lyndon-Li diff --git a/changelogs/unreleased/8606-Lyndon-Li b/changelogs/unreleased/8606-Lyndon-Li new file mode 100644 index 000000000..ca3c7f873 --- /dev/null +++ b/changelogs/unreleased/8606-Lyndon-Li @@ -0,0 +1 @@ +Fix issue #8418, add Windows toleration to data mover pods \ No newline at end of file diff --git a/pkg/exposer/csi_snapshot.go b/pkg/exposer/csi_snapshot.go index b4543ee53..cfc34cc92 100644 --- a/pkg/exposer/csi_snapshot.go +++ b/pkg/exposer/csi_snapshot.go @@ -586,6 +586,7 @@ func (e *csiSnapshotExposer) createBackupPod( var securityCtx *corev1.PodSecurityContext nodeSelector := map[string]string{} podOS := corev1.PodOS{} + toleration := []corev1.Toleration{} if nodeOS == kube.NodeOSWindows { userID := "ContainerAdministrator" securityCtx = &corev1.PodSecurityContext{ @@ -596,6 +597,13 @@ func (e *csiSnapshotExposer) createBackupPod( nodeSelector[kube.NodeOSLabel] = kube.NodeOSWindows podOS.Name = kube.NodeOSWindows + + toleration = append(toleration, corev1.Toleration{ + Key: "os", + Operator: "Equal", + Effect: "NoSchedule", + Value: "windows", + }) } else { userID := int64(0) securityCtx = &corev1.PodSecurityContext{ @@ -666,6 +674,7 @@ func (e *csiSnapshotExposer) createBackupPod( Volumes: volumes, RestartPolicy: corev1.RestartPolicyNever, SecurityContext: securityCtx, + Tolerations: toleration, }, } diff --git a/pkg/exposer/generic_restore.go b/pkg/exposer/generic_restore.go index b332c611a..5dc39e5a9 100644 --- a/pkg/exposer/generic_restore.go +++ b/pkg/exposer/generic_restore.go @@ -418,6 +418,7 @@ func (e *genericRestoreExposer) createRestorePod(ctx context.Context, ownerObjec var securityCtx *corev1.PodSecurityContext nodeSelector := map[string]string{} podOS := corev1.PodOS{} + toleration := []corev1.Toleration{} if nodeType == kube.NodeOSWindows { userID := "ContainerAdministrator" securityCtx = &corev1.PodSecurityContext{ @@ -428,6 +429,13 @@ func (e *genericRestoreExposer) createRestorePod(ctx context.Context, ownerObjec nodeSelector[kube.NodeOSLabel] = kube.NodeOSWindows podOS.Name = kube.NodeOSWindows + + toleration = append(toleration, corev1.Toleration{ + Key: "os", + Operator: "Equal", + Effect: "NoSchedule", + Value: "windows", + }) } else { userID := int64(0) securityCtx = &corev1.PodSecurityContext{ @@ -480,6 +488,7 @@ func (e *genericRestoreExposer) createRestorePod(ctx context.Context, ownerObjec NodeName: selectedNode, RestartPolicy: corev1.RestartPolicyNever, SecurityContext: securityCtx, + Tolerations: toleration, }, }