Disable GetClusterZones if CrossClusterServiceDiscovery is disabled
When CrossClusterServiceDiscovery feature gate is disabled,
don't bother to collect the Zone/Region info because it isn't used.
@@ -26,9 +26,11 @@ import (
fedv1a1 "github.com/kubernetes-sigs/federation-v2/pkg/apis/core/v1alpha1"
"github.com/kubernetes-sigs/federation-v2/pkg/controller/util"
+ "github.com/kubernetes-sigs/federation-v2/pkg/features"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
+ utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/client-go/tools/cache"
genericclient "github.com/kubernetes-sigs/federation-v2/pkg/client/generic"
@@ -208,6 +210,7 @@ func (cc *ClusterController) updateClusterStatus() error {
}
}
+ if utilfeature.DefaultFeatureGate.Enabled(features.CrossClusterServiceDiscovery) {
zone, region, err := clusterClient.GetClusterZones()
if err != nil {
glog.Warningf("Failed to get zones and region for cluster %s: %v", cluster.Name, err)
@@ -221,6 +224,7 @@ func (cc *ClusterController) updateClusterStatus() error {
clusterStatusNew.Zone = zone
clusterStatusNew.Region = region
}
+ }
cc.mu.Lock()
cc.clusterStatusMap[cluster.Name] = *clusterStatusNew
