From 46de6747c6b91a46c76be4d42cebd298120451ae Mon Sep 17 00:00:00 2001 From: Aman Shrivastava Date: Thu, 6 Nov 2025 18:37:33 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B1=20Remove=20deprecated=20ClusterRes?= =?UTF-8?q?ourceSet=20feature=20gate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .golangci.yml | 4 --- config/manager/manager.yaml | 2 +- docs/book/src/tasks/cluster-resource-set.md | 6 ---- feature/feature.go | 10 ------- internal/webhooks/clusterresourceset.go | 10 ------- .../webhooks/clusterresourcesetbinding.go | 10 ------- main.go | 30 +++++++++---------- 7 files changed, 15 insertions(+), 57 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 4030de971c57..1d654d8c2bc4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -261,10 +261,6 @@ linters: - linters: - staticcheck text: 'SA1019: (clusterv1alpha3.*|clusterv1alpha4.*) is deprecated: This type will be removed in one of the next releases.' - # Specific exclude rules for deprecated feature flags - - linters: - - staticcheck - text: 'SA1019: feature.ClusterResourceSet is deprecated: ClusterResourceSet feature is now GA and the corresponding feature flag will be removed in 1.12 release.' # v1Beta1 deprecated fields - linters: - staticcheck diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 7532a870b6d2..c2cab3b37dba 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -23,7 +23,7 @@ spec: - "--leader-elect" - "--diagnostics-address=${CAPI_DIAGNOSTICS_ADDRESS:=:8443}" - "--insecure-diagnostics=${CAPI_INSECURE_DIAGNOSTICS:=false}" - - "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=true},ClusterResourceSet=${EXP_CLUSTER_RESOURCE_SET:=true},ClusterTopology=${CLUSTER_TOPOLOGY:=false},RuntimeSDK=${EXP_RUNTIME_SDK:=false},MachineSetPreflightChecks=${EXP_MACHINE_SET_PREFLIGHT_CHECKS:=true},MachineWaitForVolumeDetachConsiderVolumeAttachments=${EXP_MACHINE_WAITFORVOLUMEDETACH_CONSIDER_VOLUMEATTACHMENTS:=true},PriorityQueue=${EXP_PRIORITY_QUEUE:=false},InPlaceUpdates=${EXP_IN_PLACE_UPDATES:=false}" + - "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=true},ClusterTopology=${CLUSTER_TOPOLOGY:=false},RuntimeSDK=${EXP_RUNTIME_SDK:=false},MachineSetPreflightChecks=${EXP_MACHINE_SET_PREFLIGHT_CHECKS:=true},MachineWaitForVolumeDetachConsiderVolumeAttachments=${EXP_MACHINE_WAITFORVOLUMEDETACH_CONSIDER_VOLUMEATTACHMENTS:=true},PriorityQueue=${EXP_PRIORITY_QUEUE:=false},InPlaceUpdates=${EXP_IN_PLACE_UPDATES:=false}" image: controller:latest name: manager env: diff --git a/docs/book/src/tasks/cluster-resource-set.md b/docs/book/src/tasks/cluster-resource-set.md index 35bdc3d3fa50..4736cc7d20be 100644 --- a/docs/book/src/tasks/cluster-resource-set.md +++ b/docs/book/src/tasks/cluster-resource-set.md @@ -3,12 +3,6 @@ The `ClusterResourceSet` feature is introduced to provide a way to automatically apply a set of resources (such as CNI/CSI) defined by users to matching newly-created/existing clusters. `ClusterResourceSet` provides a basic solution for installing & managing resources, while for advanced use cases an addon provider must be used. -**Feature gate name**: `ClusterResourceSet` - -**Variable name to enable/disable the feature gate**: `EXP_CLUSTER_RESOURCE_SET` - -The `ClusterResourceSet` feature is now GA and is enabled by default, but can be disabled by setting the `EXP_CLUSTER_RESOURCE_SET` environment variable to `false`. - More details on `ClusterResourceSet` can be found at: [ClusterResourceSet CAEP](https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20200220-cluster-resource-set.md) diff --git a/feature/feature.go b/feature/feature.go index 5793fe8fcbd0..f384df0475ab 100644 --- a/feature/feature.go +++ b/feature/feature.go @@ -35,15 +35,6 @@ const ( // beta: v1.7 MachinePool featuregate.Feature = "MachinePool" - // ClusterResourceSet is a feature gate for the ClusterResourceSet functionality. - // - // alpha: v0.3 - // beta: v0.4 - // GA: v1.10 - // - // Deprecated: ClusterResourceSet feature is now GA and the corresponding feature flag will be removed in 1.12 release. - ClusterResourceSet featuregate.Feature = "ClusterResourceSet" - // ClusterTopology is a feature gate for the ClusterClass and managed topologies functionality. // // alpha: v0.4 @@ -91,7 +82,6 @@ func init() { // To add a new feature, define a key for it above and add it here. var defaultClusterAPIFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{ // Every feature should be initiated here: - ClusterResourceSet: {Default: true, PreRelease: featuregate.GA}, MachinePool: {Default: true, PreRelease: featuregate.Beta}, MachineSetPreflightChecks: {Default: true, PreRelease: featuregate.Beta}, MachineWaitForVolumeDetachConsiderVolumeAttachments: {Default: true, PreRelease: featuregate.Beta}, diff --git a/internal/webhooks/clusterresourceset.go b/internal/webhooks/clusterresourceset.go index 6a8ca18c45f3..fca3d4554016 100644 --- a/internal/webhooks/clusterresourceset.go +++ b/internal/webhooks/clusterresourceset.go @@ -30,7 +30,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook/admission" addonsv1 "sigs.k8s.io/cluster-api/api/addons/v1beta2" - "sigs.k8s.io/cluster-api/feature" ) // ClusterResourceSet implements a validation and defaulting webhook for ClusterResourceSet. @@ -93,15 +92,6 @@ func (webhook *ClusterResourceSet) ValidateDelete(_ context.Context, _ runtime.O func (webhook *ClusterResourceSet) validate(oldCRS, newCRS *addonsv1.ClusterResourceSet) error { var allErrs field.ErrorList - // NOTE: ClusterResourceSet is behind ClusterResourceSet feature gate flag; the web hook - // must prevent creating new objects when the feature flag is disabled. - if !feature.Gates.Enabled(feature.ClusterResourceSet) { - return field.Forbidden( - field.NewPath("spec"), - "can be set only if the ClusterResourceSet feature flag is enabled", - ) - } - // Validate selector parses as Selector selector, err := metav1.LabelSelectorAsSelector(&newCRS.Spec.ClusterSelector) if err != nil { diff --git a/internal/webhooks/clusterresourcesetbinding.go b/internal/webhooks/clusterresourcesetbinding.go index cca0aef0519e..2a1dcb7697b5 100644 --- a/internal/webhooks/clusterresourcesetbinding.go +++ b/internal/webhooks/clusterresourcesetbinding.go @@ -28,7 +28,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook/admission" addonsv1 "sigs.k8s.io/cluster-api/api/addons/v1beta2" - "sigs.k8s.io/cluster-api/feature" ) func (webhook *ClusterResourceSetBinding) SetupWebhookWithManager(mgr ctrl.Manager) error { @@ -75,15 +74,6 @@ func (webhook *ClusterResourceSetBinding) ValidateDelete(_ context.Context, _ ru func (webhook *ClusterResourceSetBinding) validate(oldCRSB, newCRSB *addonsv1.ClusterResourceSetBinding) error { var allErrs field.ErrorList - // NOTE: ClusterResourceSet is behind ClusterResourceSet feature gate flag; the web hook - // must prevent creating new objects in case the feature flag is disabled. - if !feature.Gates.Enabled(feature.ClusterResourceSet) { - return field.Forbidden( - field.NewPath("spec"), - "can be set only if the ClusterResourceSet feature flag is enabled", - ) - } - if oldCRSB != nil && oldCRSB.Spec.ClusterName != "" && oldCRSB.Spec.ClusterName != newCRSB.Spec.ClusterName { allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "clusterName"), newCRSB.Spec.ClusterName, "field is immutable")) diff --git a/main.go b/main.go index 8f6f050fafd8..0c350ac5b266 100644 --- a/main.go +++ b/main.go @@ -731,22 +731,20 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager, watchNamespaces map } } - if feature.Gates.Enabled(feature.ClusterResourceSet) { - if err := (&controllers.ClusterResourceSetReconciler{ - Client: mgr.GetClient(), - ClusterCache: clusterCache, - WatchFilterValue: watchFilterValue, - }).SetupWithManager(ctx, mgr, concurrency(clusterResourceSetConcurrency), partialSecretCache); err != nil { - setupLog.Error(err, "Unable to create controller", "controller", "ClusterResourceSet") - os.Exit(1) - } - if err := (&controllers.ClusterResourceSetBindingReconciler{ - Client: mgr.GetClient(), - WatchFilterValue: watchFilterValue, - }).SetupWithManager(ctx, mgr, concurrency(clusterResourceSetConcurrency)); err != nil { - setupLog.Error(err, "Unable to create controller", "controller", "ClusterResourceSetBinding") - os.Exit(1) - } + if err := (&controllers.ClusterResourceSetReconciler{ + Client: mgr.GetClient(), + ClusterCache: clusterCache, + WatchFilterValue: watchFilterValue, + }).SetupWithManager(ctx, mgr, concurrency(clusterResourceSetConcurrency), partialSecretCache); err != nil { + setupLog.Error(err, "Unable to create controller", "controller", "ClusterResourceSet") + os.Exit(1) + } + if err := (&controllers.ClusterResourceSetBindingReconciler{ + Client: mgr.GetClient(), + WatchFilterValue: watchFilterValue, + }).SetupWithManager(ctx, mgr, concurrency(clusterResourceSetConcurrency)); err != nil { + setupLog.Error(err, "Unable to create controller", "controller", "ClusterResourceSetBinding") + os.Exit(1) } if err := (&controllers.MachineHealthCheckReconciler{