@@ -14,32 +14,17 @@ MULTUS_MANIFEST="${MULTUS_MANIFEST:-multus-daemonset-thick.yml}"
1414# define the dockerfile to build multus.
1515# Acceptable values are `Dockerfile`. `Dockerfile.thick`.
1616# Defaults to `Dockerfile.thick`.
17- MULTUS_DOCKERFILE=" ${MULTUS_MANIFEST :- Dockerfile.thick} "
17+ MULTUS_DOCKERFILE=" ${MULTUS_DOCKERFILE :- Dockerfile.thick} "
1818
1919kind_network=' kind'
20- reg_name=' kind-registry'
21- reg_port=' 5000'
22- running=" $( $OCI_BIN inspect -f ' {{.State.Running}}' " ${reg_name} " 2> /dev/null || true) "
23- if [ " ${running} " != ' true' ]; then
24- # run registry and push the multus image
25- $OCI_BIN run -d --restart=always -p " ${reg_port} :5000" --name " ${reg_name} " registry:2
26- $OCI_BIN build -t localhost:5000/multus:e2e -f ../images/${MULTUS_DOCKERFILE} ..
27- $OCI_BIN push localhost:5000/multus:e2e
20+ if [ " ${MULTUS_DOCKERFILE} " != " none" ]; then
21+ $OCI_BIN build -t localhost:5000/multus:e2e -f ../images/${MULTUS_DOCKERFILE} ..
2822fi
29- reg_host=" ${reg_name} "
30- if [ " ${kind_network} " = " bridge" ]; then
31- reg_host=" $( $OCI_BIN inspect -f ' {{.NetworkSettings.IPAddress}}' " ${reg_name} " ) "
32- fi
33- echo " Registry Host: ${reg_host} "
3423
3524# deploy cluster with kind
3625cat << EOF | kind create cluster --config=-
3726kind: Cluster
3827apiVersion: kind.x-k8s.io/v1alpha4
39- containerdConfigPatches:
40- - |-
41- [plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port} "]
42- endpoint = ["http://${reg_host} :${reg_port} "]
4328nodes:
4429 - role: control-plane
4530 - role: worker
@@ -52,28 +37,8 @@ nodes:
5237 - role: worker
5338EOF
5439
55- cat << EOF | kubectl apply -f -
56- apiVersion: v1
57- kind: ConfigMap
58- metadata:
59- name: local-registry-hosting
60- namespace: kube-public
61- data:
62- localRegistryHosting.v1: |
63- host: "localhost:${reg_port} "
64- help: "https://kind.sigs.k8s.io/docs/user/local-registry/"
65- EOF
66-
67- containers=$( $OCI_BIN network inspect ${kind_network} -f " {{range .Containers}}{{.Name}} {{end}}" )
68- needs_connect=" true"
69- for c in $containers ; do
70- if [ " $c " = " ${reg_name} " ]; then
71- needs_connect=" false"
72- fi
73- done
74- if [ " ${needs_connect} " = " true" ]; then
75- $OCI_BIN network connect " ${kind_network} " " ${reg_name} " || true
76- fi
40+ # load multus image from container host to kind node
41+ kind load docker-image localhost:5000/multus:e2e
7742
7843worker1_pid=$( $OCI_BIN inspect --format " {{ .State.Pid }}" kind-worker)
7944worker2_pid=$( $OCI_BIN inspect --format " {{ .State.Pid }}" kind-worker2)
0 commit comments