From 9fad0da973399f6e23a15eb816c0dd4c02accfb5 Mon Sep 17 00:00:00 2001 From: Charles Kenney Date: Mon, 28 Sep 2020 15:09:39 -0400 Subject: [PATCH] make ClusterConditionFunc's adhere to k8s waiter convention --- k8s/pkg/condition/lke.go | 4 +--- waitfor.go | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/k8s/pkg/condition/lke.go b/k8s/pkg/condition/lke.go index f65b3bc15..1defb59cd 100644 --- a/k8s/pkg/condition/lke.go +++ b/k8s/pkg/condition/lke.go @@ -2,7 +2,6 @@ package condition import ( "context" - "errors" "fmt" "github.com/linode/linodego" @@ -31,8 +30,7 @@ func ClusterHasReadyNode(ctx context.Context, options linodego.ClusterConditionO } } } - - return false, errors.New("no nodes in cluster are ready") + return false, nil } // WaitForLKEClusterReady polls with a given timeout for the LKE Cluster's api-server diff --git a/waitfor.go b/waitfor.go index c85b9cf15..b1c1aa634 100644 --- a/waitfor.go +++ b/waitfor.go @@ -221,7 +221,6 @@ func (client Client) WaitForLKEClusterConditions( } defer cancel() - var prevLog string lkeKubeConfig, err := client.GetLKEClusterKubeconfig(ctx, clusterID) if err != nil { return fmt.Errorf("failed to get Kubeconfig for LKE cluster %d: %s", clusterID, err) @@ -239,10 +238,7 @@ func (client Client) WaitForLKEClusterConditions( case <-ticker.C: result, err := condition(ctx, conditionOptions) if err != nil { - if err.Error() != prevLog { - prevLog = err.Error() - log.Printf("[ERROR] %s\n", err) - } + return err } if result {