Skip to content

Commit 29865ba

Browse files
authored
Merge pull request #12239 from k8s-infra-cherrypick-robot/cherry-pick-12186-to-release-1.10
[release-1.10] 🌱Add an option to override custom node image name for kind cluster
2 parents 718dac1 + 39207ca commit 29865ba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/framework/bootstrap/kind_util.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,16 @@ type CreateKindBootstrapClusterAndLoadImagesInput struct {
5757

5858
// ExtraPortMappings specifies the port forward configuration of the kind node.
5959
ExtraPortMappings []kindv1.PortMapping
60+
61+
// CustomNodeImage is the custom node image used for creating the kind node
62+
CustomNodeImage string
6063
}
6164

6265
// CreateKindBootstrapClusterAndLoadImages returns a new Kubernetes cluster with pre-loaded images.
6366
func CreateKindBootstrapClusterAndLoadImages(ctx context.Context, input CreateKindBootstrapClusterAndLoadImagesInput) ClusterProvider {
6467
Expect(ctx).NotTo(BeNil(), "ctx is required for CreateKindBootstrapClusterAndLoadImages")
6568
Expect(input.Name).ToNot(BeEmpty(), "Invalid argument. Name can't be empty when calling CreateKindBootstrapClusterAndLoadImages")
69+
Expect(input.KubernetesVersion != "" && input.CustomNodeImage != "").To(BeFalse(), "Invalid input. Either KubernetesVersion or CustomNodeImage should be passed")
6670

6771
log.Logf("Creating a kind cluster with name %q", input.Name)
6872

@@ -89,6 +93,9 @@ func CreateKindBootstrapClusterAndLoadImages(ctx context.Context, input CreateKi
8993
if input.LogFolder != "" {
9094
options = append(options, LogFolder(input.LogFolder))
9195
}
96+
if input.CustomNodeImage != "" {
97+
options = append(options, WithNodeImage(input.CustomNodeImage))
98+
}
9299
options = append(options, WithExtraPortMappings(input.ExtraPortMappings))
93100

94101
clusterProvider := NewKindClusterProvider(input.Name, options...)

0 commit comments

Comments
 (0)