Skip to content

Commit d4baeb1

Browse files
authored
Merge pull request kubernetes-sigs#1699 from Nordix/lentzi90/e2e-pre-built-node-images
🌱 E2e: Use pre-build node images
2 parents ce90495 + 4fb08c7 commit d4baeb1

15 files changed

+38
-139
lines changed

Makefile

+5-7
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

+10-8
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

+5-9
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

-41
This file was deleted.

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

-41
This file was deleted.

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

-14
This file was deleted.

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

-1
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

+1-1
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

+1-1
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

-1
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

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

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ resources:
44

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

109
patches:

test/e2e/data/kustomize/without-lb/kustomization.yaml

-1
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

test/e2e/shared/defaults.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ const (
4444
OpenStackImageName = "OPENSTACK_IMAGE_NAME"
4545
OpenStackNodeMachineFlavor = "OPENSTACK_NODE_MACHINE_FLAVOR"
4646
SSHUserMachine = "SSH_USER_MACHINE"
47-
FlavorDefault = "ci-artifacts"
48-
FlavorWithoutLB = "without-lb-ci-artifacts"
49-
FlavorMultiNetwork = "multi-network-ci-artifacts"
50-
FlavorMultiAZ = "multi-az-ci-artifacts"
51-
FlavorV1alpha5 = "v1alpha5-ci-artifacts"
52-
FlavorV1alpha6 = "v1alpha6-ci-artifacts"
53-
FlavorMDRemediation = "md-remediation-ci-artifacts"
54-
FlavorKCPRemediation = "kcp-remediation-ci-artifacts"
47+
FlavorDefault = ""
48+
FlavorWithoutLB = "without-lb"
49+
FlavorMultiNetwork = "multi-network"
50+
FlavorMultiAZ = "multi-az"
51+
FlavorV1alpha5 = "v1alpha5"
52+
FlavorV1alpha6 = "v1alpha6"
53+
FlavorMDRemediation = "md-remediation"
54+
FlavorKCPRemediation = "kcp-remediation"
5555
FlavorFlatcar = "flatcar"
5656
)
5757

test/e2e/shared/suite.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ func Node1BeforeSuite(e2eCtx *E2EContext) []byte {
5858
flag.Parse()
5959
Expect(e2eCtx.Settings.ConfigPath).To(BeAnExistingFile(), "Invalid test suite argument. configPath should be an existing file.")
6060
Expect(os.MkdirAll(e2eCtx.Settings.ArtifactFolder, 0o750)).To(Succeed(), "Invalid test suite argument. Can't create artifacts-folder %q", e2eCtx.Settings.ArtifactFolder)
61+
templatesDir := path.Join(e2eCtx.Settings.ArtifactFolder, "templates")
62+
Expect(os.MkdirAll(templatesDir, 0o750)).To(Succeed(), "Can't create templates folder %q", templatesDir)
6163
Logf("Loading the e2e test configuration from %q", e2eCtx.Settings.ConfigPath)
6264
e2eCtx.E2EConfig = LoadE2EConfig(e2eCtx.Settings.ConfigPath)
6365

@@ -66,7 +68,8 @@ func Node1BeforeSuite(e2eCtx *E2EContext) []byte {
6668

6769
templates := []clusterctl.Files{}
6870

69-
// TODO(sbuerin): we always need ci artifacts, because we don't have images for every Kubernetes version
71+
// Cluster templates in this folder will get ci artifacts injected. It makes it possible to use generic cloud images
72+
// without kubernetes pre-installed.
7073
err := filepath.WalkDir(path.Join(e2eCtx.Settings.DataFolder, "infrastructure-openstack"), func(f string, d fs.DirEntry, _ error) error {
7174
filename := filepath.Base(f)
7275
fileExtension := filepath.Ext(filename)
@@ -90,7 +93,7 @@ func Node1BeforeSuite(e2eCtx *E2EContext) []byte {
9093
Expect(err).NotTo(HaveOccurred())
9194

9295
targetName := fmt.Sprintf("%s-ci-artifacts.yaml", strings.TrimSuffix(filename, fileExtension))
93-
targetTemplate := path.Join(e2eCtx.Settings.ArtifactFolder, "templates", targetName)
96+
targetTemplate := path.Join(templatesDir, targetName)
9497

9598
// We have to copy the file from ciTemplate to targetTemplate. Otherwise it would be overwritten because
9699
// ciTemplate is the same for all templates
@@ -120,7 +123,7 @@ func Node1BeforeSuite(e2eCtx *E2EContext) []byte {
120123
t, err := os.ReadFile(f)
121124
Expect(err).NotTo(HaveOccurred())
122125

123-
targetTemplate := path.Join(e2eCtx.Settings.ArtifactFolder, "templates", filename)
126+
targetTemplate := path.Join(templatesDir, filename)
124127

125128
err = os.WriteFile(targetTemplate, t, 0o600)
126129
Expect(err).NotTo(HaveOccurred())

test/e2e/suites/e2e/e2e_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ var _ = Describe("e2e tests [PR-Blocking]", func() {
8181
clusterResources = new(clusterctl.ApplyClusterTemplateAndWaitResult)
8282
Expect(e2eCtx.E2EConfig).ToNot(BeNil(), "Invalid argument. e2eConfig can't be nil when calling %s spec", specName)
8383
Expect(e2eCtx.E2EConfig.Variables).To(HaveKey(shared.KubernetesVersion))
84-
shared.SetEnvVar("USE_CI_ARTIFACTS", "true", false)
84+
shared.SetEnvVar("USE_CI_ARTIFACTS", "false", false)
8585
postClusterCleanup = nil
8686
})
8787

@@ -600,7 +600,7 @@ var _ = Describe("e2e tests [PR-Blocking]", func() {
600600
rootVolumes[machine.Name] = rootVolume
601601
Expect(*rootVolume).To(MatchFields(IgnoreExtras, Fields{
602602
"Name": Equal(fmt.Sprintf("%s-root", server.Name)),
603-
"Size": Equal(15),
603+
"Size": Equal(25),
604604
"Bootable": Equal("true"), // This is genuinely a string, not a bool
605605
}), "Boot volume %s for machine %s not as expected", rootVolume.ID, machine.Name)
606606

0 commit comments

Comments
 (0)