{{- if and (not .Values.configurationCM) (and .Values.elasticsearch.hosts .Values.elasticsearch.port) }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "common.names.fullname" . }}-conf
  labels: {{- include "common.labels.standard" . | nindent 4 }}
data:
  kibana.yml: |
    pid.file: /opt/bitnami/kibana/tmp/kibana.pid
    server.host: "::"
    server.port: {{ .Values.containerPort }}
    elasticsearch.hosts: [{{ include "kibana.elasticsearch.url" . }}]
    {{- if .Values.configuration.server.basePath }}
    server.basePath: {{ .Values.configuration.server.basePath | quote }}
    {{- end }}
    server.rewriteBasePath: {{ .Values.configuration.server.rewriteBasePath }}
    {{- if .Values.extraConfiguration }}
    {{- tpl (toYaml .Values.extraConfiguration) $ | nindent 4 }}
    {{- end }}
{{- end }}
