-
Notifications
You must be signed in to change notification settings - Fork 48
/
multi.sh
executable file
·101 lines (87 loc) · 2.81 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
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh
set -e
K8S_PROVIDER="${K8S_PROVIDER:-kind}"
function cleanup {
echo "🧽 Cleaning up"
if [ "$K8S_PROVIDER" == "minikube" ]
then
minikube delete --all
else
kind delete clusters --all
fi
}
trap cleanup EXIT
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" "1.24.0" "1.25.0" "1.26.0")
echo "🗑 Deleting all Minikube clusters"
minikube delete --all
else
# kind cluster versions
# https://hub.docker.com/r/kindest/node/tags
VERSIONS=("1.19.16" "1.20.15" "1.21.14" "1.22.17" "1.23.17" "1.24.15" "1.25.11" "1.26.6" "1.27.3" "1.28.0" "1.29.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