Skip to content

Commit 392400d

Browse files
authored
Merge pull request #615 from 27149chen/exlucde-lease
add featureGate IgnoreLeaseSync to stop sync leases.coordination.k8s.io
2 parents 9bf4aa9 + b6eeea8 commit 392400d

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

pkg/synchromanager/clustersynchro/resource_negotiator.go

+8
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ func (negotiator *ResourceNegotiator) NegotiateSyncResources(syncResources []clu
8787
for _, groupResources := range syncResources {
8888
for _, resource := range groupResources.Resources {
8989
syncGR := schema.GroupResource{Group: groupResources.Group, Resource: resource}
90+
91+
if clusterpediafeature.FeatureGate.Enabled(features.IgnoreLeaseSync) {
92+
// skip leases.coordination.k8s.io
93+
if syncGR.String() == "leases.coordination.k8s.io" {
94+
continue
95+
}
96+
}
97+
9098
apiResource, supportedVersions := negotiator.dynamicDiscovery.GetAPIResourceAndVersions(syncGR)
9199
if apiResource == nil || len(supportedVersions) == 0 {
92100
continue

pkg/synchromanager/features/features.go

+8
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ const (
6161
// owner: @iceber
6262
// alpha: v0.8.0
6363
StreamHandlePaginatedListForResourceSync featuregate.Feature = "StreamHandlePaginatedListForResourceSync"
64+
65+
// IgnoreLeaseSync is a feature gate for the ClusterSynchro to skip syncing leases.coordination.k8s.io,
66+
// if you enable this feature, these resources will not be synced no matter what `syncResources` are defined.
67+
//
68+
// owner: @27149chen
69+
// alpha: v0.8.0
70+
IgnoreLeaseSync featuregate.Feature = "IgnoreLeaseSync"
6471
)
6572

6673
func init() {
@@ -78,4 +85,5 @@ var defaultClusterSynchroManagerFeatureGates = map[featuregate.Feature]featurega
7885

7986
ForcePaginatedListForResourceSync: {Default: false, PreRelease: featuregate.Alpha},
8087
StreamHandlePaginatedListForResourceSync: {Default: false, PreRelease: featuregate.Alpha},
88+
IgnoreLeaseSync: {Default: false, PreRelease: featuregate.Alpha},
8189
}

0 commit comments

Comments
 (0)