From c8a5f18bc49b4f8b555129b7f5c0471f15f24856 Mon Sep 17 00:00:00 2001 From: Christian Schlotter Date: Thu, 26 Sep 2024 11:11:09 +0200 Subject: [PATCH] MachineSet: Promote MachineSetPreflightChecks to Beta --- config/manager/manager.yaml | 2 +- docs/book/src/developer/core/testing.md | 1 - .../experimental-features/machineset-preflight-checks.md | 2 +- feature/feature.go | 5 +++-- .../controllers/machineset/machineset_controller_test.go | 8 -------- .../controllers/machineset/machineset_preflight_test.go | 2 -- 6 files changed, 5 insertions(+), 15 deletions(-) diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 5f537b5cbb61..26ad15d063cb 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -24,7 +24,7 @@ spec: - "--diagnostics-address=${CAPI_DIAGNOSTICS_ADDRESS:=:8443}" - "--insecure-diagnostics=${CAPI_INSECURE_DIAGNOSTICS:=false}" - "--use-deprecated-infra-machine-naming=${CAPI_USE_DEPRECATED_INFRA_MACHINE_NAMING:=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:=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}" image: controller:latest name: manager env: diff --git a/docs/book/src/developer/core/testing.md b/docs/book/src/developer/core/testing.md index 58d1a25d64e2..8e1ea1374c8b 100644 --- a/docs/book/src/developer/core/testing.md +++ b/docs/book/src/developer/core/testing.md @@ -266,7 +266,6 @@ kustomize_substitutions: CLUSTER_TOPOLOGY: "true" EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION: "true" EXP_RUNTIME_SDK: "true" - EXP_MACHINE_SET_PREFLIGHT_CHECKS: "true" ``` diff --git a/docs/book/src/tasks/experimental-features/machineset-preflight-checks.md b/docs/book/src/tasks/experimental-features/machineset-preflight-checks.md index a24b94b977d8..a5d3d1e405ce 100644 --- a/docs/book/src/tasks/experimental-features/machineset-preflight-checks.md +++ b/docs/book/src/tasks/experimental-features/machineset-preflight-checks.md @@ -1,4 +1,4 @@ -# Experimental Feature: MachineSetPreflightChecks (alpha) +# Experimental Feature: MachineSetPreflightChecks (beta) The `MachineSetPreflightChecks` feature can provide additional safety while creating new Machines and remediating existing unhealthy Machines of a MachineSet. diff --git a/feature/feature.go b/feature/feature.go index cec880672656..4253ae98f509 100644 --- a/feature/feature.go +++ b/feature/feature.go @@ -60,6 +60,7 @@ const ( // MachineSetPreflightChecks is a feature gate for the MachineSet preflight checks functionality. // // alpha: v1.5 + // beta: v1.9 MachineSetPreflightChecks featuregate.Feature = "MachineSetPreflightChecks" ) @@ -71,10 +72,10 @@ 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: - MachinePool: {Default: true, PreRelease: featuregate.Beta}, ClusterResourceSet: {Default: true, PreRelease: featuregate.Beta}, + MachinePool: {Default: true, PreRelease: featuregate.Beta}, + MachineSetPreflightChecks: {Default: true, PreRelease: featuregate.Beta}, ClusterTopology: {Default: false, PreRelease: featuregate.Alpha}, KubeadmBootstrapFormatIgnition: {Default: false, PreRelease: featuregate.Alpha}, RuntimeSDK: {Default: false, PreRelease: featuregate.Alpha}, - MachineSetPreflightChecks: {Default: false, PreRelease: featuregate.Alpha}, } diff --git a/internal/controllers/machineset/machineset_controller_test.go b/internal/controllers/machineset/machineset_controller_test.go index 4656d208f368..d9dc86ac6389 100644 --- a/internal/controllers/machineset/machineset_controller_test.go +++ b/internal/controllers/machineset/machineset_controller_test.go @@ -28,7 +28,6 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/client-go/tools/record" - utilfeature "k8s.io/component-base/featuregate/testing" "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" @@ -37,7 +36,6 @@ import ( clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/controllers/external" - "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/internal/contract" "sigs.k8s.io/cluster-api/internal/test/builder" "sigs.k8s.io/cluster-api/internal/util/ssa" @@ -1439,8 +1437,6 @@ func TestMachineSetReconciler_syncMachines(t *testing.T) { func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) { t.Run("should delete unhealthy machines if preflight checks pass", func(t *testing.T) { - utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachineSetPreflightChecks, true) - g := NewWithT(t) controlPlaneStable := builder.ControlPlane("default", "cp1"). @@ -1499,8 +1495,6 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) { }) t.Run("should update the unhealthy machine MachineOwnerRemediated condition if preflight checks did not pass", func(t *testing.T) { - utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachineSetPreflightChecks, true) - g := NewWithT(t) // An upgrading control plane should cause the preflight checks to not pass. @@ -1914,8 +1908,6 @@ func TestMachineSetReconciler_reconcileUnhealthyMachines(t *testing.T) { func TestMachineSetReconciler_syncReplicas(t *testing.T) { t.Run("should hold off on creating new machines when preflight checks do not pass", func(t *testing.T) { - utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachineSetPreflightChecks, true) - g := NewWithT(t) // An upgrading control plane should cause the preflight checks to not pass. diff --git a/internal/controllers/machineset/machineset_preflight_test.go b/internal/controllers/machineset/machineset_preflight_test.go index b17c6ebdbce0..a098fc749182 100644 --- a/internal/controllers/machineset/machineset_preflight_test.go +++ b/internal/controllers/machineset/machineset_preflight_test.go @@ -68,8 +68,6 @@ func TestMachineSetReconciler_runPreflightChecks(t *testing.T) { Build() t.Run("should run preflight checks if the feature gate is enabled", func(t *testing.T) { - utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachineSetPreflightChecks, true) - tests := []struct { name string cluster *clusterv1.Cluster