Skip to content

Commit dc25710

Browse files
authored
🌱 Prepare main branch for v1.12 development (#12723)
* Prepare main branch for v1.12 development * test: fix MachinePool on upgrades to use correct struct for infrastructureRef * review fixes * fix e2e
1 parent 76e69e3 commit dc25710

File tree

17 files changed

+313
-254
lines changed

17 files changed

+313
-254
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ hack/tools/bin
1212

1313
# E2E test templates
1414
test/e2e/data/infrastructure-docker/**/cluster-template*.yaml
15-
!test/e2e/data/infrastructure-docker/**/clusterclass-quick-start.yaml
1615
!test/e2e/data/infrastructure-docker/**/clusterclass-quick-start-runtimesdk.yaml
1716
!test/e2e/data/infrastructure-docker/**/clusterclass-quick-start-runtimesdk-v1beta1.yaml
1817
!test/e2e/data/infrastructure-docker/**/cluster-template-in-memory.yaml
1918
!test/e2e/data/infrastructure-docker/**/clusterclass-in-memory.yaml
2019
test/e2e/data/infrastructure-docker/**/clusterclass-*.yaml
2120
test/e2e/data/infrastructure-inmemory/**/cluster-template*.yaml
21+
!test/e2e/data/infrastructure-docker/**/clusterclass-quick-start.yaml
2222

2323
# Output of Makefile targets using sed on MacOS systems
2424
*.yaml-e

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ generate-doctoc:
562562
TRACE=$(TRACE) ./hack/generate-doctoc.sh
563563

564564
.PHONY: generate-e2e-templates
565-
generate-e2e-templates: $(KUSTOMIZE) $(addprefix generate-e2e-templates-, v0.3 v0.4 v1.5 v1.6 v1.8 v1.9 v1.10 main) ## Generate cluster templates for all versions
565+
generate-e2e-templates: $(KUSTOMIZE) $(addprefix generate-e2e-templates-, v0.3 v0.4 v1.5 v1.6 v1.9 v1.10 v1.11 main) ## Generate cluster templates for all versions
566566

567567
DOCKER_TEMPLATES := test/e2e/data/infrastructure-docker
568568

@@ -584,11 +584,6 @@ generate-e2e-templates-v1.6: $(KUSTOMIZE)
584584
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1.6/cluster-template --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1.6/cluster-template.yaml
585585
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1.6/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1.6/cluster-template-topology.yaml
586586

587-
.PHONY: generate-e2e-templates-v1.8
588-
generate-e2e-templates-v1.8: $(KUSTOMIZE)
589-
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1.8/cluster-template --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1.8/cluster-template.yaml
590-
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1.8/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1.8/cluster-template-topology.yaml
591-
592587
.PHONY: generate-e2e-templates-v1.9
593588
generate-e2e-templates-v1.9: $(KUSTOMIZE)
594589
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1.9/cluster-template --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1.9/cluster-template.yaml
@@ -599,6 +594,11 @@ generate-e2e-templates-v1.10: $(KUSTOMIZE)
599594
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1.10/cluster-template --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1.10/cluster-template.yaml
600595
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1.10/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1.10/cluster-template-topology.yaml
601596

597+
.PHONY: generate-e2e-templates-v1.11
598+
generate-e2e-templates-v1.11: $(KUSTOMIZE)
599+
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1.11/cluster-template --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1.11/cluster-template.yaml
600+
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/v1.11/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/v1.11/cluster-template-topology.yaml
601+
602602
.PHONY: generate-e2e-templates-main
603603
generate-e2e-templates-main: $(KUSTOMIZE)
604604
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template.yaml

cmd/clusterctl/hack/create-local-repository.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,30 @@
5454
providers = {
5555
'cluster-api': {
5656
'componentsFile': 'core-components.yaml',
57-
'nextVersion': 'v1.11.99',
57+
'nextVersion': 'v1.12.99',
5858
'type': 'CoreProvider',
5959
},
6060
'bootstrap-kubeadm': {
6161
'componentsFile': 'bootstrap-components.yaml',
62-
'nextVersion': 'v1.11.99',
62+
'nextVersion': 'v1.12.99',
6363
'type': 'BootstrapProvider',
6464
'configFolder': 'bootstrap/kubeadm/config/default',
6565
},
6666
'control-plane-kubeadm': {
6767
'componentsFile': 'control-plane-components.yaml',
68-
'nextVersion': 'v1.11.99',
68+
'nextVersion': 'v1.12.99',
6969
'type': 'ControlPlaneProvider',
7070
'configFolder': 'controlplane/kubeadm/config/default',
7171
},
7272
'infrastructure-docker': {
7373
'componentsFile': 'infrastructure-components-development.yaml',
74-
'nextVersion': 'v1.11.99',
74+
'nextVersion': 'v1.12.99',
7575
'type': 'InfrastructureProvider',
7676
'configFolder': 'test/infrastructure/docker/config/default',
7777
},
7878
'runtime-extension-test': {
7979
'componentsFile': 'runtime-extension-components-development.yaml',
80-
'nextVersion': 'v1.11.99',
80+
'nextVersion': 'v1.12.99',
8181
'type': 'RuntimeExtensionProvider',
8282
'configFolder': 'test/extension/config/default',
8383
},

hack/tools/internal/tilt-prepare/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const (
7171

7272
var (
7373
// Defines the default version to be used for the provider CR if no version is specified in the tilt-provider.yaml|json file.
74-
defaultProviderVersion = "v1.11.99"
74+
defaultProviderVersion = "v1.12.99"
7575

7676
// This data struct mirrors a subset of info from the providers struct in the tilt file
7777
// which is containing "hard-coded" tilt-provider.yaml files for the providers managed in the Cluster API repository.

metadata.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
77
kind: Metadata
88
releaseSeries:
9+
- major: 1
10+
minor: 12
11+
contract: v1beta2
912
- major: 1
1013
minor: 11
1114
contract: v1beta2

test/e2e/clusterctl_upgrade.go

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,16 +1006,33 @@ func calculateExpectedMachinePoolMachineCount(ctx context.Context, c client.Clie
10061006
client.MatchingLabels{clusterv1.ClusterNameLabel: workloadClusterName},
10071007
); err == nil {
10081008
for _, mp := range machinePoolList.Items {
1009-
ref := &corev1.ObjectReference{}
1010-
err = util.UnstructuredUnmarshalField(&mp, ref, "spec", "template", "spec", "infrastructureRef")
1011-
if err != nil && !errors.Is(err, util.ErrUnstructuredFieldNotFound) {
1012-
return 0, err
1013-
}
1009+
var infraMachinePool *unstructured.Unstructured
1010+
1011+
// Fallback to v1beta1's objectReference
1012+
if coreCAPIStorageVersion == "v1beta1" {
1013+
ref := &corev1.ObjectReference{}
1014+
err = util.UnstructuredUnmarshalField(&mp, ref, "spec", "template", "spec", "infrastructureRef")
1015+
if err != nil && !errors.Is(err, util.ErrUnstructuredFieldNotFound) {
1016+
return 0, err
1017+
}
10141018

1015-
infraMachinePool, err := external.Get(ctx, c, ref)
1016-
if err != nil {
1017-
return 0, err
1019+
infraMachinePool, err = external.Get(ctx, c, ref)
1020+
if err != nil {
1021+
return 0, err
1022+
}
1023+
} else {
1024+
ref := clusterv1.ContractVersionedObjectReference{}
1025+
err = util.UnstructuredUnmarshalField(&mp, &ref, "spec", "template", "spec", "infrastructureRef")
1026+
if err != nil && !errors.Is(err, util.ErrUnstructuredFieldNotFound) {
1027+
return 0, err
1028+
}
1029+
1030+
infraMachinePool, err = external.GetObjectFromContractVersionedRef(ctx, c, ref, mp.GetNamespace())
1031+
if err != nil {
1032+
return 0, err
1033+
}
10181034
}
1035+
10191036
// Check if the InfraMachinePool has an infrastructureMachineKind field. If it does not, we should skip checking for MachinePool machines.
10201037
err = util.UnstructuredUnmarshalField(infraMachinePool, ptr.To(""), "status", "infrastructureMachineKind")
10211038
if err != nil && !errors.Is(err, util.ErrUnstructuredFieldNotFound) {

test/e2e/clusterctl_upgrade_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ var _ = Describe("When testing clusterctl upgrades (v0.4=>v1.6=>current)", Flake
202202
})
203203

204204
// Note: This test should be changed during "prepare main branch", it should test n-3 => current.
205-
var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.8=>current) [ClusterClass]", Label("ClusterClass"), func() {
205+
var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.9=>current) [ClusterClass]", Label("ClusterClass"), func() {
206206
// Get n-3 latest stable release
207-
version := "1.8"
207+
version := "1.9"
208208
stableRelease, err := GetStableReleaseOfMinor(ctx, version)
209209
Expect(err).ToNot(HaveOccurred(), "Failed to get stable version for minor release : %s", version)
210210
ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput {
@@ -224,8 +224,8 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.8=>cur
224224
InitWithProvidersContract: "v1beta1",
225225
// Note: Both InitWithKubernetesVersion and WorkloadKubernetesVersion should be the highest mgmt cluster version supported by the source Cluster API version.
226226
// When picking this version, please check also the list of versions known by the source Cluster API version (rif. test/infrastructure/kind/mapper.go).
227-
InitWithKubernetesVersion: "v1.31.0",
228-
WorkloadKubernetesVersion: "v1.31.0",
227+
InitWithKubernetesVersion: "v1.32.0",
228+
WorkloadKubernetesVersion: "v1.32.0",
229229
MgmtFlavor: "topology",
230230
WorkloadFlavor: "topology",
231231
UseKindForManagementCluster: true,
@@ -234,9 +234,9 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.8=>cur
234234
})
235235

236236
// Note: This test should be changed during "prepare main branch", it should test n-2 => current.
237-
var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.9=>current) [ClusterClass]", Label("ClusterClass"), func() {
237+
var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.10=>current) [ClusterClass]", Label("ClusterClass"), func() {
238238
// Get n-2 latest stable release
239-
version := "1.9"
239+
version := "1.10"
240240
stableRelease, err := GetStableReleaseOfMinor(ctx, version)
241241
Expect(err).ToNot(HaveOccurred(), "Failed to get stable version for minor release : %s", version)
242242
ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput {
@@ -265,8 +265,8 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.9=>cur
265265
},
266266
// Note: Both InitWithKubernetesVersion and WorkloadKubernetesVersion should be the highest mgmt cluster version supported by the source Cluster API version.
267267
// When picking this version, please check also the list of versions known by the source Cluster API version (rif. test/infrastructure/kind/mapper.go).
268-
InitWithKubernetesVersion: "v1.32.0",
269-
WorkloadKubernetesVersion: "v1.32.0",
268+
InitWithKubernetesVersion: "v1.33.0",
269+
WorkloadKubernetesVersion: "v1.33.0",
270270
MgmtFlavor: "topology",
271271
WorkloadFlavor: "topology",
272272
UseKindForManagementCluster: true,
@@ -275,9 +275,9 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.9=>cur
275275
})
276276

277277
// Note: This test should be changed during "prepare main branch", it should test n-1 => current.
278-
var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.10=>current) [ClusterClass]", Label("ClusterClass"), func() {
278+
var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.11=>current) [ClusterClass]", Label("ClusterClass"), func() {
279279
// Get n-1 latest stable release
280-
version := "1.10"
280+
version := "1.11"
281281
stableRelease, err := GetStableReleaseOfMinor(ctx, version)
282282
Expect(err).ToNot(HaveOccurred(), "Failed to get stable version for minor release : %s", version)
283283
ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput {
@@ -300,8 +300,8 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.10=>cu
300300
},
301301
// Note: Both InitWithKubernetesVersion and WorkloadKubernetesVersion should be the highest mgmt cluster version supported by the source Cluster API version.
302302
// When picking this version, please check also the list of versions known by the source Cluster API version (rif. test/infrastructure/kind/mapper.go).
303-
InitWithKubernetesVersion: "v1.33.0",
304-
WorkloadKubernetesVersion: "v1.33.0",
303+
InitWithKubernetesVersion: "v1.34.0",
304+
WorkloadKubernetesVersion: "v1.34.0",
305305
MgmtFlavor: "topology",
306306
WorkloadFlavor: "topology",
307307
UseKindForManagementCluster: false, // Using false for one test case to ensure this code path of the test keeps working.
@@ -310,9 +310,9 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.10=>cu
310310
})
311311

312312
// Note: This test should be changed during "prepare main branch", it should test n-1 => current.
313-
var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.10=>current) on K8S latest ci mgmt cluster [ClusterClass]", Label("ClusterClass"), func() {
313+
var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.11=>current) on K8S latest ci mgmt cluster [ClusterClass]", Label("ClusterClass"), func() {
314314
// Get n-1 latest stable release
315-
version := "1.10"
315+
version := "1.11"
316316
stableRelease, err := GetStableReleaseOfMinor(ctx, version)
317317
Expect(err).ToNot(HaveOccurred(), "Failed to get stable version for minor release : %s", version)
318318
ClusterctlUpgradeSpec(ctx, func() ClusterctlUpgradeSpecInput {
@@ -339,7 +339,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (v1.10=>cu
339339
// Note: WorkloadKubernetesVersion should be the highest mgmt cluster version supported by the source Cluster API version.
340340
// When picking this version, please check also the list of versions known by the source Cluster API version (rif. test/infrastructure/kind/mapper.go).
341341
InitWithKubernetesVersion: initKubernetesVersion,
342-
WorkloadKubernetesVersion: "v1.33.0",
342+
WorkloadKubernetesVersion: "v1.34.0",
343343
MgmtFlavor: "topology",
344344
WorkloadFlavor: "topology",
345345
UseKindForManagementCluster: true,

0 commit comments

Comments
 (0)