mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #101806 from jingxu97/may/multivolumetest
Fix multivolume access tests for Windows
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user