From b0fdc3c8caaf6ef756cdc4440dae45891bd96d01 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 8 Apr 2024 19:47:56 +0400 Subject: [PATCH] fix: make static pods check output consistent Sort the pod names, so the check output doesn't re-print itself on no change to the list of pods. Signed-off-by: Andrey Smirnov --- pkg/cluster/check/kubernetes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/cluster/check/kubernetes.go b/pkg/cluster/check/kubernetes.go index 90046490aa..8a0f86c74d 100644 --- a/pkg/cluster/check/kubernetes.go +++ b/pkg/cluster/check/kubernetes.go @@ -9,6 +9,7 @@ import ( "context" "fmt" "net/netip" + "slices" "strings" "github.com/cosi-project/runtime/pkg/safe" @@ -420,7 +421,10 @@ func K8sControlPlaneStaticPods(ctx context.Context, cl ClusterInfo) error { } if len(expectedStaticPods) > 0 { - return fmt.Errorf("missing static pods on node %s: %v", node.InternalIP, maps.Keys(expectedStaticPods)) + missingStaticPods := maps.Keys(expectedStaticPods) + slices.Sort(missingStaticPods) + + return fmt.Errorf("missing static pods on node %s: %v", node.InternalIP, missingStaticPods) } }