From 6cb022ff4a3808b9517e965ed1fb7da063e164ae Mon Sep 17 00:00:00 2001 From: David Porter Date: Thu, 26 Jan 2023 00:37:01 -0800 Subject: [PATCH] test: Update Host Exec to support node e2e Node E2E tests do not run a scheduler, so the host exec pod must have the `spec.nodeName` set explicitly. Signed-off-by: David Porter --- test/e2e/storage/utils/host_exec.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/test/e2e/storage/utils/host_exec.go b/test/e2e/storage/utils/host_exec.go index 31a89e267d4..202377323e7 100644 --- a/test/e2e/storage/utils/host_exec.go +++ b/test/e2e/storage/utils/host_exec.go @@ -76,11 +76,18 @@ func (h *hostExecutor) launchNodeExecPod(ctx context.Context, node string) *v1.P hostExecPod := e2epod.NewExecPodSpec(ns.Name, "", true) hostExecPod.GenerateName = fmt.Sprintf("hostexec-%s-", node) - // Use NodeAffinity instead of NodeName so that pods will not - // be immediately Failed by kubelet if it's out of space. Instead - // Pods will be pending in the scheduler until there is space freed - // up. - e2epod.SetNodeAffinity(&hostExecPod.Spec, node) + + if framework.TestContext.NodeE2E { + // E2E node tests do not run a scheduler, so set the node name directly + hostExecPod.Spec.NodeName = node + } else { + // Use NodeAffinity instead of NodeName so that pods will not + // be immediately Failed by kubelet if it's out of space. Instead + // Pods will be pending in the scheduler until there is space freed + // up. + e2epod.SetNodeAffinity(&hostExecPod.Spec, node) + + } hostExecPod.Spec.Volumes = []v1.Volume{ { // Required to enter into host mount namespace via nsenter.