Kiran Kamineni | 0e87f09 | 2018-09-17 15:17:18 -0700 | [diff] [blame] | 1 | {{/* |
| 2 | # Copyright 2018 Intel Corporation, Inc |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | */}} |
| 16 | |
| 17 | apiVersion: extensions/v1beta1 |
| 18 | kind: Deployment |
| 19 | metadata: |
| 20 | name: {{ include "common.fullname" . }} |
| 21 | namespace: {{ include "common.namespace" . }} |
| 22 | labels: |
| 23 | app: {{ include "common.name" . }} |
| 24 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 25 | release: {{ .Release.Name }} |
| 26 | heritage: {{ .Release.Service }} |
| 27 | spec: |
| 28 | replicas: {{ .Values.replicaCount }} |
| 29 | selector: |
| 30 | matchLabels: |
| 31 | app: {{ include "common.name" . }} |
| 32 | template: |
| 33 | metadata: |
| 34 | labels: |
| 35 | app: {{ include "common.name" . }} |
| 36 | release: {{ .Release.Name }} |
| 37 | name: {{ include "common.name" . }} |
| 38 | spec: |
| 39 | initContainers: |
| 40 | - image: "{{ .Values.global.busyboxRepository }}/{{ .Values.global.busyboxImage }}" |
| 41 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 42 | name: {{ include "common.name" . }}-chown-init |
| 43 | command: ["chown", "-R", "65534:65534", "{{ .Values.persistence.containerMountPath }}"] |
| 44 | volumeMounts: |
| 45 | - name: {{ include "common.fullname" . }}-storage |
| 46 | mountPath: {{ .Values.persistence.containerMountPath }} |
| 47 | containers: |
| 48 | - name: {{ include "common.name" . }}-configmap-reload |
| 49 | image: "{{ .Values.global.configmapReload.image.repository }}:{{ .Values.global.configmapReload.image.tag }}" |
| 50 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 51 | args: |
| 52 | - --volume-dir=/etc/config |
| 53 | - --webhook-url=http://localhost:9090/-/reload |
| 54 | volumeMounts: |
| 55 | - name: {{ include "common.fullname" . }}-config |
| 56 | mountPath: /etc/config |
| 57 | readOnly: true |
| 58 | |
| 59 | - name: {{ include "common.name" . }}-server |
| 60 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" |
| 61 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 62 | args: |
| 63 | - --config.file=/etc/config/prometheus.yml |
| 64 | - --storage.tsdb.path={{ .Values.persistence.containerMountPath }} |
| 65 | - --web.console.libraries=/etc/prometheus/console_libraries |
| 66 | - --web.console.templates=/etc/prometheus/consoles |
| 67 | - --web.enable-lifecycle |
| 68 | {{- if .Values.server.enableAdminApi }} |
| 69 | - --web.enable-admin-api |
| 70 | {{- end }} |
| 71 | resources: |
| 72 | {{ toYaml .Values.resources | indent 10 }} |
| 73 | ports: |
| 74 | - containerPort: {{ .Values.service.internalPort }} |
| 75 | # disable liveness probe when breakpoints set in debugger |
| 76 | # so K8s doesn't restart unresponsive container |
| 77 | {{- if .Values.liveness.enabled }} |
| 78 | livenessProbe: |
| 79 | httpGet: |
| 80 | path: /-/healthy |
| 81 | port: {{ .Values.service.internalPort }} |
| 82 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 83 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 84 | timeoutSeconds: {{ .Values.liveness.timeoutSeconds }} |
| 85 | {{ end -}} |
| 86 | {{- if .Values.readiness.enabled }} |
| 87 | readinessProbe: |
| 88 | httpGet: |
| 89 | path: /-/ready |
| 90 | port: {{ .Values.service.internalPort }} |
| 91 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 92 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 93 | timeoutSeconds: {{ .Values.readiness.timeoutSeconds }} |
| 94 | {{ end -}} |
| 95 | volumeMounts: |
| 96 | - name: {{ include "common.fullname" . }}-config |
| 97 | mountPath: /etc/config |
| 98 | - name: {{ include "common.fullname" . }}-storage |
| 99 | mountPath: {{ .Values.persistence.containerMountPath }} |
| 100 | {{- if .Values.nodeSelector }} |
| 101 | nodeSelector: |
| 102 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 103 | {{- end -}} |
| 104 | {{- if .Values.affinity }} |
| 105 | affinity: |
| 106 | {{ toYaml .Values.affinity | indent 8 }} |
| 107 | {{- end }} |
| 108 | volumes: |
| 109 | - name: {{ include "common.fullname" . }}-config |
| 110 | configMap: |
| 111 | name: {{ include "common.fullname" . }} |
| 112 | - name: {{ include "common.fullname" . }}-storage |
| 113 | {{- if .Values.persistence.enabled }} |
| 114 | persistentVolumeClaim: |
| 115 | claimName: {{ include "common.fullname" . }} |
| 116 | {{- else }} |
| 117 | emptyDir: {} |
| 118 | {{- end }} |
| 119 | imagePullSecrets: |
| 120 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 121 | restartPolicy: Always |