-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsmoketest.sh
executable file
·62 lines (57 loc) · 2.24 KB
/
smoketest.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
#!/bin/sh
set -xe
DIR="$(dirname "$(readlink -f "$0")")"
if [ -z "$IMAGE_REPOSITORY" ]; then
IMAGE_REPOSITORY=cryostat
fi
cleanKind() {
kind delete cluster
}
while [ "$#" -ne 0 ]; do
case "$1" in
kind)
cleanKind
kind create cluster
kind load docker-image "quay.io/${IMAGE_REPOSITORY}/cryostat3:dev"
kind load docker-image "quay.io/${IMAGE_REPOSITORY}/cryostat3-db:dev"
;;
unkind)
cleanKind
;;
generate)
sh "./../../db/build.sh"
kompose convert -o "./" -f "./../compose/db_k8s.yml" -f "./../compose/s3-minio.yml" -f "./../compose/cryostat_k8s.yml" -f "./../compose/sample-apps.yml" --build local
sh generate.sh
;;
apply)
kubectl apply -f "./*.yaml"
kubectl patch -p "{\"spec\":{\"template\":{\"spec\":{\"\$setElementOrder/containers\":[{\"name\":\"db\"}],\"containers\":[{\"image\":\"quay.io/$IMAGE_REPOSITORY/cryostat3-db:dev\",\"name\":\"db\"}]}}}}" deployment/db
kubectl wait \
--for condition=available \
--timeout=5m \
deployment db
kubectl patch -p "{\"spec\":{\"template\":{\"spec\":{\"\$setElementOrder/containers\":[{\"name\":\"cryostat\"}],\"containers\":[{\"image\":\"quay.io/$IMAGE_REPOSITORY/cryostat3:dev\",\"name\":\"cryostat\"}]}}}}" deployment/cryostat
kubectl wait \
--for condition=available \
--timeout=5m \
deployment cryostat
;;
clean)
kubectl delete -f "./*.yaml"
;;
forward)
sh -c '(sleep 1 ; xdg-open http://localhost:9001 ; xdg-open http://localhost:8181 ; xdg-open http://localhost:8989)&'
if ! kubectl multiforward smoketest; then
echo "Run the following to expose the applications:"
echo "kubectl port-forward svc/cryostat 8181"
echo "kubectl port-forward svc/s3 9001"
echo "kubectl port-forward svc/db-viewer 8989"
fi
;;
*)
echo "Usage: $0 [clean|generate|apply|kind|unkind|forward]"
exit 1
;;
esac
shift
done