-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgetting_started.sh
More file actions
executable file
·129 lines (111 loc) · 4.27 KB
/
Copy pathgetting_started.sh
File metadata and controls
executable file
·129 lines (111 loc) · 4.27 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#! /usr/bin/env bash
set -euo pipefail
# DO NOT EDIT THE SCRIPT
# Instead, update the j2 template, and regenerate it for dev with `make render-docs`.
# TODO (@NickLarsenNZ): Use bitnami/postgres chart, and add version var to the above list
# See similar changes in: https://github.com/stackabletech/hive-operator/pull/489/commits/8189f196f018c009370ae9b07a3f9609ee2e8681
# This script contains all the code snippets from the guide, as well as some assert tests
# to test if the instructions in the guide work. The user *could* use it, but it is intended
# for testing only.
# The script will install the operators, create a superset instance and briefly open a port
# forward and connect to the superset instance to make sure it is up and running.
# No running processes are left behind (i.e. the port-forwarding is closed at the end)
if [ $# -eq 0 ]
then
echo "Installation method argument ('helm' or 'stackablectl') required."
exit 1
fi
cd "$(dirname "$0")"
case "$1" in
"helm")
echo "Installing Operators with Helm"
# tag::helm-install-operators[]
helm install --wait commons-operator oci://oci.stackable.tech/sdp-charts/commons-operator --version 26.7.0-rc1
helm install --wait secret-operator oci://oci.stackable.tech/sdp-charts/secret-operator --version 26.7.0-rc1
helm install --wait listener-operator oci://oci.stackable.tech/sdp-charts/listener-operator --version 26.7.0-rc1
helm install --wait superset-operator oci://oci.stackable.tech/sdp-charts/superset-operator --version 26.7.0-rc1
# end::helm-install-operators[]
;;
"stackablectl")
echo "installing Operators with stackablectl"
# tag::stackablectl-install-operators[]
stackablectl operator install \
commons=26.7.0-rc1 \
secret=26.7.0-rc1 \
listener=26.7.0-rc1 \
superset=26.7.0-rc1
# end::stackablectl-install-operators[]
;;
*)
echo "Need to give 'helm' or 'stackablectl' as an argument for which installation method to use!"
exit 1
;;
esac
# TODO: Remove once https://github.com/stackabletech/issues/issues/828 has been
# implemented (see that issue for details).
until kubectl get crd supersetclusters.superset.stackable.tech >/dev/null 2>&1; do
echo "Waiting for CRDs to be installed"
sleep 1
done
until kubectl get crd druidconnections.superset.stackable.tech >/dev/null 2>&1; do
echo "Waiting for CRDs to be installed"
sleep 1
done
echo "Installing bitnami PostgreSQL"
# tag::install-bitnami-psql[]
helm install superset oci://registry-1.docker.io/bitnamicharts/postgresql \
--version 16.5.0 \
--set image.repository=bitnamilegacy/postgresql \
--set volumePermissions.image.repository=bitnamilegacy/os-shell \
--set metrics.image.repository=bitnamilegacy/postgres-exporter \
--set global.security.allowInsecureImages=true \
--set auth.username=superset \
--set auth.password=superset \
--set auth.database=superset \
--wait
# end::install-bitnami-psql[]
echo "Creating credentials secret"
# tag::apply-superset-credentials[]
kubectl apply -f superset-credentials.yaml
# end::apply-superset-credentials[]
echo "Creating Superset cluster"
# tag::apply-superset-cluster[]
kubectl apply -f superset.yaml
# end::apply-superset-cluster[]
sleep 5
for (( i=1; i<=15; i++ ))
do
echo "Waiting for SupersetCluster to appear ..."
if eval kubectl get statefulset simple-superset-node-default; then
break
fi
sleep 1
done
echo "Waiting on superset StatefulSet ..."
# tag::wait-superset[]
kubectl rollout status --watch statefulset/simple-superset-node-default --timeout 300s
# end::wait-superset[]
# wait a bit for the port to open
sleep 10
echo "Starting port-forwarding of port 8088"
# tag::port-forwarding[]
kubectl port-forward service/simple-superset-node 8088 > /dev/null 2>&1 &
# end::port-forwarding[]
PORT_FORWARD_PID=$!
# shellcheck disable=2064 # we want the PID evaluated now, not at the time the trap is
trap "kill $PORT_FORWARD_PID" EXIT
sleep 5
echo "Checking if web interface is reachable ..."
return_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8088/login/)
if [ "$return_code" == 200 ]; then
echo "Web interface reachable!"
else
echo "Could not reach web interface."
exit 1
fi
echo "Loading examples ..."
# tag::load-examples[]
kubectl apply -f superset-load-examples-job.yaml
sleep 5
kubectl wait --for=condition=complete --timeout=1500s job/superset-load-examples
# end::load-examples[]