Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add featureGate IgnoreLeaseSync to stop sync leases.coordination.k8s.io #615

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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},
}
Loading