Skip to content

Commit 521569f

Browse files
committed
wait for nodes and crds, change to FQDN names as per integration test
1 parent 92b4bab commit 521569f

2 files changed

Lines changed: 70 additions & 54 deletions

File tree

docs/modules/druid/examples/getting_started/getting_started.sh

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ then
2020
exit 1
2121
fi
2222

23+
echo "Waiting for node(s) to be ready..."
24+
kubectl wait node --all --for=condition=Ready --timeout=120s
25+
2326
cd "$(dirname "$0")"
2427

2528
case "$1" in
@@ -52,6 +55,10 @@ exit 1
5255
;;
5356
esac
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+
5562
echo "Installing ZooKeeper from zookeeper.yaml"
5663
# tag::install-zookeeper[]
5764
kubectl apply -f zookeeper.yaml
@@ -89,9 +96,9 @@ done
8996

9097
echo "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

97104
echo "Installing PostgreSQL for Druid"
@@ -125,39 +132,36 @@ done
125132

126133
echo "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

145145
submit_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

151153
echo "Submitting job"
152154
task_id=$(submit_job | sed -e 's/.*":"\([^"]\+\).*/\1/g')
153155

154156
request_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

158162
while [ "$(request_job_status)" == "RUNNING" ]; do
159163
echo "Task still running..."
160-
sleep 5
164+
sleep 10
161165
done
162166

163167
task_status=$(request_job_status)
@@ -170,18 +174,22 @@ else
170174
fi
171175

172176
segment_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

176182
while [ "$(segment_load_status)" != "100.0" ]; do
177183
echo "Segments still loading..."
178-
sleep 5
184+
sleep 10
179185
done
180186

181187
query_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

187195
echo "Querying data..."

docs/modules/druid/examples/getting_started/getting_started.sh.j2

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ then
2020
exit 1
2121
fi
2222

23+
echo "Waiting for node(s) to be ready..."
24+
kubectl wait node --all --for=condition=Ready --timeout=120s
25+
2326
cd "$(dirname "$0")"
2427

2528
case "$1" in
@@ -52,6 +55,10 @@ exit 1
5255
;;
5356
esac
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+
5562
echo "Installing ZooKeeper from zookeeper.yaml"
5663
# tag::install-zookeeper[]
5764
kubectl apply -f zookeeper.yaml
@@ -89,9 +96,9 @@ done
8996

9097
echo "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

97104
echo "Installing PostgreSQL for Druid"
@@ -125,39 +132,36 @@ done
125132

126133
echo "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

145145
submit_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

151153
echo "Submitting job"
152154
task_id=$(submit_job | sed -e 's/.*":"\([^"]\+\).*/\1/g')
153155

154156
request_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

158162
while [ "$(request_job_status)" == "RUNNING" ]; do
159163
echo "Task still running..."
160-
sleep 5
164+
sleep 10
161165
done
162166

163167
task_status=$(request_job_status)
@@ -170,18 +174,22 @@ else
170174
fi
171175

172176
segment_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

176182
while [ "$(segment_load_status)" != "100.0" ]; do
177183
echo "Segments still loading..."
178-
sleep 5
184+
sleep 10
179185
done
180186

181187
query_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

187195
echo "Querying data..."

0 commit comments

Comments
 (0)