Skip to content

Commit

Permalink
Kind improvements
Browse files Browse the repository at this point in the history
* kubectl 1.17.0
* pick up OS distribution depending on where the script runs
* pull image beforehand then load it in kind
  • Loading branch information
Vlatombe committed Jan 17, 2020
1 parent 88c6874 commit b9c2774
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,30 @@ set -euxo pipefail
export PATH=$WSTMP:$PATH
if [ \! -f $WSTMP/kind ]
then
curl -Lo $WSTMP/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64
curl -Lo $WSTMP/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname | tr '[:upper:]' '[:lower:]')-amd64
chmod +x $WSTMP/kind
fi
if [ \! -f $WSTMP/kubectl ]
then
curl -Lo $WSTMP/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.15.3/bin/linux/amd64/kubectl
curl -Lo $WSTMP/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/$(uname | tr '[:upper:]' '[:lower:]')/amd64/kubectl
chmod +x $WSTMP/kubectl
fi

# TODO use kind load to take better advantage of images cached in the host VM
export cluster=ci$RANDOM
export KUBECONFIG=$WSTMP/kubeconfig-$cluster
kind create cluster --name $cluster --wait 5m
function cleanup() {
kind export logs --name $cluster $WSTMP/kindlogs || :
kind delete cluster --name $cluster || :
rm $KUBECONFIG
}
trap cleanup EXIT
kubectl cluster-info

DOCKER_IMAGE=$(grep -e image: test-in-k8s.yaml | cut -d ':' -f 2- | xargs)
docker pull $DOCKER_IMAGE
kind load docker-image $DOCKER_IMAGE --name $cluster

bash test-in-k8s.sh
rm -rf $WSTMP/surefire-reports
kubectl cp jenkins:/checkout/target/surefire-reports $WSTMP/surefire-reports

0 comments on commit b9c2774

Please sign in to comment.