Merge pull request #101806 from jingxu97/may/multivolumetest

Fix multivolume access tests for Windows
This commit is contained in:
Kubernetes Prow Robot 2021-05-07 16:47:25 -07:00 committed by GitHub
commit e4b01cf0d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -19,7 +19,6 @@ package pod
import (
"context"
"fmt"
"runtime"
"time"
v1 "k8s.io/api/core/v1"
@ -167,11 +166,12 @@ func MakeSecPod(podConfig *Config) (*v1.Pod, error) {
if podConfig.NS == "" {
return nil, fmt.Errorf("Cannot create pod with empty namespace")
}
if len(podConfig.Command) == 0 {
if len(podConfig.Command) == 0 && !NodeOSDistroIs("windows") {
podConfig.Command = "trap exit TERM; while true; do sleep 1; done"
}
podName := "pod-" + string(uuid.NewUUID())
if podConfig.FsGroup == nil && runtime.GOOS != "windows" {
if podConfig.FsGroup == nil && !NodeOSDistroIs("windows") {
podConfig.FsGroup = func(i int64) *int64 {
return &i
}(1000)

View File

@ -40,6 +40,9 @@ func NodeOSDistroIs(distro string) bool {
// Depending on the Node OS is Windows or linux, the command will use powershell or /bin/sh
func GenerateScriptCmd(command string) []string {
var commands []string
if command == "" {
return commands
}
if !NodeOSDistroIs("windows") {
commands = []string{"/bin/sh", "-c", command}
} else {