From 5ed98e97e1c26b9941b14b951e95d6b9f1274011 Mon Sep 17 00:00:00 2001 From: Ayato Tokubi Date: Fri, 5 Sep 2025 15:20:13 +0000 Subject: [PATCH] Remove getLocalNode to fix GracefulNodeShutdown e2e. getLocalNode tried to get a ready node and fails if there's none. The e2e test sends termination signal to kubelet and it's expected to have no ready nodes. Because of this, the e2e was permafailing. Signed-off-by: Ayato Tokubi --- test/e2e_node/util_kubeletconfig.go | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/test/e2e_node/util_kubeletconfig.go b/test/e2e_node/util_kubeletconfig.go index d1f124e5277..1b0b4425ccb 100644 --- a/test/e2e_node/util_kubeletconfig.go +++ b/test/e2e_node/util_kubeletconfig.go @@ -18,8 +18,6 @@ package e2enode import ( "context" - "fmt" - "strings" "time" v1 "k8s.io/api/core/v1" @@ -76,22 +74,17 @@ type updateKubeletOptions struct { func updateKubeletConfigWithOptions(ctx context.Context, f *framework.Framework, kubeletConfig *kubeletconfig.KubeletConfiguration, opts updateKubeletOptions) { ginkgo.GinkgoHelper() - nodeIdent := identifyNode(getLocalNode(ctx, f)) - // Update the Kubelet configuration. - ginkgo.By("Stopping the kubelet on " + nodeIdent) restartKubelet := mustStopKubelet(ctx, f) // Delete CPU and memory manager state files to be sure it will not prevent the kubelet restart if opts.deleteStateFiles { - ginkgo.By("Deleting the kubelet state files on " + nodeIdent) deleteStateFile(cpuManagerStateFile) deleteStateFile(memoryManagerStateFile) } framework.ExpectNoError(e2enodekubelet.WriteKubeletConfigFile(kubeletConfig)) - ginkgo.By("Restarting the kubelet on " + nodeIdent) restartKubelet(ctx) if opts.ensureConsistentReadyNode { @@ -101,21 +94,6 @@ func updateKubeletConfigWithOptions(ctx context.Context, f *framework.Framework, } } -func identifyNode(node *v1.Node) string { - if node == nil { - return "localhost" - } - var addrs string - if len(node.Status.Addresses) > 0 { - var sb strings.Builder - for _, addr := range node.Status.Addresses { - fmt.Fprintf(&sb, " %v=%v", addr.Type, addr.Address) - } - addrs = " <" + sb.String()[1:] + ">" - } - return node.Name + addrs -} - func updateKubeletConfig(ctx context.Context, f *framework.Framework, kubeletConfig *kubeletconfig.KubeletConfiguration, deleteStateFiles bool) { updateKubeletConfigWithOptions(ctx, f, kubeletConfig, updateKubeletOptions{ deleteStateFiles: deleteStateFiles,