{{/* Copyright 2017 The Openstack-Helm Authors. 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. */}} {{- if .Values.manifests.job_register_kibana_indexes }} {{- $envAll := . }} {{- $esUserSecret := .Values.secrets.elasticsearch.user }} {{- $serviceAccountName := "register-kibana-indexes" }} {{ tuple $envAll "register_kibana_indexes" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: batch/v1 kind: Job metadata: name: register-kibana-indexes spec: template: metadata: labels: {{ tuple $envAll "kibana" "register_kibana_indexes" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: serviceAccountName: {{ $serviceAccountName }} restartPolicy: OnFailure nodeSelector: {{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }} initContainers: {{ tuple $envAll "register_kibana_indexes" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: - name: register-kibana-indexes {{ tuple $envAll "register_kibana_indexes" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.register_kibana_indexes | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} env: - name: ELASTICSEARCH_USERNAME valueFrom: secretKeyRef: name: {{ $esUserSecret }} key: ELASTICSEARCH_USERNAME - name: ELASTICSEARCH_PASSWORD valueFrom: secretKeyRef: name: {{ $esUserSecret }} key: ELASTICSEARCH_PASSWORD - name: ELASTICSEARCH_ENDPOINT value: {{ tuple "elasticsearch" "internal" "client" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }} command: - /tmp/create_kibana_index_patterns.sh volumeMounts: - name: pod-tmp mountPath: /tmp - name: kibana-bin mountPath: /tmp/create_kibana_index_patterns.sh subPath: create_kibana_index_patterns.sh readOnly: false volumes: - name: pod-tmp emptyDir: {} - name: kibana-bin configMap: name: kibana-bin defaultMode: 0755 {{- end }}