From e08029ade4f8777036c27b876bb8ff189e61273b Mon Sep 17 00:00:00 2001 From: Garrybest Date: Sat, 19 Jun 2021 21:27:21 +0800 Subject: [PATCH] use meta.IsStatusConditionTrue in cluster.go Signed-off-by: Garrybest --- pkg/util/cluster.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/pkg/util/cluster.go b/pkg/util/cluster.go index 6b2d56bdd..0e5eb5b8f 100644 --- a/pkg/util/cluster.go +++ b/pkg/util/cluster.go @@ -3,7 +3,7 @@ package util import ( "context" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" @@ -17,14 +17,7 @@ const ( // IsClusterReady tells whether the cluster status in 'Ready' condition. func IsClusterReady(clusterStatus *v1alpha1.ClusterStatus) bool { - for _, condition := range clusterStatus.Conditions { - if condition.Type == v1alpha1.ClusterConditionReady { - if condition.Status == metav1.ConditionTrue { - return true - } - } - } - return false + return meta.IsStatusConditionTrue(clusterStatus.Conditions, v1alpha1.ClusterConditionReady) } // GetCluster returns the given Cluster resource