mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Convert volume.TestConfig to use NodeSelection
Change-Id: I6adbb53b65e4a4f7e220fc0d91a26dc6bc135c36
This commit is contained in:
parent
76a4a34dae
commit
d9184b75c9
@ -128,12 +128,8 @@ type TestConfig struct {
|
|||||||
// Wait for the pod to terminate successfully
|
// Wait for the pod to terminate successfully
|
||||||
// False indicates that the pod is long running
|
// False indicates that the pod is long running
|
||||||
WaitForCompletion bool
|
WaitForCompletion bool
|
||||||
// ServerNodeName is the spec.nodeName to run server pod on. Default is any node.
|
// ClientNodeSelection restricts where the client pod runs on. Default is any node.
|
||||||
ServerNodeName string
|
ClientNodeSelection e2epod.NodeSelection
|
||||||
// ClientNodeName is the spec.nodeName to run client pod on. Default is any node.
|
|
||||||
ClientNodeName string
|
|
||||||
// NodeSelector to use in pod spec (server, client and injector pods).
|
|
||||||
NodeSelector map[string]string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test contains a volume to mount into a client pod and its
|
// Test contains a volume to mount into a client pod and its
|
||||||
@ -297,8 +293,6 @@ func startVolumeServer(client clientset.Interface, config TestConfig) *v1.Pod {
|
|||||||
},
|
},
|
||||||
Volumes: volumes,
|
Volumes: volumes,
|
||||||
RestartPolicy: restartPolicy,
|
RestartPolicy: restartPolicy,
|
||||||
NodeName: config.ServerNodeName,
|
|
||||||
NodeSelector: config.NodeSelector,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,10 +383,9 @@ func runVolumeTesterPod(client clientset.Interface, config TestConfig, podSuffix
|
|||||||
TerminationGracePeriodSeconds: &gracePeriod,
|
TerminationGracePeriodSeconds: &gracePeriod,
|
||||||
SecurityContext: GeneratePodSecurityContext(fsGroup, seLinuxOptions),
|
SecurityContext: GeneratePodSecurityContext(fsGroup, seLinuxOptions),
|
||||||
Volumes: []v1.Volume{},
|
Volumes: []v1.Volume{},
|
||||||
NodeName: config.ClientNodeName,
|
|
||||||
NodeSelector: config.NodeSelector,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
e2epod.SetNodeSelection(clientPod, config.ClientNodeSelection)
|
||||||
|
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
volumeName := fmt.Sprintf("%s-%s-%d", config.Prefix, "volume", i)
|
volumeName := fmt.Sprintf("%s-%s-%d", config.Prefix, "volume", i)
|
||||||
|
@ -442,7 +442,7 @@ func (i *iSCSIDriver) CreateVolume(config *testsuites.PerTestConfig, volType tes
|
|||||||
|
|
||||||
c, serverPod, serverIP, iqn := newISCSIServer(cs, ns.Name)
|
c, serverPod, serverIP, iqn := newISCSIServer(cs, ns.Name)
|
||||||
config.ServerConfig = &c
|
config.ServerConfig = &c
|
||||||
config.ClientNodeSelection = e2epod.NodeSelection{Name: c.ClientNodeName}
|
config.ClientNodeSelection = c.ClientNodeSelection
|
||||||
return &iSCSIVolume{
|
return &iSCSIVolume{
|
||||||
serverPod: serverPod,
|
serverPod: serverPod,
|
||||||
serverIP: serverIP,
|
serverIP: serverIP,
|
||||||
@ -473,7 +473,7 @@ func newISCSIServer(cs clientset.Interface, namespace string) (config volume.Tes
|
|||||||
}
|
}
|
||||||
pod, ip = volume.CreateStorageServer(cs, config)
|
pod, ip = volume.CreateStorageServer(cs, config)
|
||||||
// Make sure the client runs on the same node as server so we don't need to open any firewalls.
|
// Make sure the client runs on the same node as server so we don't need to open any firewalls.
|
||||||
config.ClientNodeName = pod.Spec.NodeName
|
config.ClientNodeSelection = e2epod.NodeSelection{Name: pod.Spec.NodeName}
|
||||||
return config, pod, ip, iqn
|
return config, pod, ip, iqn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
test/e2e/storage/external/BUILD
vendored
1
test/e2e/storage/external/BUILD
vendored
@ -15,6 +15,7 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
|
||||||
"//test/e2e/framework:go_default_library",
|
"//test/e2e/framework:go_default_library",
|
||||||
"//test/e2e/framework/config:go_default_library",
|
"//test/e2e/framework/config:go_default_library",
|
||||||
|
"//test/e2e/framework/pod:go_default_library",
|
||||||
"//test/e2e/framework/skipper:go_default_library",
|
"//test/e2e/framework/skipper:go_default_library",
|
||||||
"//test/e2e/framework/volume:go_default_library",
|
"//test/e2e/framework/volume:go_default_library",
|
||||||
"//test/e2e/storage/testpatterns:go_default_library",
|
"//test/e2e/storage/testpatterns:go_default_library",
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
||||||
|
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
||||||
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
||||||
e2essh "k8s.io/kubernetes/test/e2e/framework/ssh"
|
e2essh "k8s.io/kubernetes/test/e2e/framework/ssh"
|
||||||
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
"k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
@ -179,7 +180,7 @@ var _ = utils.SIGDescribe("Flexvolumes", func() {
|
|||||||
config = volume.TestConfig{
|
config = volume.TestConfig{
|
||||||
Namespace: ns.Name,
|
Namespace: ns.Name,
|
||||||
Prefix: "flex",
|
Prefix: "flex",
|
||||||
ClientNodeName: node.Name,
|
ClientNodeSelection: e2epod.NodeSelection{Name: node.Name},
|
||||||
}
|
}
|
||||||
suffix = ns.Name
|
suffix = ns.Name
|
||||||
})
|
})
|
||||||
|
@ -431,9 +431,7 @@ func convertTestConfig(in *PerTestConfig) volume.TestConfig {
|
|||||||
return volume.TestConfig{
|
return volume.TestConfig{
|
||||||
Namespace: in.Framework.Namespace.Name,
|
Namespace: in.Framework.Namespace.Name,
|
||||||
Prefix: in.Prefix,
|
Prefix: in.Prefix,
|
||||||
// TODO: fix this to use NodeSelection
|
ClientNodeSelection: in.ClientNodeSelection,
|
||||||
ClientNodeName: in.ClientNodeSelection.Name,
|
|
||||||
NodeSelector: in.ClientNodeSelection.Selector,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,10 +241,7 @@ func makePodSpec(config volume.TestConfig, initCmd string, volsrc v1.VolumeSourc
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
e2epod.SetNodeSelection(pod, e2epod.NodeSelection{
|
e2epod.SetNodeSelection(pod, config.ClientNodeSelection)
|
||||||
Name: config.ClientNodeName,
|
|
||||||
Selector: config.NodeSelector,
|
|
||||||
})
|
|
||||||
return pod
|
return pod
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user