data mover pod misc enhancement for windows

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
pull/8606/head
Lyndon-Li 2025-01-13 15:26:55 +08:00
parent 3207619f30
commit 5dedaca148
3 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1 @@
Fix issue #8418, add Windows toleration to data mover pods

View File

@ -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,
},
}

View File

@ -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,
},
}