openstack-helm-infra/kibana/templates/bin/_create_kibana_index_patterns.sh.tpl
Chi Lo fa2c1e0b55 Revert "Remove Kibana indices before pod start up"
This reverts commit 122dcef629.
https://review.opendev.org/c/openstack/openstack-helm-infra/+/805246

The changes from the above patchset is a result of upgrading
Elasticsearch and Kibana images to v7.14.  This image has been
reverted back to v7.9.2.  As such, these changes are no longer
correct.

Change-Id: I44e9993002cbf1d2c4f5cb23d340b01bad521427
2021-10-21 15:42:02 -07:00

30 lines
1.2 KiB
Smarty

#!/bin/bash
{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
set -ex
{{- range $objectType, $indices := .Values.conf.create_kibana_indexes.indexes }}
{{- range $indices }}
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"}}'
{{- end }}
{{- end }}
curl -K- <<< "--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" \
-XPOST "${KIBANA_ENDPOINT}/api/kibana/settings/defaultIndex" -H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' -d \
'{"value" : "{{ .Values.conf.create_kibana_indexes.default_index }}*"}'