controller/cluster: ensure cluster is Ready when cleanup notifications (#5392)

This commit is contained in:
Xinzhao Xu
2022-12-06 17:06:58 +08:00
committed by GitHub
parent d739c693c1
commit aab3ad8b87
3 changed files with 36 additions and 8 deletions

View File

@@ -22,7 +22,6 @@ import (
"reflect"
"sync"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
@@ -34,6 +33,7 @@ import (
kubesphere "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
clusterinformer "kubesphere.io/kubesphere/pkg/client/informers/externalversions/cluster/v1alpha1"
clusterlister "kubesphere.io/kubesphere/pkg/client/listers/cluster/v1alpha1"
clusterutils "kubesphere.io/kubesphere/pkg/controller/cluster/utils"
)
type innerCluster struct {
@@ -172,12 +172,7 @@ func (c *clusterClients) GetInnerCluster(name string) *innerCluster {
}
func (c *clusterClients) IsClusterReady(cluster *clusterv1alpha1.Cluster) bool {
for _, condition := range cluster.Status.Conditions {
if condition.Type == clusterv1alpha1.ClusterReady && condition.Status == corev1.ConditionTrue {
return true
}
}
return false
return clusterutils.IsClusterReady(cluster)
}
func (c *clusterClients) IsHostCluster(cluster *clusterv1alpha1.Cluster) bool {