From f7dc10710711db2920751495f98009929265f136 Mon Sep 17 00:00:00 2001 From: Leo Sok Date: Mon, 16 Jun 2025 16:51:24 +0300 Subject: [PATCH] elastic https disabled --- elasticsearch/values.yaml | 65 +++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/elasticsearch/values.yaml b/elasticsearch/values.yaml index 3cb7594..86d6077 100644 --- a/elasticsearch/values.yaml +++ b/elasticsearch/values.yaml @@ -306,7 +306,7 @@ postStart: set -euo pipefail echo "[postStart] Waiting for Elasticsearch to be ready..." >&2 for ((i=1; i<=MAX_RETRIES; i++)); do - if /usr/bin/curl --cacert "$CA_CERT" -s -u "$ES_USERNAME:$ELASTIC_PASSWORD" "$ES_URL" >/dev/null; then + if /usr/bin/curl -s "$ES_URL" >/dev/null; then # Removed --cacert and -u flags echo "[postStart] Elasticsearch is up after $i attempts!" >&2 break fi @@ -316,30 +316,69 @@ postStart: fi sleep 5 done - echo "[postStart] Loading index template from $TEMPLATE_PATH" >&2 - if ! /usr/bin/curl --cacert "$CA_CERT" -X PUT "$ES_URL/chat" \ - -u "$ES_USERNAME:$ES_PASSWORD" \ + echo "[postStart] Loading index templates..." >&2 + if ! /usr/bin/curl -X PUT "$ES_URL/chat" \ # Removed auth flags -H 'Content-Type: application/json' \ --data-binary @"$TEMPLATE_PATH_1"; then - echo "[postStart] ERROR: Failed to apply index template!" >&2 + echo "[postStart] ERROR: Failed to apply chat template!" >&2 exit 1 fi - if ! /usr/bin/curl --cacert "$CA_CERT" -X PUT "$ES_URL/message" \ - -u "$ES_USERNAME:$ELASTIC_PASSWORD" \ + if ! /usr/bin/curl -X PUT "$ES_URL/message" \ -H 'Content-Type: application/json' \ --data-binary @"$TEMPLATE_PATH_2"; then - echo "[postStart] ERROR: Failed to apply index template!" >&2 + echo "[postStart] ERROR: Failed to apply message template!" >&2 exit 1 fi - if ! /usr/bin/curl --cacert "$CA_CERT" -X PUT "$ES_URL/user" \ - -u "$ES_USERNAME:$ELASTIC_PASSWORD" \ + if ! /usr/bin/curl -X PUT "$ES_URL/user" \ -H 'Content-Type: application/json' \ --data-binary @"$TEMPLATE_PATH_3"; then - echo "[postStart] ERROR: Failed to apply index template!" >&2 + echo "[postStart] ERROR: Failed to apply user template!" >&2 exit 1 fi - echo "[postStart] Index template 'chat_v1_idx' applied." >&2 - echo "Debug message" >> /poststart.log 2>&1 + echo "[postStart] All index templates applied successfully." >&2 +#postStart: +# exec: +# command: +# - /bin/bash +# - -c +# - | +# set -euo pipefail +# echo "[postStart] Waiting for Elasticsearch to be ready..." >&2 +# for ((i=1; i<=MAX_RETRIES; i++)); do +# if /usr/bin/curl --cacert "$CA_CERT" -s -u "$ES_USERNAME:$ELASTIC_PASSWORD" "$ES_URL" >/dev/null; then +# echo "[postStart] Elasticsearch is up after $i attempts!" >&2 +# break +# fi +# if [ "$i" -eq "$MAX_RETRIES" ]; then +# echo "[postStart] ERROR: Elasticsearch did not become ready after $MAX_RETRIES attempts." >&2 +# exit 1 +# fi +# sleep 5 +# done +# echo "[postStart] Loading index template from $TEMPLATE_PATH" >&2 +# if ! /usr/bin/curl --cacert "$CA_CERT" -X PUT "$ES_URL/chat" \ +# -u "$ES_USERNAME:$ES_PASSWORD" \ +# -H 'Content-Type: application/json' \ +# --data-binary @"$TEMPLATE_PATH_1"; then +# echo "[postStart] ERROR: Failed to apply index template!" >&2 +# exit 1 +# fi +# if ! /usr/bin/curl --cacert "$CA_CERT" -X PUT "$ES_URL/message" \ +# -u "$ES_USERNAME:$ELASTIC_PASSWORD" \ +# -H 'Content-Type: application/json' \ +# --data-binary @"$TEMPLATE_PATH_2"; then +# echo "[postStart] ERROR: Failed to apply index template!" >&2 +# exit 1 +# fi +# if ! /usr/bin/curl --cacert "$CA_CERT" -X PUT "$ES_URL/user" \ +# -u "$ES_USERNAME:$ELASTIC_PASSWORD" \ +# -H 'Content-Type: application/json' \ +# --data-binary @"$TEMPLATE_PATH_3"; then +# echo "[postStart] ERROR: Failed to apply index template!" >&2 +# exit 1 +# fi +# echo "[postStart] Index template 'chat_v1_idx' applied." >&2 +# echo "Debug message" >> /poststart.log 2>&1 sysctlInitContainer: enabled: true