Skip to content

Commit

Permalink
Merge pull request #615 from 27149chen/exlucde-lease
Browse files Browse the repository at this point in the history
add featureGate IgnoreLeaseSync to stop sync leases.coordination.k8s.io
  • Loading branch information
Iceber authored Dec 20, 2023
2 parents 9bf4aa9 + b6eeea8 commit 392400d
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 @@ -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() {
Expand All @@ -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},
}

0 comments on commit 392400d

Please sign in to comment.