From 2dcd38e4b0a9d047e962f548fe38ee7ad9109e38 Mon Sep 17 00:00:00 2001 From: Alexey Terekhin Date: Mon, 1 Aug 2022 15:54:56 -0700 Subject: [PATCH] Update kibana index pattern creation This change updates the kibana indices creation to repeatedly make call attempts until we get a 200 response back. Change-Id: Id0f012bda83913fc66c4ce105de97496043e487c --- kibana/Chart.yaml | 2 +- .../bin/_create_kibana_index_patterns.sh.tpl | 14 ++++++++++++++ releasenotes/notes/kibana.yaml | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/kibana/Chart.yaml b/kibana/Chart.yaml index d71d8197c..b0b824c40 100644 --- a/kibana/Chart.yaml +++ b/kibana/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v7.1.0 description: OpenStack-Helm Kibana name: kibana -version: 0.1.11 +version: 0.1.12 home: https://www.elastic.co/products/kibana sources: - https://github.com/elastic/kibana diff --git a/kibana/templates/bin/_create_kibana_index_patterns.sh.tpl b/kibana/templates/bin/_create_kibana_index_patterns.sh.tpl index 2520b939b..669cd3f8c 100644 --- a/kibana/templates/bin/_create_kibana_index_patterns.sh.tpl +++ b/kibana/templates/bin/_create_kibana_index_patterns.sh.tpl @@ -20,6 +20,20 @@ curl -K- <<< "--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" \ -XPOST "${KIBANA_ENDPOINT}/api/saved_objects/index-pattern/{{ . }}*" -H 'kbn-xsrf: true' \ -H 'Content-Type: application/json' -d \ '{"attributes":{"title":"{{ . }}-*","timeFieldName":"@timestamp"}}' +while true +do +if [[ $(curl -s -o /dev/null -K- <<< "--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" \ + -w "%{http_code}" -XGET "${KIBANA_ENDPOINT}/api/saved_objects/index-pattern/{{ . }}*") == '200' ]] +then +break +else +curl -K- <<< "--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" \ + -XPOST "${KIBANA_ENDPOINT}/api/saved_objects/index-pattern/{{ . }}*" -H 'kbn-xsrf: true' \ + -H 'Content-Type: application/json' -d \ + '{"attributes":{"title":"{{ . }}-*","timeFieldName":"@timestamp"}}' +sleep 30 +fi +done {{- end }} {{- end }} diff --git a/releasenotes/notes/kibana.yaml b/releasenotes/notes/kibana.yaml index 3ce9dc443..842e8c3cd 100644 --- a/releasenotes/notes/kibana.yaml +++ b/releasenotes/notes/kibana.yaml @@ -12,4 +12,5 @@ kibana: - 0.1.9 Revert removing Kibana indices before pod start up - 0.1.10 Update image defaults - 0.1.11 Added OCI registry authentication + - 0.1.12 Added feedback http_code 200 for kibana indexes ...