From 73419313ee7fa9647ae0f77538ad78458c42e73f Mon Sep 17 00:00:00 2001 From: Matt Moyer Date: Fri, 5 Mar 2021 16:59:43 -0600 Subject: [PATCH] Log when the validation eventually succeeds. Signed-off-by: Matt Moyer --- cmd/pinniped/cmd/kubeconfig.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/pinniped/cmd/kubeconfig.go b/cmd/pinniped/cmd/kubeconfig.go index 610b1cc0..d0025840 100644 --- a/cmd/pinniped/cmd/kubeconfig.go +++ b/cmd/pinniped/cmd/kubeconfig.go @@ -598,16 +598,19 @@ func validateKubeconfig(ctx context.Context, flags getKubeconfigParams, kubeconf log.Info("could not immediately connect to the cluster but it may be initializing, will retry until timeout") deadline, _ := ctx.Deadline() + attempts := 0 for { select { case <-ctx.Done(): return ctx.Err() case <-ticker.C: + attempts++ err := pingCluster() if err == nil { + log.Info("validated connection to the cluster", "attempts", attempts) return nil } - log.Error(err, "could not connect to cluster, retrying...", "remaining", time.Until(deadline).Round(time.Second).String()) + log.Error(err, "could not connect to cluster, retrying...", "attempts", attempts, "remaining", time.Until(deadline).Round(time.Second).String()) } } }