Merge pull request #9165 from Lyndon-Li/issue-fix-9140

Issue 9140: add NoExecute toleration for Windows
This commit is contained in:
Wenkai Yin(尹文开)
2025-08-08 13:12:24 +08:00
committed by GitHub
5 changed files with 49 additions and 18 deletions

View File

@@ -0,0 +1 @@
Fix issue #9140, add os=windows:NoSchedule toleration for Windows pods

View File

@@ -626,12 +626,20 @@ func (e *csiSnapshotExposer) createBackupPod(
nodeSelector[kube.NodeOSLabel] = kube.NodeOSWindows
podOS.Name = kube.NodeOSWindows
toleration = append(toleration, corev1api.Toleration{
Key: "os",
Operator: "Equal",
Effect: "NoSchedule",
Value: "windows",
})
toleration = append(toleration, []corev1api.Toleration{
{
Key: "os",
Operator: "Equal",
Effect: "NoSchedule",
Value: "windows",
},
{
Key: "os",
Operator: "Equal",
Effect: "NoExecute",
Value: "windows",
},
}...)
} else {
userID := int64(0)
securityCtx = &corev1api.PodSecurityContext{

View File

@@ -501,12 +501,20 @@ func (e *genericRestoreExposer) createRestorePod(
nodeSelector[kube.NodeOSLabel] = kube.NodeOSWindows
podOS.Name = kube.NodeOSWindows
toleration = append(toleration, corev1api.Toleration{
Key: "os",
Operator: "Equal",
Effect: "NoSchedule",
Value: "windows",
})
toleration = append(toleration, []corev1api.Toleration{
{
Key: "os",
Operator: "Equal",
Effect: "NoSchedule",
Value: "windows",
},
{
Key: "os",
Operator: "Equal",
Effect: "NoExecute",
Value: "windows",
},
}...)
} else {
userID := int64(0)
securityCtx = &corev1api.PodSecurityContext{

View File

@@ -340,12 +340,20 @@ func (e *podVolumeExposer) createHostingPod(ctx context.Context, ownerObject cor
nodeSelector[kube.NodeOSLabel] = kube.NodeOSWindows
podOS.Name = kube.NodeOSWindows
toleration = append(toleration, corev1api.Toleration{
Key: "os",
Operator: "Equal",
Effect: "NoSchedule",
Value: "windows",
})
toleration = append(toleration, []corev1api.Toleration{
{
Key: "os",
Operator: "Equal",
Effect: "NoSchedule",
Value: "windows",
},
{
Key: "os",
Operator: "Equal",
Effect: "NoExecute",
Value: "windows",
},
}...)
} else {
userID := int64(0)
securityCtx = &corev1api.PodSecurityContext{

View File

@@ -244,6 +244,12 @@ func DaemonSet(namespace string, opts ...podTemplateOption) *appsv1api.DaemonSet
Effect: "NoSchedule",
Value: "windows",
},
{
Key: "os",
Operator: "Equal",
Effect: "NoExecute",
Value: "windows",
},
}
} else {
daemonSet.Spec.Template.Spec.NodeSelector = map[string]string{