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 <atokubi@redhat.com>
This commit is contained in:
Ayato Tokubi
2025-09-05 15:20:13 +00:00
parent f278302957
commit 5ed98e97e1

View File

@@ -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,