Skip to content

Commit f42caa3

Browse files
authored
Merge pull request #3631 from mboersma/cp-3612-to-release-1.9
[release-1.9] Update CAPI to v1.4.3
2 parents 9b94e27 + 4652e64 commit f42caa3

File tree

10 files changed

+120
-52
lines changed

10 files changed

+120
-52
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KUBECTL) $(KIND) ## Create
285285
./hack/create-custom-cloud-provider-config.sh
286286

287287
# Deploy CAPI
288-
curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.2/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -
288+
curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.3/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -
289289

290290
# Deploy CAPZ
291291
$(KIND) load docker-image $(CONTROLLER_IMG)-$(ARCH):$(TAG) --name=$(KIND_CLUSTER_NAME)

Tiltfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ settings = {
1919
"deploy_cert_manager": True,
2020
"preload_images_for_kind": True,
2121
"kind_cluster_name": "capz",
22-
"capi_version": "v1.4.2",
23-
"cert_manager_version": "v1.11.1",
22+
"capi_version": "v1.4.3",
23+
"cert_manager_version": "v1.12.1",
2424
"kubernetes_version": "v1.24.6",
2525
"aks_kubernetes_version": "v1.24.6",
2626
"flatcar_version": "3374.2.1",

azure/scope/machine.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ import (
4242
"sigs.k8s.io/cluster-api-provider-azure/util/futures"
4343
"sigs.k8s.io/cluster-api-provider-azure/util/tele"
4444
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
45-
"sigs.k8s.io/cluster-api/controllers/noderefutil"
4645
capierrors "sigs.k8s.io/cluster-api/errors"
4746
"sigs.k8s.io/cluster-api/util"
4847
"sigs.k8s.io/cluster-api/util/conditions"
@@ -451,22 +450,18 @@ func (m *MachineScope) Role() string {
451450
return infrav1.Node
452451
}
453452

454-
// GetVMID returns the AzureMachine instance id by parsing Spec.FakeProviderID.
453+
// GetVMID returns the AzureMachine instance id by parsing the scope's providerID.
455454
func (m *MachineScope) GetVMID() string {
456-
parsed, err := noderefutil.NewProviderID(m.ProviderID())
455+
resourceID, err := azure.ParseResourceID(m.ProviderID())
457456
if err != nil {
458457
return ""
459458
}
460-
return parsed.ID()
459+
return resourceID.Name
461460
}
462461

463462
// ProviderID returns the AzureMachine providerID from the spec.
464463
func (m *MachineScope) ProviderID() string {
465-
parsed, err := noderefutil.NewProviderID(pointer.StringDeref(m.AzureMachine.Spec.ProviderID, ""))
466-
if err != nil {
467-
return ""
468-
}
469-
return parsed.String()
464+
return pointer.StringDeref(m.AzureMachine.Spec.ProviderID, "")
470465
}
471466

472467
// AvailabilitySetSpec returns the availability set spec for this machine if available.

azure/scope/machine_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func TestMachineScope_Name(t *testing.T) {
5858
Name: "machine-with-a-long-name",
5959
},
6060
Spec: infrav1.AzureMachineSpec{
61-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
61+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
6262
OSDisk: infrav1.OSDisk{
6363
OSType: "Windows",
6464
},
@@ -164,7 +164,7 @@ func TestMachineScope_GetVMID(t *testing.T) {
164164
Name: "not-this-name",
165165
},
166166
Spec: infrav1.AzureMachineSpec{
167-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
167+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
168168
},
169169
},
170170
},
@@ -209,21 +209,21 @@ func TestMachineScope_ProviderID(t *testing.T) {
209209
Name: "not-this-name",
210210
},
211211
Spec: infrav1.AzureMachineSpec{
212-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
212+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
213213
},
214214
},
215215
},
216-
want: "azure://compute/virtual-machines/machine-name",
216+
want: "azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name",
217217
},
218218
{
219-
name: "returns empty if provider ID is invalid",
219+
name: "returns empty if provider ID is empty",
220220
machineScope: MachineScope{
221221
AzureMachine: &infrav1.AzureMachine{
222222
ObjectMeta: metav1.ObjectMeta{
223223
Name: "machine-name",
224224
},
225225
Spec: infrav1.AzureMachineSpec{
226-
ProviderID: pointer.String("foo"),
226+
ProviderID: pointer.String(""),
227227
},
228228
},
229229
},
@@ -1725,7 +1725,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
17251725
Name: "machine",
17261726
},
17271727
Spec: infrav1.AzureMachineSpec{
1728-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
1728+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
17291729
NetworkInterfaces: []infrav1.NetworkInterface{{
17301730
SubnetName: "subnet1",
17311731
PrivateIPConfigs: 1,
@@ -1829,7 +1829,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
18291829
Name: "machine",
18301830
},
18311831
Spec: infrav1.AzureMachineSpec{
1832-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
1832+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
18331833
NetworkInterfaces: []infrav1.NetworkInterface{{
18341834
SubnetName: "subnet1",
18351835
PrivateIPConfigs: 1,
@@ -1945,7 +1945,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
19451945
Name: "machine",
19461946
},
19471947
Spec: infrav1.AzureMachineSpec{
1948-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
1948+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
19491949
NetworkInterfaces: []infrav1.NetworkInterface{{
19501950
SubnetName: "subnet1",
19511951
PrivateIPConfigs: 1,
@@ -2049,7 +2049,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
20492049
Name: "machine",
20502050
},
20512051
Spec: infrav1.AzureMachineSpec{
2052-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
2052+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
20532053
NetworkInterfaces: []infrav1.NetworkInterface{{
20542054
SubnetName: "subnet1",
20552055
PrivateIPConfigs: 1,
@@ -2160,7 +2160,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
21602160
Name: "machine",
21612161
},
21622162
Spec: infrav1.AzureMachineSpec{
2163-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
2163+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
21642164
NetworkInterfaces: []infrav1.NetworkInterface{{
21652165
SubnetName: "subnet1",
21662166
PrivateIPConfigs: 1,
@@ -2267,7 +2267,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
22672267
Name: "machine",
22682268
},
22692269
Spec: infrav1.AzureMachineSpec{
2270-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
2270+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
22712271
NetworkInterfaces: []infrav1.NetworkInterface{{
22722272
SubnetName: "subnet1",
22732273
PrivateIPConfigs: 1,
@@ -2374,7 +2374,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
23742374
Name: "machine",
23752375
},
23762376
Spec: infrav1.AzureMachineSpec{
2377-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
2377+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
23782378
NetworkInterfaces: []infrav1.NetworkInterface{{
23792379
SubnetName: "subnet1",
23802380
PrivateIPConfigs: 1,
@@ -2482,7 +2482,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
24822482
Name: "machine",
24832483
},
24842484
Spec: infrav1.AzureMachineSpec{
2485-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
2485+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
24862486
NetworkInterfaces: []infrav1.NetworkInterface{
24872487
{
24882488
SubnetName: "subnet1",
@@ -2619,7 +2619,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
26192619
Name: "machine",
26202620
},
26212621
Spec: infrav1.AzureMachineSpec{
2622-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
2622+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
26232623
AllocatePublicIP: true,
26242624
NetworkInterfaces: []infrav1.NetworkInterface{
26252625
{
@@ -2757,7 +2757,7 @@ func TestMachineScope_NICSpecs(t *testing.T) {
27572757
Name: "machine",
27582758
},
27592759
Spec: infrav1.AzureMachineSpec{
2760-
ProviderID: pointer.String("azure://compute/virtual-machines/machine-name"),
2760+
ProviderID: pointer.String("azure:///subscriptions/1234-5678/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-name"),
27612761
NetworkInterfaces: []infrav1.NetworkInterface{
27622762
{
27632763
SubnetName: "subnet1",

azure/scope/machinepool.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import (
3939
"sigs.k8s.io/cluster-api-provider-azure/util/futures"
4040
"sigs.k8s.io/cluster-api-provider-azure/util/tele"
4141
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
42-
"sigs.k8s.io/cluster-api/controllers/noderefutil"
4342
capierrors "sigs.k8s.io/cluster-api/errors"
4443
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
4544
"sigs.k8s.io/cluster-api/util/annotations"
@@ -153,13 +152,13 @@ func (m *MachinePoolScope) Name() string {
153152
return m.AzureMachinePool.Name
154153
}
155154

156-
// ProviderID returns the AzureMachinePool ID by parsing Spec.FakeProviderID.
155+
// ProviderID returns the AzureMachinePool ID by parsing Spec.ProviderID.
157156
func (m *MachinePoolScope) ProviderID() string {
158-
parsed, err := noderefutil.NewProviderID(m.AzureMachinePool.Spec.ProviderID)
157+
resourceID, err := azure.ParseResourceID(m.AzureMachinePool.Spec.ProviderID)
159158
if err != nil {
160159
return ""
161160
}
162-
return parsed.ID()
161+
return resourceID.Name
163162
}
164163

165164
// SetProviderID sets the AzureMachinePool providerID in spec.

azure/scope/machinepool_test.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,80 @@ func TestMachinePoolScope_Name(t *testing.T) {
9898
})
9999
}
100100
}
101+
102+
func TestMachinePoolScope_ProviderID(t *testing.T) {
103+
tests := []struct {
104+
name string
105+
machinePoolScope MachinePoolScope
106+
want string
107+
}{
108+
{
109+
name: "valid providerID",
110+
machinePoolScope: MachinePoolScope{
111+
AzureMachinePool: &infrav1exp.AzureMachinePool{
112+
Spec: infrav1exp.AzureMachinePoolSpec{
113+
ProviderID: "azure:///subscriptions/1234/resourcegroups/my-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cloud-provider-user-identity",
114+
},
115+
},
116+
},
117+
want: "cloud-provider-user-identity",
118+
},
119+
{
120+
name: "valid providerID: VMSS Flex instance",
121+
machinePoolScope: MachinePoolScope{
122+
AzureMachinePool: &infrav1exp.AzureMachinePool{
123+
Spec: infrav1exp.AzureMachinePoolSpec{
124+
ProviderID: "azure:///subscriptions/1234/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/machine-0",
125+
},
126+
},
127+
},
128+
want: "machine-0",
129+
},
130+
{
131+
name: "valid providerID: VMSS Uniform instance",
132+
machinePoolScope: MachinePoolScope{
133+
AzureMachinePool: &infrav1exp.AzureMachinePool{
134+
Spec: infrav1exp.AzureMachinePoolSpec{
135+
ProviderID: "azure:///subscriptions/1234/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/my-cluster-mp-0/virtualMachines/0",
136+
},
137+
},
138+
},
139+
want: "0",
140+
},
141+
{
142+
name: "invalid providerID: no cloud provider",
143+
machinePoolScope: MachinePoolScope{
144+
AzureMachinePool: &infrav1exp.AzureMachinePool{
145+
Spec: infrav1exp.AzureMachinePoolSpec{
146+
ProviderID: "subscriptions/123/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm",
147+
},
148+
},
149+
},
150+
want: "",
151+
},
152+
{
153+
name: "invalid providerID: incomplete URL",
154+
machinePoolScope: MachinePoolScope{
155+
AzureMachinePool: &infrav1exp.AzureMachinePool{
156+
Spec: infrav1exp.AzureMachinePoolSpec{
157+
ProviderID: "azure:///",
158+
},
159+
},
160+
},
161+
want: "",
162+
},
163+
}
164+
165+
for _, tt := range tests {
166+
t.Run(tt.name, func(t *testing.T) {
167+
got := tt.machinePoolScope.ProviderID()
168+
if got != tt.want {
169+
t.Errorf("MachinePoolScope.ProviderID() = %v, want %v", got, tt.want)
170+
}
171+
})
172+
}
173+
}
174+
101175
func TestMachinePoolScope_NetworkInterfaces(t *testing.T) {
102176
tests := []struct {
103177
name string

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ require (
4545
k8s.io/kubectl v0.26.1
4646
k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5
4747
sigs.k8s.io/cloud-provider-azure v1.26.7
48-
sigs.k8s.io/cluster-api v1.4.2
49-
sigs.k8s.io/cluster-api/test v1.4.2
48+
sigs.k8s.io/cluster-api v1.4.3
49+
sigs.k8s.io/cluster-api/test v1.4.3
5050
sigs.k8s.io/controller-runtime v0.14.5
5151
sigs.k8s.io/kind v0.18.0
5252
)
@@ -85,7 +85,7 @@ require (
8585
github.com/davecgh/go-spew v1.1.1 // indirect
8686
github.com/dimchansky/utfbom v1.1.1 // indirect
8787
github.com/docker/cli v20.10.21+incompatible // indirect
88-
github.com/docker/distribution v2.8.1+incompatible // indirect
88+
github.com/docker/distribution v2.8.2+incompatible // indirect
8989
github.com/docker/docker v20.10.24+incompatible // indirect
9090
github.com/docker/docker-credential-helpers v0.7.0 // indirect
9191
github.com/docker/go-connections v0.4.0 // indirect
@@ -224,4 +224,4 @@ require (
224224
sigs.k8s.io/yaml v1.3.0 // indirect
225225
)
226226

227-
replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.4.2
227+
replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.4.3

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ github.com/distribution/distribution/v3 v3.0.0-20221208165359-362910506bc2 h1:aB
192192
github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c=
193193
github.com/docker/cli v20.10.21+incompatible h1:qVkgyYUnOLQ98LtXBrwd/duVqPT2X4SHndOuGsfwyhU=
194194
github.com/docker/cli v20.10.21+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
195-
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
196-
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
195+
github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8=
196+
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
197197
github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE=
198198
github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
199199
github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A=
@@ -1295,10 +1295,10 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
12951295
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
12961296
sigs.k8s.io/cloud-provider-azure v1.26.7 h1:LSVRPyxeTQZPOF7z42zNZGzL1S1N5tg28RBZVy7gea4=
12971297
sigs.k8s.io/cloud-provider-azure v1.26.7/go.mod h1:UIwr0Bk4wQb77wNL9cdT4zZw6DP2AtOQ9EKRt9c5g7Q=
1298-
sigs.k8s.io/cluster-api v1.4.2 h1:hdIz0Ms2j7YaU1qBK5yF2R8ii0GcGb3jQ7EO6i3tAN8=
1299-
sigs.k8s.io/cluster-api v1.4.2/go.mod h1:IIebZTsqyXU8CHbINV2zuMh0/wykqdr+vEXxQNeteEU=
1300-
sigs.k8s.io/cluster-api/test v1.4.2 h1:uHFtn0SFOFOxIbdahLoYo4kz84yLqCmhbVLV4vsk1gQ=
1301-
sigs.k8s.io/cluster-api/test v1.4.2/go.mod h1:/64ycj3YFMW1BGVtCtfwmlVAXGN0DFTZEkIClh68Svo=
1298+
sigs.k8s.io/cluster-api v1.4.3 h1:QSeKr3qnWPtVp+EMQZQduKoi5WDwUhAtBRreEukkcy0=
1299+
sigs.k8s.io/cluster-api v1.4.3/go.mod h1:/SeFds4NXJ+Gp2etqHyoNuO6yoxTfVq6Zmd2OGxd/qM=
1300+
sigs.k8s.io/cluster-api/test v1.4.3 h1:xXhvOLp5zBKn2Yf4PQckFwxGxFrKgkgUI74ikU5Jh/c=
1301+
sigs.k8s.io/cluster-api/test v1.4.3/go.mod h1:xGTJsJkbXMNmumhErEAH/e7GmnE2sGfm/rcOzJZSdbw=
13021302
sigs.k8s.io/controller-runtime v0.14.5 h1:6xaWFqzT5KuAQ9ufgUaj1G/+C4Y1GRkhrxl+BJ9i+5s=
13031303
sigs.k8s.io/controller-runtime v0.14.5/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0=
13041304
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=

hack/install-cert-manager.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ source "${REPO_ROOT}/hack/common-vars.sh"
5454
make --directory="${REPO_ROOT}" "${KUBECTL##*/}"
5555

5656
## Install cert manager and wait for availability
57-
"${KUBECTL}" apply -f https://github.com/jetstack/cert-manager/releases/download/v1.11.1/cert-manager.yaml
57+
"${KUBECTL}" apply -f https://github.com/jetstack/cert-manager/releases/download/v1.12.1/cert-manager.yaml
5858
"${KUBECTL}" wait --for=condition=Available --timeout=5m -n cert-manager deployment/cert-manager
5959
"${KUBECTL}" wait --for=condition=Available --timeout=5m -n cert-manager deployment/cert-manager-cainjector
6060
"${KUBECTL}" wait --for=condition=Available --timeout=5m -n cert-manager deployment/cert-manager-webhook

0 commit comments

Comments
 (0)