Skip to content

Commit

Permalink
Merge pull request #8606 from Lyndon-Li/data-mover-pod-misc-enhanceme…
Browse files Browse the repository at this point in the history
…nt-for-windows

Add Windows toleration to data mover pods
  • Loading branch information
Lyndon-Li authored Jan 13, 2025
2 parents 094ba59 + 5dedaca commit 5f7bf64
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/8606-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix issue #8418, add Windows toleration to data mover pods
9 changes: 9 additions & 0 deletions pkg/exposer/csi_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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{
Expand Down Expand Up @@ -666,6 +674,7 @@ func (e *csiSnapshotExposer) createBackupPod(
Volumes: volumes,
RestartPolicy: corev1.RestartPolicyNever,
SecurityContext: securityCtx,
Tolerations: toleration,
},
}

Expand Down
9 changes: 9 additions & 0 deletions pkg/exposer/generic_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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{
Expand Down Expand Up @@ -480,6 +488,7 @@ func (e *genericRestoreExposer) createRestorePod(ctx context.Context, ownerObjec
NodeName: selectedNode,
RestartPolicy: corev1.RestartPolicyNever,
SecurityContext: securityCtx,
Tolerations: toleration,
},
}

Expand Down

0 comments on commit 5f7bf64

Please sign in to comment.