forked from observatorium/observatorium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquickstart.sh
executable file
·104 lines (85 loc) · 3.94 KB
/
quickstart.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
102
103
104
#!/bin/bash
set -e
set -o pipefail
trap 'kill 0' SIGTERM
KUBECTL="${KUBECTL:-kubectl}"
KIND="${KIND:-kind}"
if [ ! $(command -v "$KIND") ]; then
echo "Cannot find or execute KIND binary $KIND, you can override it by setting the KIND env variable"
exit 1
fi
if [ ! $(command -v "$KUBECTL") ]; then
echo "Cannot find or execute Kubectl binary $KUBECTL, you can override it by setting the KUBECTL env variable"
exit 1
fi
setup() {
echo "-------------------------------------------"
echo "- Creating KIND cluster... -"
echo "-------------------------------------------"
$KIND create cluster
}
deploy() {
echo "-------------------------------------------"
echo "- Creating namespaces... -"
echo "-------------------------------------------"
$KUBECTL create namespace hydra --dry-run=client -o yaml | $KUBECTL apply -f -
$KUBECTL create namespace observatorium --dry-run=client -o yaml | $KUBECTL apply -f -
$KUBECTL create namespace observability --dry-run=client -o yaml | $KUBECTL apply -f -
$KUBECTL create namespace observatorium-minio --dry-run=client -o yaml | $KUBECTL apply -f -
echo "-------------------------------------------"
echo "- Deploying MinIO... -"
echo "-------------------------------------------"
$KUBECTL apply -f ./manifests/minio
$KUBECTL wait --for=condition=available --timeout=5m -n observatorium-minio deploy/minio
echo "-------------------------------------------"
echo "- Deploying Hydra... -"
echo "-------------------------------------------"
$KUBECTL apply -f ./manifests/hydra
echo "-------------------------------------------"
echo "- Deploying kube-prometheus... -"
echo "-------------------------------------------"
$KUBECTL apply --server-side -f ./manifests/kube-prometheus/setup
until $KUBECTL get servicemonitors --all-namespaces ; do date; sleep 1; echo ""; done
$KUBECTL apply --server-side -f ./manifests/kube-prometheus/
echo "-------------------------------------------"
echo "- Deploying Jaeger Operator... -"
echo "-------------------------------------------"
$KUBECTL apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.7.1/cert-manager.yaml
$KUBECTL wait --for=condition=available --timeout=5m -n cert-manager deploy/cert-manager
$KUBECTL wait --for=condition=available --timeout=5m -n cert-manager deploy/cert-manager-cainjector
$KUBECTL wait --for=condition=available --timeout=5m -n cert-manager deploy/cert-manager-webhook
$KUBECTL apply -f https://github.com/jaegertracing/jaeger-operator/releases/download/v1.32.0/jaeger-operator.yaml -n observability
echo "-------------------------------------------"
echo "- Deploying OpenTelemetry Operator... -"
echo "-------------------------------------------"
$KUBECTL apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml
echo "-------------------------------------------"
echo "- Deploying Observatorium... -"
echo "-------------------------------------------"
$KUBECTL wait --for=condition=available --timeout=5m -n observability deploy/jaeger-operator
$KUBECTL wait --for=condition=available --timeout=5m -n opentelemetry-operator-system deploy/opentelemetry-operator-controller-manager
$KUBECTL wait --for=condition=available --timeout=10m -n hydra deploy/hydra
$KUBECTL apply -f ./manifests/token-refresher
$KUBECTL apply -f ./manifests/observatorium
echo "-------------------------------------------"
echo "- Waiting for Observatorium to come up... -"
echo "-------------------------------------------"
$KUBECTL wait --for=condition=available --timeout=5m -n observatorium deploy/observatorium-xyz-thanos-query-frontend
$KUBECTL wait --for=condition=available --timeout=5m -n observatorium deploy/observatorium-xyz-observatorium-api
}
case $1 in
setup)
setup
;;
deploy)
deploy
;;
help)
echo "usage: $(basename "$0") { setup | deploy }"
;;
*)
setup
deploy
;;
esac
wait