forked from kotalco/kotal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multi.sh
executable file
·88 lines (76 loc) · 2.5 KB
/
multi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
set -e
K8S_PROVIDER="${K8S_PROVIDER:-kind}"
if ! docker info > /dev/null 2>&1; then
echo "Docker isn't running"
echo "Start docker, then try again!"
exit 1
fi
if [ "$KOTAL_VERSION" == "" ]
then
# build manager image once
echo "Building docker image"
make docker-build
fi
if [ "$K8S_PROVIDER" == "minikube" ]
then
# minikube cluster versions
VERSIONS=("1.19.0" "1.20.0" "1.21.0" "1.22.0" "1.23.0")
echo "🗑 Deleting all Minikube clusters"
minikube delete --all
else
# kind cluster versions
VERSIONS=("1.19.11" "1.20.7" "1.21.1" "1.22.4" "1.23.0")
echo "🗑 Deleting all Kind clusters"
kind delete clusters --all
fi
for VERSION in "${VERSIONS[@]}"
do
echo "Testing Kotal operator in kubernetes v$VERSION"
# start Kubernetes in Docker with this kubernetes version
echo "Creating cluster"
if [ "$K8S_PROVIDER" == "minikube" ]
then
minikube start --kubernetes-version=v${VERSION}
else
kind create cluster --image=kindest/node:v${VERSION}
fi
# install cert-manager
echo "Installing cert manager"
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.5.3/cert-manager.yaml
# load image and deploy manifests
echo "⏳ Waiting for cert manager to be up and running"
sleep 5
kubectl wait -n cert-manager --for=condition=available deployments/cert-manager --timeout=600s
kubectl wait -n cert-manager --for=condition=available deployments/cert-manager-cainjector --timeout=600s
kubectl wait -n cert-manager --for=condition=available deployments/cert-manager-webhook --timeout=600s
echo "🚀 Cert manager is up and running"
if [ "$KOTAL_VERSION" == "" ]
then
echo "Installing Kotal custom resources"
echo "Deploying Kotal controller manager"
if [ "$K8S_PROVIDER" == "minikube" ]
then
make minikube
else
make kind
fi
else
kubectl apply -f https://github.com/kotalco/kotal/releases/download/$KOTAL_VERSION/kotal.yaml
fi
echo "⏳ Waiting for kotal controller manager to be up and running"
kubectl wait -n kotal --for=condition=available deployments/controller-manager --timeout=600s
echo "🚀 Kotal is up and running"
echo "🔥 Running tests"
# test against image
USE_EXISTING_CLUSTER=true make test
# delete cluster
echo "🎉 All tests has been passed"
echo "🔥 Deleting kubernetes cluster v$VERSION"
if [ "$K8S_PROVIDER" == "minikube" ]
then
minikube delete
else
kind delete cluster
fi
done