username, passsword were also deleted from script
This commit is contained in:
parent
39bd5cdc2c
commit
cff5c00aac
@ -582,14 +582,12 @@ postStart:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
LOG_FILE="/tmp/poststart.log"
|
||||
exec >> "$LOG_FILE" 2>&1
|
||||
echo "[postStart] Starting postStart hook..." >&2
|
||||
# Default values (override in env)
|
||||
MAX_RETRIES="${MAX_RETRIES:-30}"
|
||||
RETRY_INTERVAL="${RETRY_INTERVAL:-5}"
|
||||
# Validate required env vars
|
||||
REQUIRED_VARS=( "ES_USERNAME" "ELASTIC_PASSWORD" "ES_URL" "TEMPLATE_PATH_1" "TEMPLATE_PATH_2" "TEMPLATE_PATH_3")
|
||||
REQUIRED_VARS=( "ES_URL" "TEMPLATE_PATH_1" "TEMPLATE_PATH_2" "TEMPLATE_PATH_3")
|
||||
for var in "${REQUIRED_VARS[@]}"; do
|
||||
if [ -z "${!var:-}" ]; then
|
||||
echo "[postStart] ERROR: Required env var '$var' is not set!" >&2
|
||||
@ -598,7 +596,7 @@ postStart:
|
||||
done
|
||||
echo "[postStart] Waiting for Elasticsearch at $ES_URL to be ready..." >&2
|
||||
for ((i=1; i<=MAX_RETRIES; i++)); do
|
||||
if /usr/bin/curl -s -u "$ES_USERNAME:$ELASTIC_PASSWORD" "$ES_URL" >/dev/null; then
|
||||
if /usr/bin/curl -s "$ES_URL" >/dev/null; then
|
||||
echo "[postStart] Elasticsearch is up after $i attempts!" >&2
|
||||
break
|
||||
fi
|
||||
@ -614,7 +612,6 @@ postStart:
|
||||
name="${idx%%:*}"
|
||||
path="${idx##*:}"
|
||||
if ! /usr/bin/curl -X PUT "$ES_URL/$name" \
|
||||
-u "$ES_USERNAME:$ELASTIC_PASSWORD" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-binary @"$path"; then
|
||||
echo "[postStart] ERROR: Failed to apply index template for '$name' from '$path'" >&2
|
||||
@ -623,6 +620,7 @@ postStart:
|
||||
echo "[postStart] Applied template: $name" >&2
|
||||
done
|
||||
echo "[postStart] All index templates applied successfully." >&2
|
||||
|
||||
sysctlInitContainer:
|
||||
enabled: true
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user