Skip to content

Commit

Permalink
Merge pull request #621 from 27149chen/cherry-pick-615
Browse files Browse the repository at this point in the history
[release/0.7] add featureGate IgnoreLeaseSync to stop sync leases.coordination.k8s.io
  • Loading branch information
Iceber authored Dec 20, 2023
2 parents cbf0518 + 9140eb7 commit 002486a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/synchromanager/clustersynchro/resource_negotiator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions pkg/synchromanager/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ const (
// owner: @iceber
// alpha: v0.6.0
HealthCheckerWithStandaloneTCP featuregate.Feature = "HealthCheckerWithStandaloneTCP"

// 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() {
Expand All @@ -59,4 +66,5 @@ var defaultClusterSynchroManagerFeatureGates = map[featuregate.Feature]featurega
AllowSyncAllCustomResources: {Default: false, PreRelease: featuregate.Alpha},
AllowSyncAllResources: {Default: false, PreRelease: featuregate.Alpha},
HealthCheckerWithStandaloneTCP: {Default: false, PreRelease: featuregate.Alpha},
IgnoreLeaseSync: {Default: false, PreRelease: featuregate.Alpha},
}

0 comments on commit 002486a

Please sign in to comment.