Skip to content

Commit 128914b

Browse files
authored
Set MachinePool feature flag to true + Beta (#10141)
1 parent 284a92f commit 128914b

File tree

17 files changed

+16
-48
lines changed

17 files changed

+16
-48
lines changed

bootstrap/kubeadm/config/manager/manager.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
- "--leader-elect"
2323
- "--diagnostics-address=${CAPI_DIAGNOSTICS_ADDRESS:=:8443}"
2424
- "--insecure-diagnostics=${CAPI_INSECURE_DIAGNOSTICS:=false}"
25-
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},KubeadmBootstrapFormatIgnition=${EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION:=false}"
25+
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=true},KubeadmBootstrapFormatIgnition=${EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION:=false}"
2626
- "--bootstrap-token-ttl=${KUBEADM_BOOTSTRAP_TOKEN_TTL:=15m}"
2727
image: controller:latest
2828
name: manager

config/manager/manager.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323
- "--leader-elect"
2424
- "--diagnostics-address=${CAPI_DIAGNOSTICS_ADDRESS:=:8443}"
2525
- "--insecure-diagnostics=${CAPI_INSECURE_DIAGNOSTICS:=false}"
26-
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},ClusterResourceSet=${EXP_CLUSTER_RESOURCE_SET:=false},ClusterTopology=${CLUSTER_TOPOLOGY:=false},RuntimeSDK=${EXP_RUNTIME_SDK:=false},MachineSetPreflightChecks=${EXP_MACHINE_SET_PREFLIGHT_CHECKS:=false}"
26+
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=true},ClusterResourceSet=${EXP_CLUSTER_RESOURCE_SET:=false},ClusterTopology=${CLUSTER_TOPOLOGY:=false},RuntimeSDK=${EXP_RUNTIME_SDK:=false},MachineSetPreflightChecks=${EXP_MACHINE_SET_PREFLIGHT_CHECKS:=false}"
2727
image: controller:latest
2828
name: manager
2929
env:

controlplane/kubeadm/config/manager/manager.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
- "--leader-elect"
2323
- "--diagnostics-address=${CAPI_DIAGNOSTICS_ADDRESS:=:8443}"
2424
- "--insecure-diagnostics=${CAPI_INSECURE_DIAGNOSTICS:=false}"
25-
- "--feature-gates=ClusterTopology=${CLUSTER_TOPOLOGY:=false},KubeadmBootstrapFormatIgnition=${EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION:=false}"
25+
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=true},ClusterTopology=${CLUSTER_TOPOLOGY:=false},KubeadmBootstrapFormatIgnition=${EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION:=false}"
2626
image: controller:latest
2727
name: manager
2828
env:

controlplane/kubeadm/config/rbac/role.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ rules:
4747
- get
4848
- list
4949
- watch
50+
- apiGroups:
51+
- cluster.x-k8s.io
52+
resources:
53+
- machinepools
54+
verbs:
55+
- list
5056
- apiGroups:
5157
- cluster.x-k8s.io
5258
resources:

controlplane/kubeadm/internal/controllers/controller.go

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const (
6767
// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io;bootstrap.cluster.x-k8s.io;controlplane.cluster.x-k8s.io,resources=*,verbs=get;list;watch;create;update;patch;delete
6868
// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=clusters;clusters/status,verbs=get;list;watch
6969
// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=machines;machines/status,verbs=get;list;watch;create;update;patch;delete
70+
// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=machinepools,verbs=list
7071
// +kubebuilder:rbac:groups=apiextensions.k8s.io,resources=customresourcedefinitions,verbs=get;list;watch
7172

7273
// KubeadmControlPlaneReconciler reconciles a KubeadmControlPlane object.

controlplane/kubeadm/main.go

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import (
5252
kubeadmcontrolplanecontrollers "sigs.k8s.io/cluster-api/controlplane/kubeadm/controllers"
5353
"sigs.k8s.io/cluster-api/controlplane/kubeadm/internal/etcd"
5454
kcpwebhooks "sigs.k8s.io/cluster-api/controlplane/kubeadm/webhooks"
55+
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
5556
"sigs.k8s.io/cluster-api/feature"
5657
controlplanev1alpha3 "sigs.k8s.io/cluster-api/internal/apis/controlplane/kubeadm/v1alpha3"
5758
controlplanev1alpha4 "sigs.k8s.io/cluster-api/internal/apis/controlplane/kubeadm/v1alpha4"
@@ -92,6 +93,7 @@ var (
9293
func init() {
9394
_ = clientgoscheme.AddToScheme(scheme)
9495
_ = clusterv1.AddToScheme(scheme)
96+
_ = expv1.AddToScheme(scheme)
9597
_ = controlplanev1alpha3.AddToScheme(scheme)
9698
_ = controlplanev1alpha4.AddToScheme(scheme)
9799
_ = controlplanev1.AddToScheme(scheme)

docs/book/src/developer/testing.md

-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ via [Create the local repository](http://localhost:3000/clusterctl/developers.ht
263263
```yaml
264264
kustomize_substitutions:
265265
CLUSTER_TOPOLOGY: "true"
266-
EXP_MACHINE_POOL: "true"
267266
EXP_CLUSTER_RESOURCE_SET: "true"
268267
EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION: "true"
269268
EXP_RUNTIME_SDK: "true"

docs/book/src/developer/tilt.md

-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ provider's yaml. These substitutions are also used when deploying cluster templa
108108
```yaml
109109
kustomize_substitutions:
110110
CLUSTER_TOPOLOGY: "true"
111-
EXP_MACHINE_POOL: "true"
112111
EXP_CLUSTER_RESOURCE_SET: "true"
113112
EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION: "true"
114113
EXP_RUNTIME_SDK: "true"

docs/book/src/tasks/experimental-features/experimental-features.md

-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ One way is to set experimental variables on the clusterctl config file. For CAPI
3131
```yaml
3232
variables:
3333
EXP_CLUSTER_RESOURCE_SET: "true"
34-
EXP_MACHINE_POOL: "true"
3534
CLUSTER_TOPOLOGY: "true"
3635
EXP_RUNTIME_SDK: "true"
3736
EXP_MACHINE_SET_PREFLIGHT_CHECKS: "true"
@@ -46,7 +45,6 @@ On development environments started with `Tilt`, features can be enabled by sett
4645
```yaml
4746
kustomize_substitutions:
4847
EXP_CLUSTER_RESOURCE_SET: 'true'
49-
EXP_MACHINE_POOL: 'true'
5048
CLUSTER_TOPOLOGY: 'true'
5149
EXP_RUNTIME_SDK: 'true'
5250
EXP_MACHINE_SET_PREFLIGHT_CHECKS: 'true'

docs/book/src/tasks/experimental-features/machine-pools.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Experimental Feature: MachinePool (alpha)
1+
# Experimental Feature: MachinePool (beta)
22

33
The `MachinePool` feature provides a way to manage a set of machines by defining a common configuration, number of desired machine replicas etc. similar to `MachineDeployment`,
44
except `MachineSet` controllers are responsible for the lifecycle management of the machines for `MachineDeployment`, whereas in `MachinePools`,

docs/book/src/user/quick-start.md

-3
Original file line numberDiff line numberDiff line change
@@ -539,9 +539,6 @@ for the upgrade from v1.23 to v1.24 as we have to use different cgroupDrivers de
539539
# Enable the experimental Cluster topology feature.
540540
export CLUSTER_TOPOLOGY=true
541541
542-
# Enable the experimental Machine Pool feature
543-
export EXP_MACHINE_POOL=true
544-
545542
# Initialize the management cluster
546543
clusterctl init --infrastructure docker
547544
```

exp/internal/controllers/machinepool_controller_phases_test.go

-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3030
"k8s.io/apimachinery/pkg/types"
3131
"k8s.io/client-go/tools/record"
32-
utilfeature "k8s.io/component-base/featuregate/testing"
3332
"k8s.io/utils/ptr"
3433
ctrl "sigs.k8s.io/controller-runtime"
3534
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -40,7 +39,6 @@ import (
4039
"sigs.k8s.io/cluster-api/controllers/external"
4140
"sigs.k8s.io/cluster-api/controllers/remote"
4241
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
43-
"sigs.k8s.io/cluster-api/feature"
4442
"sigs.k8s.io/cluster-api/internal/test/builder"
4543
"sigs.k8s.io/cluster-api/internal/util/ssa"
4644
"sigs.k8s.io/cluster-api/util/kubeconfig"
@@ -1236,10 +1234,6 @@ func TestReconcileMachinePoolInfrastructure(t *testing.T) {
12361234

12371235
func TestReconcileMachinePoolMachines(t *testing.T) {
12381236
t.Run("Reconcile MachinePool Machines", func(t *testing.T) {
1239-
// NOTE: MachinePool feature flag is disabled by default, thus preventing to create or update MachinePool.
1240-
// Enabling the feature flag temporarily for this test.
1241-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
1242-
12431237
g := NewWithT(t)
12441238

12451239
ns, err := env.CreateNamespace(ctx, "test-machinepool-machines")

exp/internal/webhooks/machinepool_test.go

-18
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,17 @@ import (
2323
. "github.com/onsi/gomega"
2424
corev1 "k8s.io/api/core/v1"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26-
utilfeature "k8s.io/component-base/featuregate/testing"
2726
"k8s.io/utils/ptr"
2827
ctrl "sigs.k8s.io/controller-runtime"
2928

3029
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
3130
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
32-
"sigs.k8s.io/cluster-api/feature"
3331
"sigs.k8s.io/cluster-api/internal/webhooks/util"
3432
)
3533

3634
var ctx = ctrl.SetupSignalHandler()
3735

3836
func TestMachinePoolDefault(t *testing.T) {
39-
// NOTE: MachinePool feature flag is disabled by default, thus preventing to create or update MachinePool.
40-
// Enabling the feature flag temporarily for this test.
41-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
42-
4337
g := NewWithT(t)
4438

4539
mp := &expv1.MachinePool{
@@ -68,9 +62,6 @@ func TestMachinePoolDefault(t *testing.T) {
6862
}
6963

7064
func TestMachinePoolBootstrapValidation(t *testing.T) {
71-
// NOTE: MachinePool feature flag is disabled by default, thus preventing to create or update MachinePool.
72-
// Enabling the feature flag temporarily for this test.
73-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
7465
tests := []struct {
7566
name string
7667
bootstrap clusterv1.Bootstrap
@@ -127,9 +118,6 @@ func TestMachinePoolBootstrapValidation(t *testing.T) {
127118
}
128119

129120
func TestMachinePoolNamespaceValidation(t *testing.T) {
130-
// NOTE: MachinePool feature flag is disabled by default, thus preventing to create or update MachinePool.
131-
// Enabling the feature flag temporarily for this test.
132-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
133121
tests := []struct {
134122
name string
135123
expectErr bool
@@ -204,9 +192,6 @@ func TestMachinePoolNamespaceValidation(t *testing.T) {
204192
}
205193

206194
func TestMachinePoolClusterNameImmutable(t *testing.T) {
207-
// NOTE: MachinePool feature flag is disabled by default, thus preventing to create or update MachinePool.
208-
// Enabling the feature flag temporarily for this test.
209-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
210195
tests := []struct {
211196
name string
212197
oldClusterName string
@@ -266,9 +251,6 @@ func TestMachinePoolClusterNameImmutable(t *testing.T) {
266251
}
267252

268253
func TestMachinePoolVersionValidation(t *testing.T) {
269-
// NOTE: MachinePool feature flag is disabled by default, thus preventing to create or update MachinePool.
270-
// Enabling the feature flag temporarily for this test.
271-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
272254
tests := []struct {
273255
name string
274256
expectErr bool

feature/feature.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const (
3232
// MachinePool is a feature gate for MachinePool functionality.
3333
//
3434
// alpha: v0.3
35+
// beta: v1.7
3536
MachinePool featuregate.Feature = "MachinePool"
3637

3738
// ClusterResourceSet is a feature gate for the ClusterResourceSet functionality.
@@ -70,7 +71,7 @@ func init() {
7071
// To add a new feature, define a key for it above and add it here.
7172
var defaultClusterAPIFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
7273
// Every feature should be initiated here:
73-
MachinePool: {Default: false, PreRelease: featuregate.Alpha},
74+
MachinePool: {Default: true, PreRelease: featuregate.Beta},
7475
ClusterResourceSet: {Default: true, PreRelease: featuregate.Beta},
7576
ClusterTopology: {Default: false, PreRelease: featuregate.Alpha},
7677
KubeadmBootstrapFormatIgnition: {Default: false, PreRelease: featuregate.Alpha},

internal/controllers/topology/cluster/cluster_controller_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ var (
6464

6565
func TestClusterReconciler_reconcileNewlyCreatedCluster(t *testing.T) {
6666
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.ClusterTopology, true)()
67-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
6867
g := NewWithT(t)
6968
timeout := 5 * time.Second
7069

@@ -113,7 +112,6 @@ func TestClusterReconciler_reconcileNewlyCreatedCluster(t *testing.T) {
113112

114113
func TestClusterReconciler_reconcileMultipleClustersFromOneClass(t *testing.T) {
115114
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.ClusterTopology, true)()
116-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
117115

118116
g := NewWithT(t)
119117
timeout := 5 * time.Second
@@ -166,7 +164,6 @@ func TestClusterReconciler_reconcileMultipleClustersFromOneClass(t *testing.T) {
166164

167165
func TestClusterReconciler_reconcileUpdateOnClusterTopology(t *testing.T) {
168166
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.ClusterTopology, true)()
169-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
170167
g := NewWithT(t)
171168
timeout := 300 * time.Second
172169

@@ -258,7 +255,6 @@ func TestClusterReconciler_reconcileUpdateOnClusterTopology(t *testing.T) {
258255

259256
func TestClusterReconciler_reconcileUpdatesOnClusterClass(t *testing.T) {
260257
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.ClusterTopology, true)()
261-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
262258
g := NewWithT(t)
263259
timeout := 5 * time.Second
264260

@@ -359,7 +355,6 @@ func TestClusterReconciler_reconcileUpdatesOnClusterClass(t *testing.T) {
359355

360356
func TestClusterReconciler_reconcileClusterClassRebase(t *testing.T) {
361357
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.ClusterTopology, true)()
362-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
363358
g := NewWithT(t)
364359
timeout := 30 * time.Second
365360

@@ -441,7 +436,6 @@ func TestClusterReconciler_reconcileClusterClassRebase(t *testing.T) {
441436

442437
func TestClusterReconciler_reconcileDelete(t *testing.T) {
443438
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.RuntimeSDK, true)()
444-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
445439

446440
catalog := runtimecatalog.New()
447441
_ = runtimehooksv1.AddToCatalog(catalog)
@@ -595,7 +589,6 @@ func TestClusterReconciler_reconcileDelete(t *testing.T) {
595589
// In this case deletion of the ClusterClass should be blocked by the webhook.
596590
func TestClusterReconciler_deleteClusterClass(t *testing.T) {
597591
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.ClusterTopology, true)()
598-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
599592
g := NewWithT(t)
600593
timeout := 5 * time.Second
601594

internal/controllers/topology/cluster/reconcile_state_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
"k8s.io/apimachinery/pkg/runtime"
3434
"k8s.io/apimachinery/pkg/types"
3535
"k8s.io/apimachinery/pkg/util/intstr"
36-
utilfeature "k8s.io/component-base/featuregate/testing"
3736
"k8s.io/utils/ptr"
3837
"sigs.k8s.io/controller-runtime/pkg/client"
3938
"sigs.k8s.io/controller-runtime/pkg/client/fake"
@@ -45,7 +44,6 @@ import (
4544
runtimev1 "sigs.k8s.io/cluster-api/exp/runtime/api/v1alpha1"
4645
runtimecatalog "sigs.k8s.io/cluster-api/exp/runtime/catalog"
4746
runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1"
48-
"sigs.k8s.io/cluster-api/feature"
4947
"sigs.k8s.io/cluster-api/internal/contract"
5048
"sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/scope"
5149
"sigs.k8s.io/cluster-api/internal/controllers/topology/cluster/structuredmerge"
@@ -2196,8 +2194,6 @@ func TestReconcileMachineDeployments(t *testing.T) {
21962194
}
21972195

21982196
func TestReconcileMachinePools(t *testing.T) {
2199-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, feature.MachinePool, true)()
2200-
22012197
g := NewWithT(t)
22022198

22032199
infrastructureMachinePool1 := builder.TestInfrastructureMachinePool(metav1.NamespaceDefault, "infrastructure-machinepool-1").Build()

test/infrastructure/docker/config/manager/manager.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
- "--leader-elect"
2121
- "--diagnostics-address=${CAPI_DIAGNOSTICS_ADDRESS:=:8443}"
2222
- "--insecure-diagnostics=${CAPI_INSECURE_DIAGNOSTICS:=false}"
23-
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=false},ClusterTopology=${CLUSTER_TOPOLOGY:=false}"
23+
- "--feature-gates=MachinePool=${EXP_MACHINE_POOL:=true},ClusterTopology=${CLUSTER_TOPOLOGY:=false}"
2424
image: controller:latest
2525
name: manager
2626
env:

0 commit comments

Comments
 (0)