poststartup script moved to extra container, non init
This commit is contained in:
parent
518c6632bf
commit
1f98bd221e
@ -180,26 +180,25 @@ extraContainers:
|
||||
- -c
|
||||
- |
|
||||
set -ex
|
||||
echo "[initContainer] Waiting for Elasticsearch at $ES_URL..."
|
||||
echo "[template-loader] Waiting for Elasticsearch at $ES_URL..."
|
||||
for i in $(seq 1 ${MAX_RETRIES:-30}); do
|
||||
if curl -s "$ES_URL" >/dev/null; then
|
||||
echo "[initContainer] Elasticsearch is up!"
|
||||
echo "[template-loader] Elasticsearch is up!"
|
||||
break
|
||||
fi
|
||||
echo "[initContainer] Attempt $i: ES not ready, sleeping..."
|
||||
echo "[template-loader] Attempt $i: ES not ready, sleeping..."
|
||||
sleep "${RETRY_INTERVAL:-5}"
|
||||
done
|
||||
|
||||
echo "[initContainer] Applying templates..."
|
||||
echo "[template-loader] Applying templates..."
|
||||
for idx in "chat:$TEMPLATE_PATH_1" "message:$TEMPLATE_PATH_2" "user:$TEMPLATE_PATH_3"; do
|
||||
name="${idx%%:*}"
|
||||
path="${idx##*:}"
|
||||
echo "[initContainer] Applying $name from $path..."
|
||||
echo "[template-loader] Applying $name from $path..."
|
||||
curl -X PUT "$ES_URL/$name" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-binary @"$path"
|
||||
done
|
||||
echo "[initContainer] Done applying templates."
|
||||
echo "[template-loader] All templates applied. Exiting."
|
||||
env:
|
||||
- name: ES_URL
|
||||
value: "http://elasticsearch-master:9200"
|
||||
@ -209,6 +208,10 @@ extraContainers:
|
||||
value: "/templates/message.json"
|
||||
- name: TEMPLATE_PATH_3
|
||||
value: "/templates/user.json"
|
||||
- name: MAX_RETRIES
|
||||
value: "30"
|
||||
- name: RETRY_INTERVAL
|
||||
value: "5"
|
||||
volumeMounts:
|
||||
- name: index-template
|
||||
mountPath: /templates
|
||||
|
||||
Loading…
Reference in New Issue
Block a user