Skip to content

Commit

Permalink
MachineSet: Promote MachineSetPreflightChecks to Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Sep 26, 2024
1 parent 404084f commit c8a5f18
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion docs/book/src/developer/core/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
</aside>
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
5 changes: 3 additions & 2 deletions feature/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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},
}
8 changes: 0 additions & 8 deletions internal/controllers/machineset/machineset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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").
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions internal/controllers/machineset/machineset_preflight_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c8a5f18

Please sign in to comment.