Skip to content

Commit 4e0332b

Browse files
committed
Don't use latest stable version for minikube
Sometimes, minikube lags behind kubernetes which can lead to a breakage of the test suite, since minikube will fail to start with the latest kubernetes version. See for example [this issue](kubernetes/minikube#4371). This change defaults to leave the decision of which k8s version to use, to minikube itself. This is defined in: https://github.com/kubernetes/minikube/master/pkg/minikube/constants/constants.go However, if one really desires it is still possible to pass `--kubernetes-version=X.Y.Z` to minikube initialization start command via an environment variable before invoking the test suite: export $MINIKUBE_ARGS="--kubernetes-version=X.Y.Z" This allows ofcourse passing other flags to minikube also.
1 parent c86e489 commit 4e0332b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/kube-init.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,19 @@ else
4444
fi
4545
docker --version
4646

47-
# Get the latest stable version of kubernetes
47+
# Get the latest stable version of kubernetes, this is not always what minikube
48+
# installs per default
49+
# See: https://github.com/kubernetes/minikube/master/pkg/minikube/constants/constants.go
4850
K8S_VERSION=$(curl -sS https://storage.googleapis.com/kubernetes-release/release/stable.txt)
4951
echo "K8S_VERSION : ${K8S_VERSION}"
5052

53+
# You can pass variables to minikube using MINIKUBE_ARGS
54+
# If using tox you can export TOX_TESTENV_PASSENV.
55+
# For example, you can run:
56+
# $ export TOX_TESTENV_PASSENV="MINIKUBE_ARGS=--kubernetes-version=1.X.Y"
57+
# now tox will run minikube with the specified flag
58+
MINIKUBE_ARGS=${MINIKUBE_ARGS:-""}
59+
5160
echo "Starting docker service"
5261
sudo systemctl enable docker.service
5362
sudo systemctl start docker.service --ignore-dependencies
@@ -80,7 +89,7 @@ export MINIKUBE_DRIVER=${MINIKUBE_DRIVER:-none}
8089
# Used bootstrapper to be kubeadm for the most recent k8s version
8190
# since localkube is depreciated and only supported up to version 1.10.0
8291
echo "Starting minikube"
83-
sudo minikube start --vm-driver=$MINIKUBE_DRIVER --bootstrapper=kubeadm --kubernetes-version=$K8S_VERSION --logtostderr
92+
sudo minikube start --vm-driver=$MINIKUBE_DRIVER --bootstrapper=kubeadm --logtostderr $MINIKUBE_ARGS
8493

8594
MINIKUBE_OK="false"
8695

0 commit comments

Comments
 (0)