From 9784d65e8b181c935d3a574743047ffb2f91a6f8 Mon Sep 17 00:00:00 2001 From: Brandon Palm Date: Thu, 9 Nov 2023 12:08:41 -0600 Subject: [PATCH] Modify node object instead of making new (#589) --- tests/utils/nodes/nodes.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/utils/nodes/nodes.go b/tests/utils/nodes/nodes.go index 63db39743..020b49327 100644 --- a/tests/utils/nodes/nodes.go +++ b/tests/utils/nodes/nodes.go @@ -127,13 +127,10 @@ func ensureAllNodesAreLabeled(client corev1Typed.CoreV1Interface, label string) // LabelNode labels a node by a given node name. func LabelNode(client corev1Typed.CoreV1Interface, node *corev1.Node, label, value string) error { + node.Labels[label] = value + // Set the label - _, err := client.Nodes().Update(context.TODO(), &corev1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: node.Name, - Labels: map[string]string{label: value}, - }, - }, metav1.UpdateOptions{}) + _, err := client.Nodes().Update(context.TODO(), node, metav1.UpdateOptions{}) return err }