From 239b78011879a053ebdd3031d7b25e7ae8dfad3c Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Mon, 10 Jun 2024 11:27:34 +0200 Subject: [PATCH] Apply PR comments --- src/k8s/cmd/k8s/k8s_x_wait_for.go | 6 ++++++ src/k8s/pkg/k8sd/features/calico/status.go | 2 +- src/k8s/pkg/k8sd/features/cilium/status.go | 2 +- src/k8s/pkg/k8sd/features/coredns/status.go | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/k8s/cmd/k8s/k8s_x_wait_for.go b/src/k8s/cmd/k8s/k8s_x_wait_for.go index 49d83e5ce..17f8fc1b2 100644 --- a/src/k8s/cmd/k8s/k8s_x_wait_for.go +++ b/src/k8s/cmd/k8s/k8s_x_wait_for.go @@ -22,6 +22,9 @@ func newXWaitForCmd(env cmdutil.ExecutionEnvironment) *cobra.Command { defer cancel() if err := control.WaitUntilReady(ctx, func() (bool, error) { err := features.StatusChecks.CheckDNS(cmd.Context(), env.Snap) + if err != nil { + cmd.PrintErrf("DNS not ready yet: %v\n", err.Error()) + } return err == nil, nil }); err != nil { cmd.PrintErrf("Error: DNS did not become ready: %v\n", err) @@ -39,6 +42,9 @@ func newXWaitForCmd(env cmdutil.ExecutionEnvironment) *cobra.Command { defer cancel() if err := control.WaitUntilReady(ctx, func() (bool, error) { err := features.StatusChecks.CheckNetwork(cmd.Context(), env.Snap) + if err != nil { + cmd.PrintErrf("network not ready yet: %v\n", err.Error()) + } return err == nil, nil }); err != nil { cmd.PrintErrf("Error: network did not become ready: %v\n", err) diff --git a/src/k8s/pkg/k8sd/features/calico/status.go b/src/k8s/pkg/k8sd/features/calico/status.go index ef6b0ee95..423fe7426 100644 --- a/src/k8s/pkg/k8sd/features/calico/status.go +++ b/src/k8s/pkg/k8sd/features/calico/status.go @@ -30,7 +30,7 @@ func CheckNetwork(ctx context.Context, snap snap.Snap) error { if err := client.CheckForReadyPods(ctx, check.namespace, metav1.ListOptions{ LabelSelector: metav1.FormatLabelSelector(&metav1.LabelSelector{MatchLabels: check.labels}), }); err != nil { - return fmt.Errorf("check %v failed: %w", check.name, err) + return fmt.Errorf("%v pods not yet ready: %w", check.name, err) } } diff --git a/src/k8s/pkg/k8sd/features/cilium/status.go b/src/k8s/pkg/k8sd/features/cilium/status.go index 1119acf98..45b61c79b 100644 --- a/src/k8s/pkg/k8sd/features/cilium/status.go +++ b/src/k8s/pkg/k8sd/features/cilium/status.go @@ -26,7 +26,7 @@ func CheckNetwork(ctx context.Context, snap snap.Snap) error { if err := client.CheckForReadyPods(ctx, check.namespace, metav1.ListOptions{ LabelSelector: metav1.FormatLabelSelector(&metav1.LabelSelector{MatchLabels: check.labels}), }); err != nil { - return fmt.Errorf("check %v failed: %w", check.name, err) + return fmt.Errorf("%v pods not yet ready: %w", check.name, err) } } diff --git a/src/k8s/pkg/k8sd/features/coredns/status.go b/src/k8s/pkg/k8sd/features/coredns/status.go index 8a9f32ca8..629eabe87 100644 --- a/src/k8s/pkg/k8sd/features/coredns/status.go +++ b/src/k8s/pkg/k8sd/features/coredns/status.go @@ -26,7 +26,7 @@ func CheckDNS(ctx context.Context, snap snap.Snap) error { if err := client.CheckForReadyPods(ctx, check.namespace, metav1.ListOptions{ LabelSelector: metav1.FormatLabelSelector(&metav1.LabelSelector{MatchLabels: check.labels}), }); err != nil { - return fmt.Errorf("check %v failed: %w", check.name, err) + return fmt.Errorf("%v pods not yet ready: %w", check.name, err) } }