diff --git a/pkg/synchromanager/clustersynchro/resource_negotiator.go b/pkg/synchromanager/clustersynchro/resource_negotiator.go index b7e2ced4f..9a290ec78 100644 --- a/pkg/synchromanager/clustersynchro/resource_negotiator.go +++ b/pkg/synchromanager/clustersynchro/resource_negotiator.go @@ -87,6 +87,14 @@ func (negotiator *ResourceNegotiator) NegotiateSyncResources(syncResources []clu for _, groupResources := range syncResources { for _, resource := range groupResources.Resources { syncGR := schema.GroupResource{Group: groupResources.Group, Resource: resource} + + if clusterpediafeature.FeatureGate.Enabled(features.IgnoreLeaseSync) { + // skip leases.coordination.k8s.io + if syncGR.String() == "leases.coordination.k8s.io" { + continue + } + } + apiResource, supportedVersions := negotiator.dynamicDiscovery.GetAPIResourceAndVersions(syncGR) if apiResource == nil || len(supportedVersions) == 0 { continue diff --git a/pkg/synchromanager/features/features.go b/pkg/synchromanager/features/features.go index ddf94c189..88715e154 100644 --- a/pkg/synchromanager/features/features.go +++ b/pkg/synchromanager/features/features.go @@ -61,6 +61,13 @@ const ( // owner: @iceber // alpha: v0.8.0 StreamHandlePaginatedListForResourceSync featuregate.Feature = "StreamHandlePaginatedListForResourceSync" + + // IgnoreLeaseSync is a feature gate for the ClusterSynchro to skip syncing leases.coordination.k8s.io, + // if you enable this feature, these resources will not be synced no matter what `syncResources` are defined. + // + // owner: @27149chen + // alpha: v0.8.0 + IgnoreLeaseSync featuregate.Feature = "IgnoreLeaseSync" ) func init() { @@ -78,4 +85,5 @@ var defaultClusterSynchroManagerFeatureGates = map[featuregate.Feature]featurega ForcePaginatedListForResourceSync: {Default: false, PreRelease: featuregate.Alpha}, StreamHandlePaginatedListForResourceSync: {Default: false, PreRelease: featuregate.Alpha}, + IgnoreLeaseSync: {Default: false, PreRelease: featuregate.Alpha}, }