Replace minikube for e2e tests

This commit is contained in:
Manuel de Brito Fontes 2018-07-27 20:39:01 -04:00 committed by Manuel Alejandro de Brito Fontes
parent c0a30eac7f
commit 7032fb7d68
No known key found for this signature in database
GPG key ID: 786136016A8BA02A
9 changed files with 1837 additions and 118 deletions

1685
test/e2e/dind-cluster-v1.11.sh Executable file

File diff suppressed because it is too large Load diff

23
test/e2e/down.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
export PATH="$HOME/.kubeadm-dind-cluster:$SCRIPT_ROOT/build:$PATH"
dind-cluster-v1.11.sh down
dind-cluster-v1.11.sh clean

View file

@ -14,45 +14,37 @@
# See the License for the specific language governing permissions and
# limitations under the License.
export JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
set -e
echo "downloading kubectl..."
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$KUBERNETES_VERSION/bin/linux/amd64/kubectl && \
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "downloading minikube..."
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && \
chmod +x minikube && \
sudo mv minikube /usr/local/bin/
if test -e kubectl; then
echo "skipping download of kubectl"
else
echo "downloading kubectl..."
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.11.0/bin/linux/amd64/kubectl && \
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
fi
echo "starting minikube..."
# Using a lower value for sync-frequency to speed up the tests (during the cleanup of resources inside a namespace)
mkdir -p ${HOME}/.kube
touch ${HOME}/.kube/config
export KUBECONFIG=${HOME}/.kube/config
export MINIKUBE_WANTUPDATENOTIFICATION=false
export MINIKUBE_WANTREPORTERRORPROMPT=false
export MINIKUBE_HOME=$HOME
mkdir $HOME/.kube || true
touch $HOME/.kube/config
echo "starting Kubernetes cluster..."
$DIR/dind-cluster-v1.11.sh up
export KUBECONFIG=$HOME/.kube/config
kubectl config use-context dind
# workaround to avoid breaking the execution
set +o errexit
set +o pipefail
echo "Kubernetes cluster:"
kubectl get nodes -o wide
# --vm-driver=none, use host docker (avoid docker-in-docker)
# --bootstrapper=localkube, works around https://github.com/kubernetes/minikube/issues/2704
sudo -E minikube start \
--vm-driver=none \
--bootstrapper=localkube \
--kubernetes-version=$KUBERNETES_VERSION \
--extra-config=kubelet.sync-frequency=1s \
--extra-config=apiserver.authorization-mode=RBAC
export TAG=dev
export ARCH=amd64
export REGISTRY=${REGISTRY:-ingress-controller}
minikube update-context
echo "building container..."
make -C ${DIR}/../../ build container
echo "waiting for kubernetes cluster"
until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True";
do
sleep 1;
done
echo "copying docker image to cluster..."
DEV_IMAGE=${REGISTRY}/nginx-ingress-controller:${TAG}
${DIR}/dind-cluster-v1.11.sh copy-image ${DEV_IMAGE}