Fix kind cluster creation with kube 1.19 and 1.18

By specifying a different kind config that does not use an etcd flag that was only add in later etcd versions

Signed-off-by: irbekrm <irbekrm@gmail.com>
This commit is contained in:
irbekrm 2022-04-21 12:36:33 +01:00
parent 3e2433a66f
commit d720d8e02b
4 changed files with 20 additions and 2 deletions

View File

@ -163,7 +163,12 @@ setup_kind() {
# (1) Does the kind cluster already exist?
if ! kind get clusters -q | grep -q "^$kind_cluster_name\$"; then
trace kind create cluster --config make/config/kind/v1beta2.yaml \
# Kind with Kubernetes v1.18 and v1.19 need different config files
config="config_etcd_no_fsync"
if [[ "$k8s_version" == 1.18 || "$k8s_version" == 1.19 ]]; then
config="config"
fi
trace kind create cluster --config "make/config/kind/${config}.yaml" \
--image "$image" \
--name "$kind_cluster_name"
fi

View File

@ -0,0 +1,13 @@
# Kind config for kind 1.18 and 1.19 node images. Use
# make/config/kind/config_etcd_no_fsync.yaml for newer versions of kind as they
# support --unsafe-no-fsync etcd flag, which improves test speed.
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
metadata:
name: config
nodes:
- role: control-plane

View File

@ -64,7 +64,7 @@ e2e-setup-kind: kind-exists
# used as a prerequisite. If we were to use .PHONY, then the file's
# timestamp would not be used to check whether targets should be rebuilt,
# and they would get constantly rebuilt.
bin/scratch/kind-exists: make/config/kind/v1beta2.yaml preload-kind-image make/cluster.sh FORCE bin/tools/kind bin/tools/kubectl bin/tools/yq | bin/scratch
bin/scratch/kind-exists: make/config/kind/config.yaml make/config/kind/config_etcd_no_fsync.yaml preload-kind-image make/cluster.sh FORCE bin/tools/kind bin/tools/kubectl bin/tools/yq | bin/scratch
@$(eval KIND_CLUSTER_NAME ?= kind)
@make/cluster.sh --name $(KIND_CLUSTER_NAME)
@if [ "$(shell cat $@ 2>/dev/null)" != kind ]; then echo kind > $@; else touch $@; fi