Skip to content

Commit 64eaa63

Browse files
authored
Merge pull request #4740 from mboersma/bump-capi-v1.7.0
Bump CAPI to v1.7.0
2 parents 1d6e49b + e5c7bed commit 64eaa63

File tree

18 files changed

+273
-611
lines changed

18 files changed

+273
-611
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ CONTROLLER_GEN_VER := v0.14.0
7373
CONTROLLER_GEN_BIN := controller-gen
7474
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER)
7575

76-
CONVERSION_GEN_VER := v0.28.0
76+
CONVERSION_GEN_VER := v0.29.2
7777
CONVERSION_GEN_BIN := conversion-gen
7878
CONVERSION_GEN := $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN)-$(CONVERSION_GEN_VER)
7979

@@ -300,7 +300,7 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KUBECTL) $(KIND) ## Create
300300
./hack/create-custom-cloud-provider-config.sh
301301

302302
# Deploy CAPI
303-
timeout --foreground 300 bash -c "until curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.4/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done"
303+
timeout --foreground 300 bash -c "until curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.7.0/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done"
304304

305305
# Deploy CAAPH
306306
timeout --foreground 300 bash -c "until curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm/releases/download/v0.1.0-alpha.10/addon-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -; do sleep 5; done"

Tiltfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ settings = {
2020
"deploy_cert_manager": True,
2121
"preload_images_for_kind": True,
2222
"kind_cluster_name": "capz",
23-
"capi_version": "v1.6.4",
23+
"capi_version": "v1.7.0",
2424
"cert_manager_version": "v1.14.4",
2525
"kubernetes_version": "v1.28.3",
2626
"aks_kubernetes_version": "v1.28.3",

api/v1beta1/azuremanagedcluster_webhook_test.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ import (
2828
)
2929

3030
func TestAzureManagedCluster_ValidateUpdate(t *testing.T) {
31-
// NOTE: AzureManagedCluster is behind AKS feature gate flag; the webhook
32-
// must prevent creating new objects in case the feature flag is disabled.
33-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()
34-
3531
tests := []struct {
3632
name string
3733
oldAMC *AzureManagedCluster
@@ -95,10 +91,6 @@ func TestAzureManagedCluster_ValidateUpdate(t *testing.T) {
9591
}
9692

9793
func TestAzureManagedCluster_ValidateCreate(t *testing.T) {
98-
// NOTE: AzureManagedCluster is behind AKS feature gate flag; the webhook
99-
// must prevent creating new objects in case the feature flag is disabled.
100-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()
101-
10294
tests := []struct {
10395
name string
10496
oldAMC *AzureManagedCluster
@@ -143,27 +135,34 @@ func TestAzureManagedCluster_ValidateCreate(t *testing.T) {
143135

144136
func TestAzureManagedCluster_ValidateCreateFailure(t *testing.T) {
145137
tests := []struct {
146-
name string
147-
amc *AzureManagedCluster
148-
deferFunc func()
138+
name string
139+
amc *AzureManagedCluster
140+
deferFunc func()
141+
expectError bool
149142
}{
150143
{
151-
name: "feature gate explicitly disabled",
152-
amc: getKnownValidAzureManagedCluster(),
153-
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
144+
name: "feature gate explicitly disabled",
145+
amc: getKnownValidAzureManagedCluster(),
146+
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
147+
expectError: true,
154148
},
155149
{
156-
name: "feature gate implicitly disabled",
157-
amc: getKnownValidAzureManagedCluster(),
158-
deferFunc: func() {},
150+
name: "feature gate implicitly enabled",
151+
amc: getKnownValidAzureManagedCluster(),
152+
deferFunc: func() {},
153+
expectError: false,
159154
},
160155
}
161156
for _, tc := range tests {
162157
t.Run(tc.name, func(t *testing.T) {
163158
defer tc.deferFunc()
164159
g := NewWithT(t)
165160
_, err := tc.amc.ValidateCreate()
166-
g.Expect(err).To(HaveOccurred())
161+
if tc.expectError {
162+
g.Expect(err).To(HaveOccurred())
163+
} else {
164+
g.Expect(err).NotTo(HaveOccurred())
165+
}
167166
})
168167
}
169168
}

api/v1beta1/azuremanagedcontrolplane_webhook_test.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,6 @@ func TestValidateAutoScalerProfile(t *testing.T) {
476476
}
477477

478478
func TestValidatingWebhook(t *testing.T) {
479-
// NOTE: AzureManageControlPlane is behind AKS feature gate flag; the webhook
480-
// must prevent creating new objects in case the feature flag is disabled.
481-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()
482479
tests := []struct {
483480
name string
484481
amcp AzureManagedControlPlane
@@ -1379,10 +1376,6 @@ func TestValidatingWebhook(t *testing.T) {
13791376
}
13801377

13811378
func TestAzureManagedControlPlane_ValidateCreate(t *testing.T) {
1382-
// NOTE: AzureManageControlPlane is behind AKS feature gate flag; the webhook
1383-
// must prevent creating new objects in case the feature flag is disabled.
1384-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()
1385-
13861379
tests := []struct {
13871380
name string
13881381
amcp *AzureManagedControlPlane
@@ -1637,19 +1630,22 @@ func TestAzureManagedControlPlane_ValidateCreate(t *testing.T) {
16371630

16381631
func TestAzureManagedControlPlane_ValidateCreateFailure(t *testing.T) {
16391632
tests := []struct {
1640-
name string
1641-
amcp *AzureManagedControlPlane
1642-
deferFunc func()
1633+
name string
1634+
amcp *AzureManagedControlPlane
1635+
deferFunc func()
1636+
expectError bool
16431637
}{
16441638
{
1645-
name: "feature gate explicitly disabled",
1646-
amcp: getKnownValidAzureManagedControlPlane(),
1647-
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
1639+
name: "feature gate explicitly disabled",
1640+
amcp: getKnownValidAzureManagedControlPlane(),
1641+
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
1642+
expectError: true,
16481643
},
16491644
{
1650-
name: "feature gate implicitly disabled",
1651-
amcp: getKnownValidAzureManagedControlPlane(),
1652-
deferFunc: func() {},
1645+
name: "feature gate implicitly enabled",
1646+
amcp: getKnownValidAzureManagedControlPlane(),
1647+
deferFunc: func() {},
1648+
expectError: false,
16531649
},
16541650
}
16551651
client := mockClient{ReturnError: false}
@@ -1661,7 +1657,11 @@ func TestAzureManagedControlPlane_ValidateCreateFailure(t *testing.T) {
16611657
Client: client,
16621658
}
16631659
_, err := mcpw.ValidateCreate(context.Background(), tc.amcp)
1664-
g.Expect(err).To(HaveOccurred())
1660+
if tc.expectError {
1661+
g.Expect(err).To(HaveOccurred())
1662+
} else {
1663+
g.Expect(err).NotTo(HaveOccurred())
1664+
}
16651665
})
16661666
}
16671667
}
@@ -3219,7 +3219,6 @@ func getAMCPMetaData() metav1.ObjectMeta {
32193219
}
32203220

32213221
func TestAzureManagedClusterSecurityProfileValidateCreate(t *testing.T) {
3222-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()
32233222
testsCreate := []struct {
32243223
name string
32253224
amcp *AzureManagedControlPlane

api/v1beta1/azuremanagedmachinepool_webhook_test.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,6 @@ func TestAzureManagedMachinePoolUpdatingWebhook(t *testing.T) {
654654
}
655655

656656
func TestAzureManagedMachinePool_ValidateCreate(t *testing.T) {
657-
// NOTE: AzureManagedMachinePool is behind AKS feature gate flag; the webhook
658-
// must prevent creating new objects in case the feature flag is disabled.
659-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()
660657
tests := []struct {
661658
name string
662659
ammp *AzureManagedMachinePool
@@ -1310,19 +1307,22 @@ func TestAzureManagedMachinePool_ValidateCreate(t *testing.T) {
13101307

13111308
func TestAzureManagedMachinePool_ValidateCreateFailure(t *testing.T) {
13121309
tests := []struct {
1313-
name string
1314-
ammp *AzureManagedMachinePool
1315-
deferFunc func()
1310+
name string
1311+
ammp *AzureManagedMachinePool
1312+
deferFunc func()
1313+
expectError bool
13161314
}{
13171315
{
1318-
name: "feature gate explicitly disabled",
1319-
ammp: getKnownValidAzureManagedMachinePool(),
1320-
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
1316+
name: "feature gate explicitly disabled",
1317+
ammp: getKnownValidAzureManagedMachinePool(),
1318+
deferFunc: utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, false),
1319+
expectError: true,
13211320
},
13221321
{
1323-
name: "feature gate implicitly disabled",
1324-
ammp: getKnownValidAzureManagedMachinePool(),
1325-
deferFunc: func() {},
1322+
name: "feature gate implicitly enabled",
1323+
ammp: getKnownValidAzureManagedMachinePool(),
1324+
deferFunc: func() {},
1325+
expectError: false,
13261326
},
13271327
}
13281328
for _, tc := range tests {
@@ -1331,7 +1331,11 @@ func TestAzureManagedMachinePool_ValidateCreateFailure(t *testing.T) {
13311331
g := NewWithT(t)
13321332
mw := &azureManagedMachinePoolWebhook{}
13331333
_, err := mw.ValidateCreate(context.Background(), tc.ammp)
1334-
g.Expect(err).To(HaveOccurred())
1334+
if tc.expectError {
1335+
g.Expect(err).To(HaveOccurred())
1336+
} else {
1337+
g.Expect(err).NotTo(HaveOccurred())
1338+
}
13351339
})
13361340
}
13371341
}

controllers/asosecret_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ func (asos *ASOSecretReconciler) Reconcile(ctx context.Context, req ctrl.Request
226226

227227
// Return early if the ASO Secret Owner(AzureCluster or AzureManagedControlPlane) or Cluster is paused.
228228
if annotations.IsPaused(cluster, asoSecretOwner) {
229-
log.Info(fmt.Sprintf("%s or linked Cluster is marked as paused. Won't reconcile", asoSecretOwner.GetObjectKind()))
229+
log.Info(fmt.Sprintf("%T or linked Cluster is marked as paused. Won't reconcile", asoSecretOwner))
230230
asos.Recorder.Eventf(asoSecretOwner, corev1.EventTypeNormal, "ClusterPaused",
231-
fmt.Sprintf("%s or linked Cluster is marked as paused. Won't reconcile", asoSecretOwner.GetObjectKind().GroupVersionKind().Kind))
231+
fmt.Sprintf("%T or linked Cluster is marked as paused. Won't reconcile", asoSecretOwner))
232232
return ctrl.Result{}, nil
233233
}
234234

controllers/helpers_test.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,13 @@ import (
3434
"k8s.io/apimachinery/pkg/runtime"
3535
"k8s.io/apimachinery/pkg/types"
3636
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
37-
utilfeature "k8s.io/component-base/featuregate/testing"
3837
"k8s.io/utils/ptr"
3938
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
4039
"sigs.k8s.io/cluster-api-provider-azure/azure/scope"
4140
"sigs.k8s.io/cluster-api-provider-azure/internal/test/mock_log"
4241
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
4342
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
4443
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
45-
capifeature "sigs.k8s.io/cluster-api/feature"
4644
"sigs.k8s.io/controller-runtime/pkg/client"
4745
"sigs.k8s.io/controller-runtime/pkg/client/fake"
4846
"sigs.k8s.io/controller-runtime/pkg/event"
@@ -110,7 +108,6 @@ func TestGetCloudProviderConfig(t *testing.T) {
110108
azureCluster *infrav1.AzureCluster
111109
identityType infrav1.VMIdentity
112110
identityID string
113-
machinePoolFeature bool
114111
expectedControlPlaneConfig string
115112
expectedWorkerNodeConfig string
116113
}{
@@ -161,7 +158,6 @@ func TestGetCloudProviderConfig(t *testing.T) {
161158
cluster: cluster,
162159
azureCluster: azureCluster,
163160
identityType: infrav1.VMIdentityNone,
164-
machinePoolFeature: true,
165161
expectedControlPlaneConfig: vmssCloudConfig,
166162
expectedWorkerNodeConfig: vmssCloudConfig,
167163
},
@@ -173,9 +169,6 @@ func TestGetCloudProviderConfig(t *testing.T) {
173169

174170
for name, tc := range cases {
175171
t.Run(name, func(t *testing.T) {
176-
if tc.machinePoolFeature {
177-
defer utilfeature.SetFeatureGateDuringTest(t, capifeature.Gates, capifeature.MachinePool, true)()
178-
}
179172
fakeIdentity := &infrav1.AzureClusterIdentity{
180173
ObjectMeta: metav1.ObjectMeta{
181174
Name: "fake-identity",
@@ -532,7 +525,8 @@ const (
532525
"loadBalancerName": "",
533526
"maximumLoadBalancerRuleCount": 250,
534527
"useManagedIdentityExtension": false,
535-
"useInstanceMetadata": true
528+
"useInstanceMetadata": true,
529+
"enableVmssFlexNodes": true
536530
}`
537531
//nolint:gosec // Ignore "G101: Potential hardcoded credentials" check.
538532
spWorkerNodeCloudConfig = `{
@@ -554,7 +548,8 @@ const (
554548
"loadBalancerName": "",
555549
"maximumLoadBalancerRuleCount": 250,
556550
"useManagedIdentityExtension": false,
557-
"useInstanceMetadata": true
551+
"useInstanceMetadata": true,
552+
"enableVmssFlexNodes": true
558553
}`
559554

560555
systemAssignedControlPlaneCloudConfig = `{
@@ -574,7 +569,8 @@ const (
574569
"loadBalancerName": "",
575570
"maximumLoadBalancerRuleCount": 250,
576571
"useManagedIdentityExtension": true,
577-
"useInstanceMetadata": true
572+
"useInstanceMetadata": true,
573+
"enableVmssFlexNodes": true
578574
}`
579575
systemAssignedWorkerNodeCloudConfig = `{
580576
"cloud": "AzurePublicCloud",
@@ -593,7 +589,8 @@ const (
593589
"loadBalancerName": "",
594590
"maximumLoadBalancerRuleCount": 250,
595591
"useManagedIdentityExtension": true,
596-
"useInstanceMetadata": true
592+
"useInstanceMetadata": true,
593+
"enableVmssFlexNodes": true
597594
}`
598595

599596
userAssignedControlPlaneCloudConfig = `{
@@ -614,6 +611,7 @@ const (
614611
"maximumLoadBalancerRuleCount": 250,
615612
"useManagedIdentityExtension": true,
616613
"useInstanceMetadata": true,
614+
"enableVmssFlexNodes": true,
617615
"userAssignedIdentityID": "foobar"
618616
}`
619617
userAssignedWorkerNodeCloudConfig = `{
@@ -634,6 +632,7 @@ const (
634632
"maximumLoadBalancerRuleCount": 250,
635633
"useManagedIdentityExtension": true,
636634
"useInstanceMetadata": true,
635+
"enableVmssFlexNodes": true,
637636
"userAssignedIdentityID": "foobar"
638637
}`
639638
spCustomVnetControlPlaneCloudConfig = `{
@@ -655,7 +654,8 @@ const (
655654
"loadBalancerName": "",
656655
"maximumLoadBalancerRuleCount": 250,
657656
"useManagedIdentityExtension": false,
658-
"useInstanceMetadata": true
657+
"useInstanceMetadata": true,
658+
"enableVmssFlexNodes": true
659659
}`
660660
spCustomVnetWorkerNodeCloudConfig = `{
661661
"cloud": "AzurePublicCloud",
@@ -676,7 +676,8 @@ const (
676676
"loadBalancerName": "",
677677
"maximumLoadBalancerRuleCount": 250,
678678
"useManagedIdentityExtension": false,
679-
"useInstanceMetadata": true
679+
"useInstanceMetadata": true,
680+
"enableVmssFlexNodes": true
680681
}`
681682
rateLimitsControlPlaneCloudConfig = `{
682683
"cloud": "AzurePublicCloud",
@@ -698,6 +699,7 @@ const (
698699
"maximumLoadBalancerRuleCount": 250,
699700
"useManagedIdentityExtension": false,
700701
"useInstanceMetadata": true,
702+
"enableVmssFlexNodes": true,
701703
"cloudProviderRateLimit": true,
702704
"cloudProviderRateLimitQPS": 1.2,
703705
"loadBalancerRateLimit": {
@@ -724,6 +726,7 @@ const (
724726
"maximumLoadBalancerRuleCount": 250,
725727
"useManagedIdentityExtension": false,
726728
"useInstanceMetadata": true,
729+
"enableVmssFlexNodes": true,
727730
"cloudProviderRateLimit": true,
728731
"cloudProviderRateLimitQPS": 1.2,
729732
"loadBalancerRateLimit": {
@@ -750,6 +753,7 @@ const (
750753
"maximumLoadBalancerRuleCount": 250,
751754
"useManagedIdentityExtension": false,
752755
"useInstanceMetadata": true,
756+
"enableVmssFlexNodes": true,
753757
"cloudProviderBackoff": true,
754758
"cloudProviderBackoffRetries": 1,
755759
"cloudProviderBackoffExponent": 1.2000000000000002,

exp/api/v1beta1/azuremachinepool_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ import (
2020
"testing"
2121

2222
"github.com/onsi/gomega"
23-
utilfeature "k8s.io/component-base/featuregate/testing"
2423
"k8s.io/utils/ptr"
2524
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
2625
infrav1exp "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1"
27-
"sigs.k8s.io/cluster-api-provider-azure/feature"
28-
capifeature "sigs.k8s.io/cluster-api/feature"
2926
)
3027

3128
func TestAzureMachinePool_Validate(t *testing.T) {
@@ -213,9 +210,6 @@ func TestAzureMachinePool_Validate(t *testing.T) {
213210
c := c
214211
t.Run(c.Name, func(t *testing.T) {
215212
// Don't add t.Parallel() here or the test will fail.
216-
// NOTE: AzureMachinePool is behind MachinePool feature gate flag; the webhook
217-
// must prevent creating new objects in case the feature flag is disabled.
218-
defer utilfeature.SetFeatureGateDuringTest(t, feature.Gates, capifeature.MachinePool, true)()
219213
g := gomega.NewGomegaWithT(t)
220214
amp := c.Factory(g)
221215
actualErr := amp.Validate(nil, nil)

0 commit comments

Comments
 (0)