mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #109770 from fromanirh/e2e-node-device-plugin-skip
e2e: node: explicit skip for device plugin tests
This commit is contained in:
commit
f0928952d7
@ -25,6 +25,7 @@ import (
|
|||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
|
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
||||||
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
|
e2etestfiles "k8s.io/kubernetes/test/e2e/framework/testfiles"
|
||||||
admissionapi "k8s.io/pod-security-admission/api"
|
admissionapi "k8s.io/pod-security-admission/api"
|
||||||
|
|
||||||
@ -77,26 +78,6 @@ func numberOfSampleResources(node *v1.Node) int64 {
|
|||||||
return val.Value()
|
return val.Value()
|
||||||
}
|
}
|
||||||
|
|
||||||
// getSampleDevicePluginPod returns the Device Plugin pod for sample resources in e2e tests.
|
|
||||||
func getSampleDevicePluginPod() *v1.Pod {
|
|
||||||
data, err := e2etestfiles.Read(SampleDevicePluginDSYAML)
|
|
||||||
if err != nil {
|
|
||||||
framework.Fail(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
ds := readDaemonSetV1OrDie(data)
|
|
||||||
p := &v1.Pod{
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: sampleDevicePluginName,
|
|
||||||
Namespace: metav1.NamespaceSystem,
|
|
||||||
},
|
|
||||||
|
|
||||||
Spec: ds.Spec.Template.Spec,
|
|
||||||
}
|
|
||||||
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
|
|
||||||
// readDaemonSetV1OrDie reads daemonset object from bytes. Panics on error.
|
// readDaemonSetV1OrDie reads daemonset object from bytes. Panics on error.
|
||||||
func readDaemonSetV1OrDie(objBytes []byte) *appsv1.DaemonSet {
|
func readDaemonSetV1OrDie(objBytes []byte) *appsv1.DaemonSet {
|
||||||
appsv1.AddToScheme(appsScheme)
|
appsv1.AddToScheme(appsScheme)
|
||||||
@ -116,6 +97,8 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) {
|
|||||||
var devicePluginPod, dptemplate *v1.Pod
|
var devicePluginPod, dptemplate *v1.Pod
|
||||||
|
|
||||||
ginkgo.BeforeEach(func() {
|
ginkgo.BeforeEach(func() {
|
||||||
|
e2eskipper.Skipf("Device Plugin tests are currently broken and being investigated")
|
||||||
|
|
||||||
ginkgo.By("Wait for node to be ready")
|
ginkgo.By("Wait for node to be ready")
|
||||||
gomega.Eventually(func() bool {
|
gomega.Eventually(func() bool {
|
||||||
nodes, err := e2enode.TotalReady(f.ClientSet)
|
nodes, err := e2enode.TotalReady(f.ClientSet)
|
||||||
@ -124,8 +107,19 @@ func testDevicePlugin(f *framework.Framework, pluginSockDir string) {
|
|||||||
}, time.Minute, time.Second).Should(gomega.BeTrue())
|
}, time.Minute, time.Second).Should(gomega.BeTrue())
|
||||||
|
|
||||||
ginkgo.By("Scheduling a sample device plugin pod")
|
ginkgo.By("Scheduling a sample device plugin pod")
|
||||||
dp := getSampleDevicePluginPod()
|
data, err := e2etestfiles.Read(SampleDevicePluginDSYAML)
|
||||||
dp.Namespace = ""
|
if err != nil {
|
||||||
|
framework.Fail(err.Error())
|
||||||
|
}
|
||||||
|
ds := readDaemonSetV1OrDie(data)
|
||||||
|
|
||||||
|
dp := &v1.Pod{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: sampleDevicePluginName,
|
||||||
|
},
|
||||||
|
Spec: ds.Spec.Template.Spec,
|
||||||
|
}
|
||||||
|
|
||||||
for i := range dp.Spec.Containers[0].Env {
|
for i := range dp.Spec.Containers[0].Env {
|
||||||
if dp.Spec.Containers[0].Env[i].Name == envVarNamePluginSockDir {
|
if dp.Spec.Containers[0].Env[i].Name == envVarNamePluginSockDir {
|
||||||
dp.Spec.Containers[0].Env[i].Value = pluginSockDir
|
dp.Spec.Containers[0].Env[i].Value = pluginSockDir
|
||||||
|
Loading…
Reference in New Issue
Block a user