Skip to content

Commit 7d5af8b

Browse files
committed
Switch default capi infra provider to k0smotron in e2e
Signed-off-by: apedriza <[email protected]>
1 parent f1c73fc commit 7d5af8b

File tree

47 files changed

+1570
-1488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1570
-1488
lines changed

.github/workflows/e2e-nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ jobs:
138138
- name: Run e2e test
139139
run: |
140140
export AWS_B64ENCODED_CREDENTIALS=$(clusterawsadm bootstrap credentials encode-as-profile)
141-
make e2e TEST_NAME="${{ matrix.e2e-suite }}" E2E_CONF_FILE="$(pwd)/e2e/config/aws.yaml"
141+
make e2e-aws TEST_NAME="${{ matrix.e2e-suite }}"
142142
143143
- name: Archive artifacts
144144
if: failure()

.github/workflows/go.yml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -186,23 +186,6 @@ jobs:
186186
run: |
187187
make -C inttest ${{ matrix.smoke-suite }}
188188
189-
190-
capi-smokes-on-different-k0s-versions:
191-
name: CAPI Smokes Matrix
192-
needs: [build, unittest]
193-
strategy:
194-
fail-fast: false
195-
matrix:
196-
smoke-suite:
197-
- check-capi-remote-machine
198-
- check-capi-remote-machine-template
199-
k0s-version: [ "v1.28.11", "v1.29.6", "v1.30.2" ]
200-
201-
uses: ./.github/workflows/capi-smoke-tests.yml
202-
with:
203-
smoke-suite: ${{ matrix.smoke-suite }}
204-
k0s-version: ${{ matrix.k0s-version }}
205-
206189
capi-smokes:
207190
name: Cluster API smoke tests
208191
needs: [build, unittest]
@@ -223,7 +206,6 @@ jobs:
223206
- check-capi-controlplane-docker-worker
224207
- check-capi-docker-machine-change-args
225208
- check-capi-docker-machine-change-template
226-
- check-capi-remote-machine-template-update
227209
- check-capi-docker-machine-template-update
228210
- check-capi-docker-machine-template-update-recreate
229211
- check-capi-docker-machine-template-update-recreate-single
@@ -285,6 +267,6 @@ jobs:
285267
if: failure()
286268
uses: actions/[email protected]
287269
with:
288-
name: e2e-artifacts
270+
name: e2e-artifacts-${{ matrix.e2e-suite }}
289271
path: _artifacts
290272
if-no-files-found: ignore

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ __debug_bin*
4242
_artifacts
4343

4444
# E2E test templates
45-
e2e/data/infrastructure-docker/**/cluster-template*.yaml
45+
e2e/data/infrastructure-docker/**/cluster-template*.yaml
46+
e2e/data/infrastructure-k0smotron/**/cluster-template*.yaml

Makefile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
1515
CRDOC ?= $(LOCALBIN)/crdoc
1616

1717
## e2e configuration
18-
E2E_CONF_FILE ?= $(shell pwd)/e2e/config/docker.yaml
18+
E2E_CONF_FILE ?= $(shell pwd)/e2e/config.yaml
19+
E2E_INFRASTRUCTURE_PROVIDER ?= k0sproject-k0smotron
1920
SKIP_RESOURCE_CLEANUP ?= false
2021
# Artifacts folder generated for e2e tests
2122
ARTIFACTS ?= $(shell pwd)/_artifacts
@@ -116,7 +117,9 @@ vet: ## Run go vet against code.
116117
test: $(ENVTEST)
117118
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(GO_TEST_DIRS) -run '$(TEST_NAME)' -coverprofile cover.out
118119

120+
## Template by infrastructure provider for e2e tests
119121
DOCKER_TEMPLATES := e2e/data/infrastructure-docker
122+
K0SMOTRON_TEMPLATES := e2e/data/infrastructure-k0smotron
120123

121124
.PHONY: generate-e2e-templates-main
122125
generate-e2e-templates-main: $(KUSTOMIZE)
@@ -127,14 +130,19 @@ generate-e2e-templates-main: $(KUSTOMIZE)
127130
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-machinedeployment --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-machinedeployment.yaml
128131
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-remote-hcp --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-remote-hcp.yaml
129132
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-ingress --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-ingress.yaml
130-
133+
$(KUSTOMIZE) build $(K0SMOTRON_TEMPLATES)/main/cluster-template --load-restrictor LoadRestrictionsNone > $(K0SMOTRON_TEMPLATES)/main/cluster-template.yaml
134+
$(KUSTOMIZE) build $(K0SMOTRON_TEMPLATES)/main/cluster-template-webhook-recreate-in-single-mode --load-restrictor LoadRestrictionsNone > $(K0SMOTRON_TEMPLATES)/main/cluster-template-webhook-recreate-in-single-mode.yaml
135+
$(KUSTOMIZE) build $(K0SMOTRON_TEMPLATES)/main/cluster-template-webhook-k0s-not-compatible --load-restrictor LoadRestrictionsNone > $(K0SMOTRON_TEMPLATES)/main/cluster-template-webhook-k0s-not-compatible.yaml
136+
$(KUSTOMIZE) build $(K0SMOTRON_TEMPLATES)/main/cluster-template-kcp-remediation --load-restrictor LoadRestrictionsNone > $(K0SMOTRON_TEMPLATES)/main/cluster-template-kcp-remediation.yaml
137+
$(KUSTOMIZE) build $(K0SMOTRON_TEMPLATES)/main/cluster-template-remote-hcp --load-restrictor LoadRestrictionsNone > $(K0SMOTRON_TEMPLATES)/main/cluster-template-remote-hcp.yaml
131138

132139
e2e: generate-e2e-templates-main
133140
set +x;
134141
PATH="${LOCALBIN}:${PATH}" go test -v -tags e2e -run '$(TEST_NAME)' ./e2e \
135142
-artifacts-folder="$(ARTIFACTS)" \
136143
-config="$(E2E_CONF_FILE)" \
137144
-skip-resource-cleanup=$(SKIP_RESOURCE_CLEANUP) \
145+
-infrastructure-provider=$(E2E_INFRASTRUCTURE_PROVIDER) \
138146
-timeout=30m
139147

140148
e2e-aws:
@@ -143,7 +151,7 @@ e2e-aws:
143151
@[ -n "$$AWS_REGION" ] || (echo "AWS_REGION not defined"; exit 1)
144152
@[ -n "$$AWS_B64ENCODED_CREDENTIALS" ] || (echo "AWS_B64ENCODED_CREDENTIALS not defined"; exit 1)
145153
@[ -n "$$SSH_PUBLIC_KEY" ] || (echo "SSH_PUBLIC_KEY not defined"; exit 1)
146-
$(MAKE) e2e TEST_NAME="${TEST_NAME}" E2E_CONF_FILE="$(shell pwd)/e2e/config/aws.yaml"
154+
$(MAKE) e2e TEST_NAME="${TEST_NAME}" E2E_INFRASTRUCTURE_PROVIDER=aws
147155

148156
##@ Build
149157

docs/contributing/release-process.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ You can verify the documentation at https://docs.k0smotron.io/ after the workflo
5757
If you are making a new **major** or **minor** release, after publishing the release, update the E2E upgrade test to reflect the new release version:
5858

5959
- Add new release in `k0smotronMinorVersionsToCheckUpgrades` in [`e2e/k0smotron_upgrade_test.go`](https://github.com/k0sproject/k0smotron/blob/main/e2e/k0smotron_upgrade_test.go).
60-
- Add the new release entry under the `k0sproject-k0smotron` provider in [`e2e/config/docker.yaml`](https://github.com/k0sproject/k0smotron/blob/main/e2e/config/docker.yaml) (including matching `control-plane-components.yaml` and `bootstrap-components.yaml` URLs).
60+
- Add the new release entry under the `k0sproject-k0smotron` provider in [`e2e/config.yaml`](https://github.com/k0sproject/k0smotron/blob/main/e2e/config.yaml) (including matching `control-plane-components.yaml` and `bootstrap-components.yaml` URLs).

e2e/admission_webhook_test.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ func admissionWebhookRecreateStrategyInSingleModeSpec(t *testing.T) {
5555
Namespace: namespace.Name,
5656
ClusterName: clusterName,
5757
KubernetesVersion: e2eConfig.MustGetVariable(KubernetesVersion),
58-
ControlPlaneMachineCount: ptr.To[int64](3),
59-
// TODO: make infra provider configurable
60-
InfrastructureProvider: "docker",
61-
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
58+
ControlPlaneMachineCount: ptr.To(int64(controlPlaneMachineCount)),
59+
WorkerMachineCount: ptr.To(int64(workerMachineCount)),
60+
InfrastructureProvider: infrastructureProvider,
61+
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
6262
ClusterctlVariables: map[string]string{
6363
"CLUSTER_NAME": clusterName,
6464
"NAMESPACE": namespace.Name,
@@ -80,18 +80,16 @@ func admissionWebhookK0sVersionNotCompatibleSpec(t *testing.T) {
8080
clusterName := fmt.Sprintf("%s-%s", testName, capiutil.RandomString(6))
8181

8282
workloadClusterTemplate := clusterctl.ConfigCluster(ctx, clusterctl.ConfigClusterInput{
83-
ClusterctlConfigPath: clusterctlConfigPath,
84-
KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(),
85-
// select cluster templates
86-
Flavor: "webhook-k0s-not-compatible",
87-
83+
ClusterctlConfigPath: clusterctlConfigPath,
84+
KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(),
85+
Flavor: "webhook-k0s-not-compatible",
8886
Namespace: namespace.Name,
8987
ClusterName: clusterName,
9088
KubernetesVersion: e2eConfig.MustGetVariable(KubernetesVersion),
91-
ControlPlaneMachineCount: ptr.To[int64](3),
92-
// TODO: make infra provider configurable
93-
InfrastructureProvider: "docker",
94-
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
89+
ControlPlaneMachineCount: ptr.To(int64(controlPlaneMachineCount)),
90+
WorkerMachineCount: ptr.To(int64(workerMachineCount)),
91+
InfrastructureProvider: infrastructureProvider,
92+
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
9593
ClusterctlVariables: map[string]string{
9694
"CLUSTER_NAME": clusterName,
9795
"NAMESPACE": namespace.Name,

e2e/config/docker.yaml renamed to e2e/config.yaml

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# - cluster-api
44
# - bootstrap k0smotron
55
# - control-plane k0smotron
6-
# - infrastructure docker
6+
# - infrastructure docker, aws, k0sproject-k0smotron
77
images:
88
- name: quay.io/k0sproject/k0smotron:latest
99
loadBehavior: mustLoad
@@ -17,10 +17,31 @@ providers:
1717
type: url
1818
contract: v1beta1
1919
files:
20-
- sourcePath: "../data/shared/v1beta1/metadata.yaml"
20+
- sourcePath: "./data/shared/v1beta1/metadata.yaml"
2121
replacements:
2222
- old: "imagePullPolicy: Always"
2323
new: "imagePullPolicy: IfNotPresent"
24+
- name: k0sproject-k0smotron
25+
type: InfrastructureProvider
26+
versions:
27+
- name: v1.9.99 # potentially next release. Manifest from source files (development) are used.
28+
value: ../config/default
29+
contract: v1beta1
30+
files:
31+
- sourcePath: "../metadata.yaml"
32+
replacements:
33+
- old: "imagePullPolicy: Always"
34+
new: "imagePullPolicy: IfNotPresent"
35+
- old: "image: k0s/k0smotron:latest"
36+
new: "image: quay.io/k0sproject/k0smotron:latest" # For local testing, this image needs to be built before run e2e by using `make docker-build`
37+
files:
38+
- sourcePath: "./data/infrastructure-k0smotron/main/cluster-template.yaml"
39+
- sourcePath: "./data/infrastructure-k0smotron/main/cluster-template-kcp-remediation.yaml"
40+
- sourcePath: "./data/infrastructure-k0smotron/main/cluster-template-webhook-recreate-in-single-mode.yaml"
41+
- sourcePath: "./data/infrastructure-k0smotron/main/cluster-template-webhook-k0s-not-compatible.yaml"
42+
- sourcePath: "./data/infrastructure-k0smotron/main/cluster-template-machinedeployment.yaml"
43+
- sourcePath: "./data/infrastructure-k0smotron/main/cluster-template-remote-hcp.yaml"
44+
- sourcePath: "./data/infrastructure-k0smotron/main/cluster-template-ingress.yaml"
2445
- name: docker
2546
type: InfrastructureProvider
2647
versions:
@@ -29,18 +50,32 @@ providers:
2950
type: url
3051
contract: v1beta1
3152
files:
32-
- sourcePath: "../data/shared/v1beta1/metadata.yaml"
53+
- sourcePath: "./data/shared/v1beta1/metadata.yaml"
54+
replacements:
55+
- old: "imagePullPolicy: Always"
56+
new: "imagePullPolicy: IfNotPresent"
57+
files:
58+
- sourcePath: "./data/infrastructure-docker/main/cluster-template.yaml"
59+
- sourcePath: "./data/infrastructure-docker/main/cluster-template-kcp-remediation.yaml"
60+
- sourcePath: "./data/infrastructure-docker/main/cluster-template-webhook-recreate-in-single-mode.yaml"
61+
- sourcePath: "./data/infrastructure-docker/main/cluster-template-webhook-k0s-not-compatible.yaml"
62+
- sourcePath: "./data/infrastructure-docker/main/cluster-template-machinedeployment.yaml"
63+
- sourcePath: "./data/infrastructure-docker/main/cluster-template-remote-hcp.yaml"
64+
- sourcePath: "./data/infrastructure-docker/main/cluster-template-ingress.yaml"
65+
- name: aws
66+
type: InfrastructureProvider
67+
versions:
68+
- name: v2.9.0
69+
value: "https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/download/v2.9.0/infrastructure-components.yaml"
70+
type: url
71+
contract: v1beta1
72+
files:
73+
- sourcePath: ".data.yaml"
3374
replacements:
3475
- old: "imagePullPolicy: Always"
3576
new: "imagePullPolicy: IfNotPresent"
3677
files:
37-
- sourcePath: "../data/infrastructure-docker/main/cluster-template.yaml"
38-
- sourcePath: "../data/infrastructure-docker/main/cluster-template-kcp-remediation.yaml"
39-
- sourcePath: "../data/infrastructure-docker/main/cluster-template-webhook-recreate-in-single-mode.yaml"
40-
- sourcePath: "../data/infrastructure-docker/main/cluster-template-webhook-k0s-not-compatible.yaml"
41-
- sourcePath: "../data/infrastructure-docker/main/cluster-template-machinedeployment.yaml"
42-
- sourcePath: "../data/infrastructure-docker/main/cluster-template-remote-hcp.yaml"
43-
- sourcePath: "../data/infrastructure-docker/main/cluster-template-ingress.yaml"
78+
- sourcePath: "./data/infrastructure-aws/cluster-template-ignition.yaml"
4479
- name: k0sproject-k0smotron
4580
type: ControlPlaneProvider
4681
versions:
@@ -49,7 +84,7 @@ providers:
4984
type: url
5085
contract: v1beta1
5186
files:
52-
- sourcePath: "../../metadata.yaml"
87+
- sourcePath: "../metadata.yaml"
5388
replacements:
5489
- old: "imagePullPolicy: Always"
5590
new: "imagePullPolicy: IfNotPresent"
@@ -58,7 +93,7 @@ providers:
5893
type: url
5994
contract: v1beta1
6095
files:
61-
- sourcePath: "../../metadata.yaml"
96+
- sourcePath: "../metadata.yaml"
6297
replacements:
6398
- old: "imagePullPolicy: Always"
6499
new: "imagePullPolicy: IfNotPresent"
@@ -67,7 +102,7 @@ providers:
67102
type: url
68103
contract: v1beta1
69104
files:
70-
- sourcePath: "../../metadata.yaml"
105+
- sourcePath: "../metadata.yaml"
71106
replacements:
72107
- old: "imagePullPolicy: Always"
73108
new: "imagePullPolicy: IfNotPresent"
@@ -76,7 +111,7 @@ providers:
76111
type: url
77112
contract: v1beta1
78113
files:
79-
- sourcePath: "../../metadata.yaml"
114+
- sourcePath: "../metadata.yaml"
80115
replacements:
81116
- old: "imagePullPolicy: Always"
82117
new: "imagePullPolicy: IfNotPresent"
@@ -85,15 +120,15 @@ providers:
85120
type: url
86121
contract: v1beta1
87122
files:
88-
- sourcePath: "../../metadata.yaml"
123+
- sourcePath: "../metadata.yaml"
89124
replacements:
90125
- old: "imagePullPolicy: Always"
91126
new: "imagePullPolicy: IfNotPresent"
92127
- name: v1.9.99 # potentially next release. Manifest from source files (development) are used.
93-
value: ../../config/default
128+
value: ../config/default
94129
contract: v1beta1
95130
files:
96-
- sourcePath: "../../metadata.yaml"
131+
- sourcePath: "../metadata.yaml"
97132
replacements:
98133
- old: "imagePullPolicy: Always"
99134
new: "imagePullPolicy: IfNotPresent"
@@ -107,7 +142,7 @@ providers:
107142
type: url
108143
contract: v1beta1
109144
files:
110-
- sourcePath: "../../metadata.yaml"
145+
- sourcePath: "../metadata.yaml"
111146
replacements:
112147
- old: "imagePullPolicy: Always"
113148
new: "imagePullPolicy: IfNotPresent"
@@ -116,7 +151,7 @@ providers:
116151
type: url
117152
contract: v1beta1
118153
files:
119-
- sourcePath: "../../metadata.yaml"
154+
- sourcePath: "../metadata.yaml"
120155
replacements:
121156
- old: "imagePullPolicy: Always"
122157
new: "imagePullPolicy: IfNotPresent"
@@ -125,7 +160,7 @@ providers:
125160
type: url
126161
contract: v1beta1
127162
files:
128-
- sourcePath: "../../metadata.yaml"
163+
- sourcePath: "../metadata.yaml"
129164
replacements:
130165
- old: "imagePullPolicy: Always"
131166
new: "imagePullPolicy: IfNotPresent"
@@ -134,7 +169,7 @@ providers:
134169
type: url
135170
contract: v1beta1
136171
files:
137-
- sourcePath: "../../metadata.yaml"
172+
- sourcePath: "../metadata.yaml"
138173
replacements:
139174
- old: "imagePullPolicy: Always"
140175
new: "imagePullPolicy: IfNotPresent"
@@ -143,15 +178,15 @@ providers:
143178
type: url
144179
contract: v1beta1
145180
files:
146-
- sourcePath: "../../metadata.yaml"
181+
- sourcePath: "../metadata.yaml"
147182
replacements:
148183
- old: "imagePullPolicy: Always"
149184
new: "imagePullPolicy: IfNotPresent"
150185
- name: v1.9.99 # potentially next release. Manifest from source files (development) are used.
151-
value: ../../config/default
186+
value: ../config/default
152187
contract: v1beta1
153188
files:
154-
- sourcePath: "../../metadata.yaml"
189+
- sourcePath: "../metadata.yaml"
155190
replacements:
156191
- old: "imagePullPolicy: Always"
157192
new: "imagePullPolicy: IfNotPresent"
@@ -161,8 +196,9 @@ providers:
161196
variables:
162197
KUBERNETES_VERSION_MANAGEMENT: "v1.30.0"
163198
KUBERNETES_VERSION: "v1.31.0"
164-
KUBERNETES_VERSION_FIRST_UPGRADE_TO: "v1.30.2+k0s.0"
165-
KUBERNETES_VERSION_SECOND_UPGRADE_TO: "v1.31.2+k0s.0"
199+
K0S_VERSION: "v1.30.1+k0s.0"
200+
K0S_VERSION_FIRST_UPGRADE_TO: "v1.30.2+k0s.0"
201+
K0S_VERSION_SECOND_UPGRADE_TO: "v1.31.2+k0s.0"
166202
IP_FAMILY: "IPv4"
167203
KIND_IMAGE_VERSION: "v1.30.0"
168204
# Enabling the feature flags by setting the env variables.
@@ -183,7 +219,6 @@ intervals:
183219
default/wait-nodes-ready: ["10m", "10s"]
184220
default/wait-machine-remediation: ["5m", "10s"]
185221
default/wait-autoscaler: ["5m", "10s"]
186-
ingress/wait-controllers: ["5m", "10s"]
187222
remote-hcp/wait-controllers: ["5m", "10s"]
188223
bootstrap/wait-deployment-available: ["3m", "10s"]
189224
node-drain/wait-deployment-available: ["3m", "10s"]
@@ -193,6 +228,7 @@ intervals:
193228
workload-recreate-upgrade/wait-cluster: ["10m", "10s"]
194229
workload-recreate-upgrade/wait-control-plane: ["20m", "10s"]
195230
workload-recreate-upgrade/wait-worker-nodes: ["20m", "10s"]
231+
workload-inplace-upgrade/wait-controllers: ["10m", "20s"]
196232
workload-inplace-upgrade/wait-cluster: ["10m", "10s"]
197233
workload-inplace-upgrade/wait-control-plane: ["20m", "10s"]
198234
workload-inplace-upgrade/wait-worker-nodes: ["20m", "10s"]

0 commit comments

Comments
 (0)