Use appropriate kubeadm config version for kubernetes version
Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
parent
78f1718b86
commit
ed5ff98c9e
@ -27,11 +27,20 @@ KIND="$(bazel info bazel-genfiles)/hack/bin/kind"
|
|||||||
|
|
||||||
# deploy_kind will deploy a kubernetes-in-docker cluster
|
# deploy_kind will deploy a kubernetes-in-docker cluster
|
||||||
deploy_kind() {
|
deploy_kind() {
|
||||||
|
# default to v1alpha3, if 1.11.x then use v1alpha2
|
||||||
|
vers="$(kubeVersion)"
|
||||||
|
config="v1alpha3"
|
||||||
|
if [[ "$vers" =~ v1\.11\..+ ]]; then
|
||||||
|
config="v1alpha2"
|
||||||
|
fi
|
||||||
|
echo "Booting Kubernetes version: $vers"
|
||||||
|
echo "Using kubeadm config api version '$config'"
|
||||||
|
|
||||||
# create the kind cluster
|
# create the kind cluster
|
||||||
"${KIND}" create cluster \
|
"${KIND}" create cluster \
|
||||||
--name="${KIND_CLUSTER_NAME}" \
|
--name="${KIND_CLUSTER_NAME}" \
|
||||||
--image="${KIND_IMAGE}" \
|
--image="${KIND_IMAGE}" \
|
||||||
--config "${REPO_ROOT}"/test/fixtures/kind-config.yaml
|
--config "${REPO_ROOT}"/test/fixtures/kind/config-"$config".yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy_kind
|
deploy_kind
|
||||||
|
|||||||
@ -35,3 +35,10 @@ DOCKER_REPO="quay.io/jetstack"
|
|||||||
# This defaults to 'build' so it doesn't conflict with images built for any
|
# This defaults to 'build' so it doesn't conflict with images built for any
|
||||||
# other purpose
|
# other purpose
|
||||||
DOCKER_TAG="build"
|
DOCKER_TAG="build"
|
||||||
|
|
||||||
|
function kubeVersion() {
|
||||||
|
echo $(docker run \
|
||||||
|
--entrypoint="cat" \
|
||||||
|
"${KIND_IMAGE}" \
|
||||||
|
/kind/version)
|
||||||
|
}
|
||||||
|
|||||||
19
test/fixtures/kind/config-v1alpha3.yaml
vendored
Normal file
19
test/fixtures/kind/config-v1alpha3.yaml
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# this config file is similar to the default, except we set the cluster's
|
||||||
|
# service cidr range to be 10.0.0.0/16.
|
||||||
|
# we do this because we need a fixed/predictable clusterIP of 10.0.0.15 for the
|
||||||
|
# nginx-ingress service, in order to perform HTTP01 validations during tests.
|
||||||
|
|
||||||
|
apiVersion: kind.sigs.k8s.io/v1alpha1
|
||||||
|
kind: Config
|
||||||
|
# template for kubeadm config, "" -> the default template
|
||||||
|
kubeadmConfigPatches:
|
||||||
|
- |
|
||||||
|
# config generated by kind
|
||||||
|
apiVersion: kubeadm.k8s.io/v1alpha3
|
||||||
|
kind: MasterConfiguration
|
||||||
|
networking:
|
||||||
|
serviceSubnet: 10.0.0.0/16
|
||||||
|
kubeletConfiguration:
|
||||||
|
baseConfig:
|
||||||
|
clusterDNS:
|
||||||
|
- 10.0.0.10
|
||||||
Loading…
Reference in New Issue
Block a user