Skip to content

Commit 4fb08c7

Browse files
committed
E2e: Use pre-build node images
We are currently using a plain ubuntu cloud image for the nodes in most e2e tests. Cloud-init scripts are used to install the Kubernetes components on startup. This is convenient since we do not have to build specific images. However, the scripts are not well maintained, they increase the complexity and running time of the tests. This changes the tests to use a pre-built image. The image was build using image-builder, which is a standard for many CAPI providers.
1 parent ce90495 commit 4fb08c7

File tree

15 files changed

+38
-139
lines changed

15 files changed

+38
-139
lines changed

Makefile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,22 +156,20 @@ E2E_NO_ARTIFACT_TEMPLATES_DIR=test/e2e/data/infrastructure-openstack-no-artifact
156156

157157
.PHONY: e2e-templates
158158
e2e-templates: ## Generate cluster templates for e2e tests
159-
e2e-templates: $(addprefix $(E2E_TEMPLATES_DIR)/, \
159+
e2e-templates: $(addprefix $(E2E_NO_ARTIFACT_TEMPLATES_DIR)/, \
160160
cluster-template-v1alpha5.yaml \
161161
cluster-template-v1alpha6.yaml \
162162
cluster-template-md-remediation.yaml \
163163
cluster-template-kcp-remediation.yaml \
164164
cluster-template-multi-az.yaml \
165165
cluster-template-multi-network.yaml \
166166
cluster-template-without-lb.yaml \
167-
cluster-template.yaml) \
168-
$(addprefix $(E2E_NO_ARTIFACT_TEMPLATES_DIR)/, \
167+
cluster-template.yaml \
169168
cluster-template-flatcar.yaml)
169+
# Currently no templates that require CI artifacts
170+
# $(addprefix $(E2E_TEMPLATES_DIR)/, add-templates-here.yaml) \
170171
171-
$(E2E_TEMPLATES_DIR)/cluster-template.yaml: $(E2E_KUSTOMIZE_DIR)/with-tags $(KUSTOMIZE) FORCE
172-
$(KUSTOMIZE) build "$<" > "$@"
173-
174-
$(E2E_TEMPLATES_DIR)/cluster-template-%.yaml: $(E2E_KUSTOMIZE_DIR)/% $(KUSTOMIZE) FORCE
172+
$(E2E_NO_ARTIFACT_TEMPLATES_DIR)/cluster-template.yaml: $(E2E_KUSTOMIZE_DIR)/with-tags $(KUSTOMIZE) FORCE
175173
$(KUSTOMIZE) build "$<" > "$@"
176174

177175
$(E2E_NO_ARTIFACT_TEMPLATES_DIR)/cluster-template-%.yaml: $(E2E_KUSTOMIZE_DIR)/% $(KUSTOMIZE) FORCE

hack/ci/cloud-init/controller.yaml.tpl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,17 @@
5353

5454
# Don't download default images, just our test images
5555
DOWNLOAD_DEFAULT_IMAGES=False
56+
# Increase the total image size limit
57+
GLANCE_LIMIT_IMAGE_SIZE_TOTAL=20000
5658
# We upload the Amphora image so it doesn't have to be build
57-
IMAGE_URLS="https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/amphora/2022-12-05/amphora-x64-haproxy.qcow2"
59+
# Upload the images so we don't have to upload them from Prow
60+
# NOTE: If you get issues when changing/adding images, check if the limits
61+
# are sufficient and change the variable above if needed.
62+
# https://docs.openstack.org/glance/latest/admin/quotas.html
63+
IMAGE_URLS="https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/amphora/2022-12-05/amphora-x64-haproxy.qcow2,"
64+
IMAGE_URLS+="https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/cirros/2022-12-05/cirros-0.6.1-x86_64-disk.img,"
65+
IMAGE_URLS+="https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/ubuntu/2023-09-29/ubuntu-2204-kube-v1.27.2.img,"
66+
IMAGE_URLS+="https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/flatcar/flatcar-stable-3602.2.0-kube-v1.27.2.img"
5867

5968
[[post-config|$NOVA_CONF]]
6069
[DEFAULT]
@@ -133,13 +142,6 @@
133142

134143
source /opt/stack/devstack/openrc admin admin
135144

136-
# Upload the images so we don't have to upload them from Prow
137-
# Upload cirros image first in order to avoid reach limit of project
138-
# https://docs.openstack.org/glance/latest/admin/quotas.html
139-
/opt/stack/devstack/tools/upload_image.sh https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/cirros/2022-12-05/cirros-0.6.1-x86_64-disk.img
140-
/opt/stack/devstack/tools/upload_image.sh https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/ubuntu/2023-01-14/focal-server-cloudimg-amd64.img
141-
/opt/stack/devstack/tools/upload_image.sh https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/flatcar/flatcar-stable-3602.2.0-kube-v1.27.2.img
142-
143145
# Add the controller to its own host aggregate and availability zone
144146
aggregateid=$(openstack aggregate create --zone "${PRIMARY_AZ}" "${PRIMARY_AZ}" -f value -c id)
145147
for host in $(openstack compute service list --service nova-compute -f value -c Host)

test/e2e/data/e2e_conf.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ providers:
117117
contract: v1beta1
118118
files:
119119
- sourcePath: "../data/shared/v1beta1_provider/metadata.yaml"
120-
- sourcePath: "./infrastructure-openstack/cluster-template.yaml"
120+
- sourcePath: "./infrastructure-openstack-no-artifact/cluster-template.yaml"
121121
replacements:
122122
- old: "imagePullPolicy: Always"
123123
new: "imagePullPolicy: IfNotPresent"
@@ -131,7 +131,7 @@ providers:
131131
contract: v1beta1
132132
files:
133133
- sourcePath: "../data/shared/v1beta1_provider/metadata.yaml"
134-
- sourcePath: "./infrastructure-openstack/cluster-template.yaml"
134+
- sourcePath: "./infrastructure-openstack-no-artifact/cluster-template.yaml"
135135
replacements:
136136
- old: "imagePullPolicy: Always"
137137
new: "imagePullPolicy: IfNotPresent"
@@ -146,8 +146,8 @@ providers:
146146
# contract: v1beta1
147147
files:
148148
- sourcePath: "../data/shared/v1beta1_provider/metadata.yaml"
149-
- sourcePath: "./infrastructure-openstack/cluster-template.yaml"
150-
- sourcePath: "./infrastructure-openstack/cluster-template-without-lb.yaml"
149+
- sourcePath: "./infrastructure-openstack-no-artifact/cluster-template.yaml"
150+
- sourcePath: "./infrastructure-openstack-no-artifact/cluster-template-without-lb.yaml"
151151
replacements:
152152
- old: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:dev
153153
new: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:e2e
@@ -165,10 +165,6 @@ variables:
165165
# used to ensure we deploy to the correct management cluster
166166
KUBE_CONTEXT: "kind-capo-e2e"
167167
KUBERNETES_VERSION: "v1.27.2"
168-
KUBERNETES_VERSION_UPGRADE_FROM: "v1.26.5"
169-
KUBERNETES_VERSION_UPGRADE_TO: "v1.27.2"
170-
ETCD_VERSION_UPGRADE_TO: "3.5.6-0"
171-
COREDNS_VERSION_UPGRADE_TO: "v1.9.3"
172168
CNI: "../../data/cni/calico.yaml"
173169
CCM: "../../data/ccm/cloud-controller-manager.yaml"
174170
EXP_CLUSTER_RESOURCE_SET: "true"
@@ -182,7 +178,7 @@ variables:
182178
OPENSTACK_DNS_NAMESERVERS: "8.8.8.8"
183179
OPENSTACK_FAILURE_DOMAIN: "testaz1"
184180
OPENSTACK_FAILURE_DOMAIN_ALT: "testaz2"
185-
OPENSTACK_IMAGE_NAME: "focal-server-cloudimg-amd64"
181+
OPENSTACK_IMAGE_NAME: "ubuntu-2204-kube-v1.27.2"
186182
OPENSTACK_NODE_MACHINE_FLAVOR: "m1.small"
187183
OPENSTACK_SSH_KEY_NAME: "cluster-api-provider-openstack-sigs-k8s-io"
188184
OPENSTACK_EXTERNAL_NETWORK_ID: ""

test/e2e/data/kustomize/common-patches/containerd/containerd-kcp.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

test/e2e/data/kustomize/common-patches/containerd/containerd-kct.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.

test/e2e/data/kustomize/common-patches/containerd/kustomization.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

test/e2e/data/kustomize/default/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ resources:
44

55
components:
66
- ../common-patches/cni
7-
- ../common-patches/containerd
87
- ../upgrade-patches
98
- ../common-patches/ccm

test/e2e/data/kustomize/multi-az/patch-machine-template-control-plane.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- op: add
33
path: /spec/template/spec/rootVolume
44
value:
5-
diskSize: 15
5+
diskSize: 25
66
- op: add
77
path: /spec/template/spec/additionalBlockDevices
88
value:

test/e2e/data/kustomize/multi-az/patch-machine-template-worker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- op: add
33
path: /spec/template/spec/rootVolume
44
value:
5-
diskSize: 15
5+
diskSize: 25
66
volumeType: ${OPENSTACK_VOLUME_TYPE_ALT}
77
availabilityZone: ${OPENSTACK_FAILURE_DOMAIN}
88
- op: add

test/e2e/data/kustomize/v1alpha5/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ resources:
44

55
components:
66
- ../common-patches/cni
7-
- ../common-patches/containerd
87
- ../common-patches/ccm

0 commit comments

Comments
 (0)