username, passsword were also deleted from script

This commit is contained in:
Leo Sok 2025-07-24 12:16:06 +03:00
parent 39bd5cdc2c
commit cff5c00aac

View File

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