Skip to content

Commit 404e1d1

Browse files
committed
Preload cert-manager images for e2e tests
1 parent f927eb2 commit 404e1d1

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

scripts/ci-conformance.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ source "${REPO_ROOT}/hack/ensure-go.sh"
3838
source "${REPO_ROOT}/hack/ensure-tags.sh"
3939
# shellcheck source=hack/util.sh
4040
source "${REPO_ROOT}/hack/util.sh"
41+
# shellcheck source=./scripts/ci-e2e-lib.sh
42+
source "${REPO_ROOT}/scripts/ci-e2e-lib.sh"
4143

4244
# Verify the required Environment Variables are present.
4345
capz::util::ensure_azure_envs
@@ -95,6 +97,11 @@ capz::ci-conformance::cleanup() {
9597

9698
trap capz::ci-conformance::cleanup EXIT
9799

100+
# pre-pull all the images that will be used in the e2e, thus making the actual test run
101+
# less sensible to the network speed. This includes:
102+
# - cert-manager images
103+
kind:prepullAdditionalImages
104+
98105
if [[ "${WINDOWS}" == "true" ]]; then
99106
make test-windows-upstream
100107
else

scripts/ci-e2e-lib.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Copyright 2025 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# kind:prepullAdditionalImages pre-pull all the additional (not Kindest/node) images that will be used in the e2e, thus making
18+
# the actual test run less sensible to the network speed.
19+
kind:prepullAdditionalImages () {
20+
# Pulling cert manager images so we can pre-load in kind nodes
21+
kind::prepullImage "quay.io/jetstack/cert-manager-cainjector:v1.19.1"
22+
kind::prepullImage "quay.io/jetstack/cert-manager-webhook:v1.19.1"
23+
kind::prepullImage "quay.io/jetstack/cert-manager-controller:v1.19.1"
24+
25+
# Pull all images defined in DOCKER_PRELOAD_IMAGES.
26+
for IMAGE in $(grep DOCKER_PRELOAD_IMAGES: < "$E2E_CONF_FILE" | sed -E 's/.*\[(.*)\].*/\1/' | tr ',' ' '); do
27+
kind::prepullImage "${IMAGE}"
28+
done
29+
}
30+
31+
# kind:prepullImage pre-pull a docker image if no already present locally.
32+
# The result will be available in the retVal value which is accessible from the caller.
33+
kind::prepullImage () {
34+
local image=$1
35+
image="${image//+/_}"
36+
37+
retVal=0
38+
if [[ "$(docker images -q "$image" 2> /dev/null)" == "" ]]; then
39+
echo "+ Pulling $image"
40+
docker pull "$image" || retVal=$?
41+
else
42+
echo "+ image $image already present in the system, skipping pre-pull"
43+
fi
44+
}

scripts/ci-e2e.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ source "${REPO_ROOT}/hack/ensure-go.sh"
3535
source "${REPO_ROOT}/hack/ensure-tags.sh"
3636
# shellcheck source=hack/util.sh
3737
source "${REPO_ROOT}/hack/util.sh"
38+
# shellcheck source=./scripts/ci-e2e-lib.sh
39+
source "${REPO_ROOT}/scripts/ci-e2e-lib.sh"
3840

3941
# Verify the required Environment Variables are present.
4042
capz::util::ensure_azure_envs
@@ -81,6 +83,11 @@ capz::ci-e2e::cleanup() {
8183
make test-e2e-run-cleanup || true
8284
}
8385

86+
# pre-pull all the images that will be used in the e2e, thus making the actual test run
87+
# less sensible to the network speed. This includes:
88+
# - cert-manager images
89+
kind:prepullAdditionalImages
90+
8491
trap capz::ci-e2e::cleanup EXIT
8592
# Image is configured as `${CONTROLLER_IMG}-${ARCH}:${TAG}` where `CONTROLLER_IMG` is defaulted to `${REGISTRY}/${IMAGE_NAME}`.
8693
if [[ "${BUILD_MANAGER_IMAGE}" == "false" ]]; then

test/e2e/config/azure-dev.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ images:
1111
loadBehavior: tryLoad
1212
- name: registry.k8s.io/cluster-api-helm/cluster-api-helm-controller:v0.4.1
1313
loadBehavior: tryLoad
14+
- name: quay.io/jetstack/cert-manager-cainjector:v1.19.1
15+
loadBehavior: tryLoad
16+
- name: quay.io/jetstack/cert-manager-webhook:v1.19.1
17+
loadBehavior: tryLoad
18+
- name: quay.io/jetstack/cert-manager-controller:v1.19.1
19+
loadBehavior: tryLoad
1420

1521
providers:
1622
- name: cluster-api

0 commit comments

Comments
 (0)