-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Run e2e integration tests in Kind (#191)
- Loading branch information
Showing
6 changed files
with
117 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
# If there was a kind cluster created during CI, tear it down. | ||
KIND="$HOME/bin/kind" | ||
if [[ -f "$KIND" ]]; then | ||
echo "--- :kubernetes: deleting kind cluster" | ||
$KIND get clusters -q | while read -r CLUSTER; do | ||
$KIND delete cluster --name "$CLUSTER" | ||
done | ||
fi | ||
|
||
echo "--- :git: cleaning checkout" | ||
git clean -dffx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
|
||
set -exo pipefail | ||
|
||
echo "--- :kubernetes: Installing kind" | ||
|
||
KUBE_VERSION=${KUBE_VERSION:-v1.15.7} | ||
CLUSTER_NAME=kind | ||
L_UNAME=$(uname | tr "[:upper:]" "[:lower:]") | ||
|
||
mkdir -p "$HOME/bin" | ||
|
||
if [[ ! -x "$HOME/bin/kind" || "$BUILDKITE" == "true" ]]; then | ||
curl -sL -o "$HOME/bin/kind" "https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-${L_UNAME}-amd64" | ||
fi | ||
|
||
if [[ ! -x "$HOME/bin/kubectl" || "$BUILDKITE" == "true" ]]; then | ||
curl -sL -o "$HOME/bin/kubectl" "https://storage.googleapis.com/kubernetes-release/release/$KUBE_VERSION/bin/${L_UNAME}/amd64/kubectl" | ||
fi | ||
|
||
chmod +x "$HOME/bin/kind" "$HOME/bin/kubectl" | ||
export PATH="$HOME/bin:$PATH" | ||
|
||
echo "--- :kubernetes: Deleting existing kind clusters" | ||
kind get clusters -q | while read -r CLUSTER; do | ||
kind delete cluster --name "$CLUSTER" | ||
done | ||
|
||
echo "--- :kubernetes: Creating kind cluster" | ||
|
||
cat > cluster.yaml <<EOF | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
- role: worker | ||
kubeadmConfigPatches: | ||
- | | ||
apiVersion: kubeadm.k8s.io/v1beta2 | ||
kind: JoinConfiguration | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
node-labels: "failure-domain.beta.kubernetes.io/zone=us-east1-b" | ||
- role: worker | ||
kubeadmConfigPatches: | ||
- | | ||
apiVersion: kubeadm.k8s.io/v1beta2 | ||
kind: JoinConfiguration | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
node-labels: "failure-domain.beta.kubernetes.io/zone=us-east1-c" | ||
- role: worker | ||
kubeadmConfigPatches: | ||
- | | ||
apiVersion: kubeadm.k8s.io/v1beta2 | ||
kind: JoinConfiguration | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
node-labels: "failure-domain.beta.kubernetes.io/zone=us-east1-d" | ||
EOF | ||
|
||
kind create cluster --image "kindest/node:$KUBE_VERSION" --name "$CLUSTER_NAME" --config cluster.yaml | ||
|
||
kubectl get nodes | ||
kubectl cluster-info | ||
|
||
echo "--- :kubernetes: Kind cluster created" | ||
|
||
echo "--- Waiting for cluster to be ready" | ||
while kubectl get nodes | grep -q NotReady; do | ||
sleep 5 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters