################################################################################ # Copyright (c) 2019 AT&T Intellectual Property. # # # # 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. # ################################################################################ apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "fullname" . }} labels: app: {{ .Chart.Name }} release: {{ .Release.Name | quote }} {{- range $key, $value := .Values.labels }} {{ $key }}: {{ $value | quote }} {{- end }} spec: replicas: {{ .Values.replicas }} strategy: {{ toYaml .Values.updateStrategy | indent 4 }} selector: matchLabels: app: kibana release: {{ .Release.Name | quote }} template: metadata: labels: app: kibana release: {{ .Release.Name | quote }} annotations: {{- range $key, $value := .Values.podAnnotations }} {{ $key }}: {{ $value | quote }} {{- end }} {{/* This forces a restart if the configmap has changed */}} {{- if .Values.kibanaConfig }} configchecksum: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum | trunc 63 }} {{- end }} spec: {{- if .Values.priorityClassName }} priorityClassName: {{ .Values.priorityClassName }} {{- end }} securityContext: {{ toYaml .Values.podSecurityContext | indent 8 }} {{- if .Values.serviceAccount }} serviceAccount: {{ .Values.serviceAccount }} {{- end }} volumes: {{- range .Values.secretMounts }} - name: {{ .name }} secret: secretName: {{ .secretName }} {{- end }} {{- if .Values.kibanaConfig }} - name: kibanaconfig configMap: name: {{ template "fullname" . }}-config {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{ toYaml . | indent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{ toYaml . | indent 8 }} {{- end }} {{- if .Values.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.imagePullSecrets | indent 8 }} {{- end }} containers: - name: kibana securityContext: {{ toYaml .Values.securityContext | indent 10 }} image: "{{ .Values.image }}:{{ .Values.imageTag }}" imagePullPolicy: "{{ .Values.imagePullPolicy }}" env: {{- if .Values.elasticsearchURL }} - name: ELASTICSEARCH_URL value: "{{ .Values.elasticsearchURL }}" {{- else if .Values.elasticsearchHosts }} - name: ELASTICSEARCH_HOSTS value: "{{ .Values.elasticsearchHosts }}" {{- end }} - name: SERVER_HOST value: "{{ .Values.serverHost }}" {{- if .Values.extraEnvs }} {{ toYaml .Values.extraEnvs | indent 10 }} {{- end }} readinessProbe: {{ toYaml .Values.readinessProbe | indent 10 }} exec: command: - sh - -c - | #!/usr/bin/env bash -e http () { local path="${1}" set -- -XGET -s --fail if [ -n "${ELASTIC_USERNAME}" ] && [ -n "${ELASTIC_PASSWORD}" ]; then set -- "$@" -u "${ELASTIC_USERNAME}:${ELASTIC_PASSWORD}" fi curl -k "$@" "{{ .Values.protocol }}://localhost:{{ .Values.httpPort }}${path}" } http "{{ .Values.healthCheckPath }}" ports: - containerPort: {{ .Values.httpPort }} resources: {{ toYaml .Values.resources | indent 10 }} volumeMounts: {{- range .Values.secretMounts }} - name: {{ .name }} mountPath: {{ .path }} {{- if .subPath }} subPath: {{ .subPath }} {{- end }} {{- end }} {{- range $path, $config := .Values.kibanaConfig }} - name: kibanaconfig mountPath: /usr/share/kibana/config/{{ $path }} subPath: {{ $path }} {{- end -}}