@@ -8,6 +8,7 @@ KIND_CONTAINERD_CACHE_RESET="${K8S_CACHE_RESET:-$KIND_CONTAINERD_CACHE_RESET}"
88KIND_LOG_PATH=" ${KIND_LOG_PATH:- $TARGET_PATH / kind-logs} "
99KIND_LOG_RESOURCES_POLICY_PATH=" ${KIND_LOG_RESOURCES_POLICY_PATH:- $TARGET_PATH / kind-apiserver-audit-policy} "
1010KIND_EXPANDABLE_STORAGE_CLASSNAME=" ${EXPANDABLE_STORAGE_CLASSNAME:- expandable-sc} "
11+ K8S_IP_FAMILY=" ${K8S_IP_FAMILY:- ipv4} "
1112KIND_0_15_0=" ${KIND_0_15_0:- kind-0.15.0} "
1213KIND_0_20_0=" ${KIND_0_20_0:- kind-0.20.0} "
1314KIND_0_23_0=" ${KIND_0_23_0:- kind-0.23.0} "
@@ -122,10 +123,17 @@ update_k8s_config() {
122123 kubectl config set " clusters.kind-$KIND_NAME .insecure-skip-tls-verify" --set-raw-bytes true
123124 kubectl config unset " clusters.kind-$KIND_NAME .certificate-authority-data"
124125
125- screen -ls 2> /dev/null | grep ' \.kind-daemon ' \
126+ screen -ls 2> /dev/null | grep ' \.kind-tag-import-images ' \
126127 | tr ' [:space:]' ' ' | cut -d ' ' -f 2 | cut -d . -f 1 \
127128 | xargs -r -I % kill % || true
128- E2E_ENV=kind screen -dmS kind-daemon -L -Logfile " $HOME /.kind-daemon.log" " $SHELL " stackgres-k8s/e2e/e2e properly_tag_not_found_import_images
129+ E2E_ENV=kind screen -dmS kind-tag-import-images -L -Logfile " $HOME /.kind-tag-import-images.log" " $SHELL " stackgres-k8s/e2e/e2e properly_tag_not_found_import_images
130+ if [ " $K8S_IP_FAMILY " = ipv6 ]
131+ then
132+ screen -ls 2> /dev/null | grep ' \.kind-ipv6-dns-socat' \
133+ | tr ' [:space:]' ' ' | cut -d ' ' -f 2 | cut -d . -f 1 \
134+ | xargs -r -I % kill %
135+ screen -dmS kind-ipv6-dns-socat -L -Logfile " $HOME /.crc/kind-ipv6-dns-socat.log" socat UDP6-RECVFROM:5300,fork UDP4-SENDTO:127.0.0.53:53
136+ fi
129137}
130138
131139properly_tag_not_found_import_images () {
@@ -273,7 +281,8 @@ INNER_EOF
273281 fi
274282)
275283networking:
276- disableDefaultCNI: true
284+ ipFamily: "${K8S_IP_FAMILY} "
285+ disableDefaultCNI: $( if [ " $K8S_DISABLE_CALICO " != true ]; then printf true ; else printf false ; fi)
277286 apiServerAddress: "0.0.0.0"
278287nodes:
279288- role: control-plane
@@ -397,26 +406,36 @@ EOF
397406 kubectl patch deployment -n kube-system coredns --type json \
398407 --patch ' [{"op":"replace","path":"/spec/template/spec/containers/0/image","value":"k8s.gcr.io/coredns:1.3.1"}]'
399408 fi
409+ if [ " $K8S_IP_FAMILY " = ipv6 ]
410+ then
411+ DOCKER_IPV6=" $( docker inspect " $KIND_NAME -control-plane" --format=' {{range .NetworkSettings.Networks}}{{.IPv6Gateway}}{{end}}' ) "
412+ kubectl get -oyaml -n=kube-system configmap/coredns \
413+ | sed " s/forward .*$/forward . [$DOCKER_IPV6 ]:5300 {/" \
414+ | kubectl replace -f -
415+ fi
400416
401- echo " Setting up calico for kind..."
402- until kubectl get node --template ' {{ if (index .items 0).spec.podCIDR }}true{{ end }}' | grep -q ' true'
403- do
404- sleep 3
405- done
406- K8S_POD_CIDR=" $( kubectl get node --template ' {{ (index .items 0).spec.podCIDR }}' ) "
407- if [ " $( echo " $K8S_VERSION " | tr . ' \n' | head -n 2 | xargs -I @ printf ' %05d' @) " \
408- -ge " $( echo " 1.22" | tr . ' \n' | xargs -I @ printf ' %05d' @) " ]
417+ if [ " $K8S_DISABLE_CALICO " != true ]
409418 then
410- kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/tigera-operator.yaml
411- wait_until kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/custom-resources.yaml
412- kubectl patch installations.operator.tigera.io default --type json \
413- -p ' [{"op":"replace","path":"/spec/calicoNetwork/ipPools/0/cidr","value":"' " $K8S_POD_CIDR " ' "}]'
414- else
415- kubectl apply -f https://docs.projectcalico.org/v3.12/manifests/calico.yaml
416- kubectl -n kube-system set env daemonset/calico-node CALICO_IPV4POOL_CIDR=" $K8S_POD_CIDR "
417- kubectl -n kube-system set env daemonset/calico-node FELIX_IGNORELOOSERPF=true
419+ echo " Setting up calico for kind..."
420+ until kubectl get node --template ' {{ if (index .items 0).spec.podCIDR }}true{{ end }}' | grep -q ' true'
421+ do
422+ sleep 3
423+ done
424+ K8S_POD_CIDR=" $( kubectl get node --template ' {{ (index .items 0).spec.podCIDR }}' ) "
425+ if [ " $( echo " $K8S_VERSION " | tr . ' \n' | head -n 2 | xargs -I @ printf ' %05d' @) " \
426+ -ge " $( echo " 1.22" | tr . ' \n' | xargs -I @ printf ' %05d' @) " ]
427+ then
428+ kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/tigera-operator.yaml
429+ wait_until kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.26.4/manifests/custom-resources.yaml
430+ kubectl patch installations.operator.tigera.io default --type json \
431+ -p ' [{"op":"replace","path":"/spec/calicoNetwork/ipPools/0/cidr","value":"' " $K8S_POD_CIDR " ' "}]'
432+ else
433+ kubectl apply -f https://docs.projectcalico.org/v3.12/manifests/calico.yaml
434+ kubectl -n kube-system set env daemonset/calico-node CALICO_IPV4POOL_CIDR=" $K8S_POD_CIDR "
435+ kubectl -n kube-system set env daemonset/calico-node FELIX_IGNORELOOSERPF=true
436+ fi
437+ echo " ...done"
418438 fi
419- echo " ...done"
420439
421440 if [ " $K8S_DISABLE_VOLUME_SNAPSHOT " != true ]
422441 then
@@ -604,9 +623,15 @@ delete_k8s() {
604623 echo " ...done"
605624 fi
606625
607- screen -ls 2> /dev/null | grep ' \.kind-daemon ' \
626+ screen -ls 2> /dev/null | grep ' \.kind-tag-import-images ' \
608627 | tr ' [:space:]' ' ' | cut -d ' ' -f 2 | cut -d . -f 1 \
609628 | xargs -r -I % kill % || true
629+ if [ " $K8S_IP_FAMILY " = ipv6 ]
630+ then
631+ screen -ls 2> /dev/null | grep ' \.kind-ipv6-dns-socat' \
632+ | tr ' [:space:]' ' ' | cut -d ' ' -f 2 | cut -d . -f 1 \
633+ | xargs -r -I % kill % || true
634+ fi
610635}
611636
612637has_image_k8s () {
0 commit comments