Log when the validation eventually succeeds.
Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
parent
4750d7d7d2
commit
73419313ee
@ -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")
|
log.Info("could not immediately connect to the cluster but it may be initializing, will retry until timeout")
|
||||||
deadline, _ := ctx.Deadline()
|
deadline, _ := ctx.Deadline()
|
||||||
|
attempts := 0
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
|
attempts++
|
||||||
err := pingCluster()
|
err := pingCluster()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
log.Info("validated connection to the cluster", "attempts", attempts)
|
||||||
return nil
|
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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user