diff --git a/pkg/search/controller.go b/pkg/search/controller.go index 700535f56ab4..abab26e57739 100644 --- a/pkg/search/controller.go +++ b/pkg/search/controller.go @@ -178,7 +178,7 @@ func (c *Controller) doCacheCluster(cluster string) error { return nil } - // STEP1: stop informer manager for the cluster which does not exist anymore. + // STEP1: stop informer manager for the cluster which does not exist anymore or is not ready. cls, err := c.clusterLister.Get(cluster) if err != nil { if apierrors.IsNotFound(err) { @@ -195,6 +195,12 @@ func (c *Controller) doCacheCluster(cluster string) error { return nil } + if !util.IsClusterReady(&cls.Status) { + klog.Warningf("cluster %s is notReady try to stop this cluster informer", cluster) + c.InformerManager.Stop(cluster) + return nil + } + // STEP2: added/updated cluster, builds an informer manager for a specific cluster. if !c.InformerManager.IsManagerExist(cluster) { klog.Info("try to build informer manager for cluster ", cluster)