Skip to content

Commit 002486a

Browse files
authored
Merge pull request #621 from 27149chen/cherry-pick-615
[release/0.7] add featureGate IgnoreLeaseSync to stop sync leases.coordination.k8s.io
2 parents cbf0518 + 9140eb7 commit 002486a

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
@@ -45,6 +45,13 @@ const (
4545
// owner: @iceber
4646
// alpha: v0.6.0
4747
HealthCheckerWithStandaloneTCP featuregate.Feature = "HealthCheckerWithStandaloneTCP"
48+
49+
// IgnoreLeaseSync is a feature gate for the ClusterSynchro to skip syncing leases.coordination.k8s.io,
50+
// if you enable this feature, these resources will not be synced no matter what `syncResources` are defined.
51+
//
52+
// owner: @27149chen
53+
// alpha: v0.8.0
54+
IgnoreLeaseSync featuregate.Feature = "IgnoreLeaseSync"
4855
)
4956

5057
func init() {
@@ -59,4 +66,5 @@ var defaultClusterSynchroManagerFeatureGates = map[featuregate.Feature]featurega
5966
AllowSyncAllCustomResources: {Default: false, PreRelease: featuregate.Alpha},
6067
AllowSyncAllResources: {Default: false, PreRelease: featuregate.Alpha},
6168
HealthCheckerWithStandaloneTCP: {Default: false, PreRelease: featuregate.Alpha},
69+
IgnoreLeaseSync: {Default: false, PreRelease: featuregate.Alpha},
6270
}

0 commit comments

Comments
 (0)