Set max retries for cluster readiness to 18
@@ -10,20 +10,31 @@ import (
"github.com/kinvolk/lokoctl/pkg/util/retryutil"
)
+const (
+ // Max number of retries when waiting for cluster to become available.
+ clusterPingRetries = 18
+ // Number of seconds to wait between retires when waiting for cluster to become available.
+ clusterPingRetryInterval = 10
+ // Max number of retries when waiting for nodes to become ready.
+ nodeReadinessRetries = 18
+ // Number of seconds to wait between retires when waiting for nodes to become ready.
+ nodeReadinessRetryInterval = 10
+)
+
// Verify health and readiness of the cluster.
func Verify(cl *lokomotive.Cluster) error {
fmt.Println("\nNow checking health and readiness of the cluster nodes ...")
// Wait for cluster to become available
- err := retryutil.Retry(10*time.Second, 5, cl.Ping)
+ err := retryutil.Retry(clusterPingRetryInterval*time.Second, clusterPingRetries, cl.Ping)
if err != nil {
return errors.Wrapf(err, "failed to ping cluster for readiness")
}
- err = retryutil.Retry(10*time.Second, 5, cl.NodesReady)
+ err = retryutil.Retry(nodeReadinessRetryInterval*time.Second, nodeReadinessRetries, cl.NodesReady)
if err != nil {
if retryutil.IsRetryFailure(err) {
- return fmt.Errorf("not all nodes became ready within 50 seconds")
+ return fmt.Errorf("not all nodes became ready within the allowed time")
}
return errors.Wrapf(err, "error determining node readiness")
}
