Merge pull request #8606 from Lyndon-Li/data-mover-pod-misc-enhancement-for-windows

Add Windows toleration to data mover pods
pull/8608/head^2
lyndon-li 2025-01-13 18:22:21 +08:00 committed by GitHub
commit 5f7bf64d06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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,
},
}