Skip to content

Commit c18b5ef

Browse files
simcodvknabel
andauthored
Cluster K8s Upgrade (#105)
Co-authored-by: Valentin Knabel <[email protected]>
1 parent 4c05471 commit c18b5ef

File tree

12 files changed

+450
-36
lines changed

12 files changed

+450
-36
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*.dylib
77
bin/*
88
test/external-crds
9-
test/e2e/frmwrk/artifacts
9+
test/e2e/frmwrk/data/clusterctl-templates/cluster-template-*.yaml
1010
_artifacts
1111
Dockerfile.cross
1212
.release

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,14 @@ E2E_DEFAULT_FLAVOR ?= "calico"
141141
# Can be something like: basic && !move
142142
E2E_LABEL_FILTER ?= ""
143143

144+
E2E_TEMPLATES := test/e2e/frmwrk/data/clusterctl-templates
144145
.PHONY: test-e2e
145146
test-e2e: manifests generate fmt vet ginkgo
146147
rm -rf $(ARTIFACTS)
147148

149+
$(KUSTOMIZE) build $(E2E_TEMPLATES)/upgrade --load-restrictor LoadRestrictionsNone > $(E2E_TEMPLATES)/cluster-template-upgrade.yaml
150+
$(KUSTOMIZE) build $(E2E_TEMPLATES)/upgrade-workerless --load-restrictor LoadRestrictionsNone > $(E2E_TEMPLATES)/cluster-template-upgrade-workerless.yaml
151+
148152
@METAL_API_URL=$(E2E_METAL_API_URL) \
149153
METAL_API_HMAC=$(E2E_METAL_API_HMAC) \
150154
METAL_API_HMAC_AUTH_TYPE=$(E2E_METAL_API_HMAC_AUTH_TYPE) \
@@ -162,6 +166,7 @@ test-e2e: manifests generate fmt vet ginkgo
162166
FIREWALL_NETWORKS=$(E2E_FIREWALL_NETWORKS) \
163167
ARTIFACTS=$(ARTIFACTS) \
164168
E2E_DEFAULT_FLAVOR=$(E2E_DEFAULT_FLAVOR) \
169+
KUBETEST_CONFIGURATION="$(shell git rev-parse --show-toplevel)/test/e2e/frmwrk/data/kubetest/conformance.yaml" \
165170
$(GINKGO) -vv -r --junit-report="junit.e2e_suite.xml" --output-dir="$(ARTIFACTS)" --label-filter="$(E2E_LABEL_FILTER)" -timeout 60m ./test/e2e/frmwrk
166171

167172
.PHONY: lint

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module github.com/metal-stack/cluster-api-provider-metal-stack
33
go 1.23.0
44

55
require (
6-
github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46
76
github.com/go-logr/logr v1.4.2
87
github.com/metal-stack/metal-go v0.40.4
98
github.com/metal-stack/metal-lib v0.20.2
@@ -47,6 +46,7 @@ require (
4746
github.com/docker/docker v28.0.2+incompatible // indirect
4847
github.com/docker/go-connections v0.5.0 // indirect
4948
github.com/docker/go-units v0.5.0 // indirect
49+
github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46 // indirect
5050
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
5151
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
5252
github.com/fatih/color v1.18.0 // indirect

test/e2e/frmwrk/cluster_upgrade_kubernetes_test.go

Lines changed: 328 additions & 0 deletions
Large diffs are not rendered by default.

test/e2e/frmwrk/config/capi-e2e-config.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ providers:
124124
- sourcePath: "../../../../config/clusterctl-templates/cluster-template.yaml"
125125
- sourcePath: "../../../../config/clusterctl-templates/cluster-template-calico.yaml"
126126
- sourcePath: "../../../../config/clusterctl-templates/cluster-template-pre-v1.33.yaml"
127+
- sourcePath: "../data/clusterctl-templates/cluster-template-upgrade.yaml"
128+
- sourcePath: "../data/clusterctl-templates/cluster-template-upgrade-workerless.yaml"
127129
replacements:
128130
- old: --metrics-addr=127.0.0.1:8080
129131
new: --metrics-addr=:8080
@@ -133,7 +135,7 @@ variables:
133135
# NAMESPACE:
134136
KUBERNETES_VERSION: "v1.34.1"
135137
EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION: "true"
136-
# METAL_PARTITION:
138+
# METAL_PARTITION:
137139
# METAL_PROJECT_ID:
138140
# METAL_NODE_NETWORK_ID:
139141
# CONTROL_PLANE_IP:
@@ -145,6 +147,15 @@ variables:
145147
WORKER_MACHINE_SIZE: "c1-medium-x86"
146148
CONTROL_PLANE_MACHINE_COUNT: "1"
147149
WORKER_MACHINE_COUNT: "1"
150+
# K8s Upgrade variables
151+
KUBERNETES_VERSION_UPGRADE_FROM: "v1.33.5"
152+
KUBERNETES_VERSION_UPGRADE_TO: "v1.34.1"
153+
CONTROL_PLANE_MACHINE_TEMPLATE_UPGRADE_TO: "k8s-upgrade-controlplane"
154+
WORKERS_MACHINE_TEMPLATE_UPGRADE_TO: "k8s-upgrade-worker"
155+
KUBERNETES_IMAGE_UPGRADE_TO: "capms-ubuntu-1.34.1"
156+
# TODO: remove once merged into upstream
157+
# https://github.com/kubernetes-sigs/cluster-api/pull/12948
158+
KUBETEST_CONFIGURATION: "test/e2e/frmwrk/data/kubetest/conformance.yaml" # must be absolute, actual path provided by Makefile
148159

149160
intervals:
150161
default/wait-controllers: ["4m", "10s"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
2+
kind: MetalStackMachineTemplate
3+
metadata:
4+
name: k8s-upgrade-controlplane
5+
namespace: ${NAMESPACE}
6+
spec:
7+
template:
8+
spec:
9+
size: ${CONTROL_PLANE_MACHINE_SIZE}
10+
image: ${KUBERNETES_IMAGE_UPGRADE_TO}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
2+
kind: MetalStackMachineTemplate
3+
metadata:
4+
name: k8s-upgrade-worker
5+
namespace: ${NAMESPACE}
6+
spec:
7+
template:
8+
spec:
9+
size: ${WORKER_MACHINE_SIZE}
10+
image: ${KUBERNETES_IMAGE_UPGRADE_TO}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
resources:
2+
- ../../../../../../config/clusterctl-templates/cluster-template-calico.yaml
3+
- ../bases/cluster-template-mt-control-plane-upgrade-to.yaml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
resources:
2+
- ../../../../../../config/clusterctl-templates/cluster-template-calico.yaml
3+
- ../bases/cluster-template-mt-control-plane-upgrade-to.yaml
4+
- ../bases/cluster-template-mt-worker-upgrade-to.yaml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ginkgo.focus: \[Conformance\]
2+
ginkgo.skip: \[Serial\]|HostPort.*\[Conformance\].*
3+
disable-log-dump: true
4+
ginkgo.progress: true
5+
ginkgo.slowSpecThreshold: 120.0
6+
ginkgo.flakeAttempts: 3
7+
ginkgo.trace: true
8+
ginkgo.v: true

0 commit comments

Comments
 (0)