Skip to content

Commit ae4cb94

Browse files
authored
Add parameter for ipFamily in kind (#2578)
1 parent 8b1218d commit ae4cb94

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

tests/Makefile

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
SHELL=/bin/bash
12
CONTEXT =
23
BUILD_IMAGE = nginx/nginx-ingress:edge
34
PULL_POLICY = IfNotPresent
@@ -12,18 +13,9 @@ KIND_KUBE_CONFIG_FOLDER = $${HOME}/.kube/kind
1213
SHOW_IC_LOGS = no
1314
PYTEST_ARGS =
1415
DOCKERFILEPATH = docker/Dockerfile
15-
KIND_TEMPLATE_FILE_PATH=kind/kind-config-template.yaml
16-
IP_FAMILY ?= ipv4
17-
IP_ADDR_PROPERTY = .IPAddress
18-
IP_ADDR_FMT = "%s"
19-
API_SERVER_ADDR = 127.0.0.1
16+
IP_FAMILY=dual
2017

2118

22-
ifeq (${IP_FAMILY}, ipv6)
23-
IP_ADDR_PROPERTY = .GlobalIPv6Address
24-
IP_ADDR_FMT = "[%s]"
25-
endif
26-
2719
define PRINT_HELP_PYSCRIPT
2820
import re, sys
2921

@@ -52,15 +44,9 @@ run-tests: ## Run tests
5244
docker run --rm -v $(KUBE_CONFIG_FOLDER):/root/.kube $(PREFIX):$(TAG) --context=$(CONTEXT) --image=$(BUILD_IMAGE) --image-pull-policy=$(PULL_POLICY) --deployment-type=$(DEPLOYMENT_TYPE) --ic-type=$(IC_TYPE) --service=$(SERVICE) --node-ip=$(NODE_IP) --show-ic-logs=$(SHOW_IC_LOGS) $(PYTEST_ARGS)
5345

5446

55-
.PHONY: get-kind-cluster-ip ## Get Kind cluster IP Address
56-
get-kind-cluster-ip:
57-
$(eval KIND_CLUSTER_IP=$(shell docker inspect -f '{{range .NetworkSettings.Networks}}{{${IP_ADDR_PROPERTY}}}{{end}}' kind-control-plane ))
58-
$(eval KIND_CLUSTER_IP=$(shell printf ${IP_ADDR_FMT} "${KIND_CLUSTER_IP}"))
59-
60-
6147
.PHONY: update-test-kind-config ## Update Kind config
62-
update-test-kind-config: get-kind-cluster-ip
63-
sed -ir "s|server:.*|server: https://${KIND_CLUSTER_IP}:6443|" $(KIND_KUBE_CONFIG_FOLDER)/config
48+
update-test-kind-config:
49+
sed -ir "s|server:.*|server: https://kind-control-plane:6443|" $(KIND_KUBE_CONFIG_FOLDER)/config
6450

6551

6652
.PHONY: run-tests-in-kind
@@ -71,16 +57,15 @@ run-tests-in-kind: update-test-kind-config ## Run tests in Kind
7157
--deployment-type=$(DEPLOYMENT_TYPE) \
7258
--ic-type=$(IC_TYPE) \
7359
--service=nodeport \
74-
--node-ip=$(KIND_CLUSTER_IP) \
60+
--node-ip=kind-control-plane \
7561
--show-ic-logs=$(SHOW_IC_LOGS) \
7662
$(PYTEST_ARGS)
7763

7864

7965
.PHONY: create-kind-cluster
8066
create-kind-cluster: ## Create Kind cluster
8167
$(eval KIND_IMAGE=$(shell grep -m1 'FROM kindest/node' <docker/Dockerfile | awk -F'[ ]' '{print $$2}'))
82-
cat ${KIND_TEMPLATE_FILE_PATH} | sed "s/{{.IPFamily}}/${IP_FAMILY}/" | sed "s/{{.APIServerAddress}}/${API_SERVER_ADDR}/" > kind-config.yaml
83-
kind create cluster --image $(KIND_IMAGE) --config kind-config.yaml
68+
kind create cluster --image $(KIND_IMAGE) --config=<(sed 's/dual/${IP_FAMILY}/' ./ci-files/ci-kind-config.yaml)
8469
kind export kubeconfig --kubeconfig $(KIND_KUBE_CONFIG_FOLDER)/config
8570

8671

0 commit comments

Comments
 (0)