Skip to content

Commit fea3ef6

Browse files
authored
Add an option to use custom kind node image in e2e flow (kubernetes-sigs#2472)
1 parent a7eb643 commit fea3ef6

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

scripts/ci-e2e.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ main(){
180180
export EXP_CLUSTER_RESOURCE_SET=true
181181
export IBMACCOUNT_ID=${IBMACCOUNT_ID:-"7cfbd5381a434af7a09289e795840d4e"}
182182
export BASE64_API_KEY=$(tr -d '\n' <<<"$IBMCLOUD_API_KEY" | base64)
183+
export CUSTOM_KIND_NODE_IMAGE=${CUSTOM_KIND_NODE_IMAGE:-}
183184
# Setting controller loglevel to allow debug logs from the VPC/PowerVS client
184185
export LOGLEVEL=5
185186

test/e2e/config/ibmcloud-e2e-powervs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ variables:
4545
KUBERNETES_VERSION: "${KUBERNETES_VERSION:-v1.33.1}"
4646
# Below variable should be set based on the targeted environment
4747
SERVICE_ENDPOINT: "${SERVICE_ENDPOINT:-}"
48+
CUSTOM_KIND_NODE_IMAGE: ${CUSTOM_KIND_NODE_IMAGE:-}""
4849
# Cluster Addons
4950
CNI: "${PWD}/test/e2e/data/cni/calico/calico.yaml"
5051
IP_FAMILY: "IPv4"

test/e2e/suite_test.go

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ import (
4444
)
4545

4646
const (
47-
KubernetesVersion = "KUBERNETES_VERSION"
48-
CNIPath = "CNI"
49-
CNIResources = "CNI_RESOURCES"
47+
KubernetesVersion = "KUBERNETES_VERSION"
48+
CNIPath = "CNI"
49+
CNIResources = "CNI_RESOURCES"
50+
CustomKindNodeImage = "CUSTOM_KIND_NODE_IMAGE"
5051
)
5152

5253
// Test suite flags.
@@ -192,13 +193,22 @@ func createClusterctlLocalRepository(config *clusterctl.E2EConfig, repositoryFol
192193
}
193194

194195
func setupBootstrapCluster(config *clusterctl.E2EConfig, scheme *runtime.Scheme, useExistingCluster bool) (bootstrap.ClusterProvider, framework.ClusterProxy) {
195-
var clusterProvider bootstrap.ClusterProvider
196-
kubeconfigPath := ""
196+
var (
197+
clusterProvider bootstrap.ClusterProvider
198+
kubeconfigPath string
199+
)
200+
input := bootstrap.CreateKindBootstrapClusterAndLoadImagesInput{
201+
Name: config.ManagementClusterName,
202+
Images: config.Images,
203+
}
204+
205+
customImage := config.GetVariableOrEmpty(CustomKindNodeImage)
206+
if customImage != "" {
207+
input.CustomNodeImage = customImage
208+
}
209+
197210
if !useExistingCluster {
198-
clusterProvider = bootstrap.CreateKindBootstrapClusterAndLoadImages(context.TODO(), bootstrap.CreateKindBootstrapClusterAndLoadImagesInput{
199-
Name: config.ManagementClusterName,
200-
Images: config.Images,
201-
})
211+
clusterProvider = bootstrap.CreateKindBootstrapClusterAndLoadImages(context.TODO(), input)
202212
Expect(clusterProvider).ToNot(BeNil(), "Failed to create a bootstrap cluster")
203213

204214
kubeconfigPath = clusterProvider.GetKubeconfigPath()

0 commit comments

Comments
 (0)