2020 exit 1
2121fi
2222
23+ echo " Waiting for node(s) to be ready..."
24+ kubectl wait node --all --for=condition=Ready --timeout=120s
25+
2326cd " $( dirname " $0 " ) "
2427
2528case " $1 " in
@@ -52,6 +55,10 @@ exit 1
5255;;
5356esac
5457
58+ # As of SDP 26.3 CRDs are managed by the operator not helm, so there should be an initial delay
59+ # to allow the CRDs to be detected
60+ sleep 10
61+
5562echo " Installing ZooKeeper from zookeeper.yaml"
5663# tag::install-zookeeper[]
5764kubectl apply -f zookeeper.yaml
8996
9097echo " Awaiting HDFS rollout finish"
9198# tag::watch-hdfs-rollout[]
92- kubectl rollout status --watch statefulset/simple-hdfs-datanode-default --timeout=300s
93- kubectl rollout status --watch statefulset/simple-hdfs-journalnode-default --timeout=300s
94- kubectl rollout status --watch statefulset/simple-hdfs-namenode-default --timeout=300s
99+ kubectl rollout status --watch statefulset/simple-hdfs-datanode-default --timeout=600s
100+ kubectl rollout status --watch statefulset/simple-hdfs-journalnode-default --timeout=600s
101+ kubectl rollout status --watch statefulset/simple-hdfs-namenode-default --timeout=600s
95102# end::watch-hdfs-rollout[]
96103
97104echo " Installing PostgreSQL for Druid"
@@ -125,39 +132,36 @@ done
125132
126133echo " Awaiting Druid rollout finish"
127134# tag::watch-druid-rollout[]
128- kubectl rollout status --watch statefulset/simple-druid-broker-default --timeout=300s
129- kubectl rollout status --watch statefulset/simple-druid-coordinator-default --timeout=300s
130- kubectl rollout status --watch statefulset/simple-druid-historical-default --timeout=300s
131- kubectl rollout status --watch statefulset/simple-druid-middlemanager-default --timeout=300s
132- kubectl rollout status --watch statefulset/simple-druid-router-default --timeout=300s
135+ kubectl rollout status --watch statefulset/simple-druid-broker-default --timeout=600s
136+ kubectl rollout status --watch statefulset/simple-druid-coordinator-default --timeout=600s
137+ kubectl rollout status --watch statefulset/simple-druid-historical-default --timeout=600s
138+ kubectl rollout status --watch statefulset/simple-druid-middlemanager-default --timeout=600s
139+ kubectl rollout status --watch statefulset/simple-druid-router-default --timeout=600s
133140# end::watch-druid-rollout[]
134141
135- echo " Starting port-forwarding of port 9088"
136- # shellcheck disable=2069 # we want all output to be blackholed
137- # tag::port-forwarding[]
138- kubectl port-forward svc/simple-druid-router 9088 > /dev/null 2>&1 &
139- # end::port-forwarding[]
140- PORT_FORWARD_PID=$!
141- # shellcheck disable=2064 # we want the PID evaluated now, not at the time the trap is
142- trap " kill $PORT_FORWARD_PID " EXIT
143- sleep 5
142+ COORDINATOR=" simple-druid-coordinator-default-headless.default.svc.cluster.local"
143+ BROKER=" simple-druid-broker-default-headless.default.svc.cluster.local"
144144
145145submit_job () {
146- # tag::submit-job[]
147- curl -s -k -X ' POST' -H ' Content-Type:application/json' -d @ingestion_spec.json https://localhost:9088/druid/indexer/v1/task
148- # end::submit-job[]
146+ # tag::submit-job[]
147+ kubectl exec simple-druid-coordinator-default-0 -i -- \
148+ curl -s -k -X POST -H ' Content-Type:application/json' --data-binary @- \
149+ " https://${COORDINATOR} :8281/druid/indexer/v1/task" < ingestion_spec.json
150+ # end::submit-job[]
149151}
150152
151153echo " Submitting job"
152154task_id=$( submit_job | sed -e ' s/.*":"\([^"]\+\).*/\1/g' )
153155
154156request_job_status () {
155- curl -s -k " https://localhost:9088/druid/indexer/v1/task/${task_id} /status" | sed -e ' s/.*statusCode":"\([^"]\+\).*/\1/g'
157+ kubectl exec simple-druid-coordinator-default-0 -- \
158+ curl -s -k " https://${COORDINATOR} :8281/druid/indexer/v1/task/${task_id} /status" \
159+ | sed -e ' s/.*statusCode":"\([^"]\+\).*/\1/g'
156160}
157161
158162while [ " $( request_job_status) " == " RUNNING" ]; do
159163 echo " Task still running..."
160- sleep 5
164+ sleep 10
161165done
162166
163167task_status=$( request_job_status)
@@ -170,18 +174,22 @@ else
170174fi
171175
172176segment_load_status () {
173- curl -s -k https://localhost:9088/druid/coordinator/v1/loadstatus | sed -e ' s/.*wikipedia":\([0-9\.]\+\).*/\1/g'
177+ kubectl exec simple-druid-coordinator-default-0 -- \
178+ curl -s -k " https://${COORDINATOR} :8281/druid/coordinator/v1/loadstatus" \
179+ | sed -e ' s/.*wikipedia":\([0-9\.]\+\).*/\1/g'
174180}
175181
176182while [ " $( segment_load_status) " != " 100.0" ]; do
177183 echo " Segments still loading..."
178- sleep 5
184+ sleep 10
179185done
180186
181187query_data () {
182- # tag::query-data[]
183- curl -s -k -X ' POST' -H ' Content-Type:application/json' -d @query.json https://localhost:9088/druid/v2/sql
184- # end::query-data[]
188+ # tag::query-data[]
189+ kubectl exec simple-druid-broker-default-0 -i -- \
190+ curl -s -k -X POST -H ' Content-Type:application/json' --data-binary @- \
191+ " https://${BROKER} :8282/druid/v2/sql" < query.json
192+ # end::query-data[]
185193}
186194
187195echo " Querying data..."
0 commit comments