Merge "[SDC] Bring back sdc onboarding volume mount permissions"
[oom.git] / kubernetes / multicloud / charts / multicloud-prometheus / templates / deployment.yaml
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 {{- if .Values.global.prometheus.enabled -}}
18
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata:
22   name: {{ include "common.fullname" . }}
23   namespace: {{ include "common.namespace" . }}
24   labels:
25     app: {{ include "common.name" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ include "common.release" . }}
28     heritage: {{ .Release.Service }}
29 spec:
30   replicas: {{ .Values.replicaCount }}
31   selector:
32     matchLabels:
33       app: {{ include "common.name" . }}
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ include "common.release" . }}
39       name: {{ include "common.name" . }}
40     spec:
41       initContainers:
42       - image: "{{ .Values.global.busyboxRepository }}/{{ .Values.global.busyboxImage }}"
43         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44         name: {{ include "common.name" . }}-chown-init
45         command: ["chown", "-R", "65534:65534", "{{ .Values.persistence.containerMountPath }}"]
46         volumeMounts:
47         - name: {{ include "common.fullname" . }}-storage
48           mountPath: {{ .Values.persistence.containerMountPath }}
49       containers:
50       - name: {{ include "common.name" . }}-configmap-reload
51         image: "{{ .Values.global.configmapReload.image.repository }}:{{ .Values.global.configmapReload.image.tag }}"
52         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
53         args:
54           - --volume-dir=/etc/config
55           - --webhook-url=http://localhost:9090/-/reload
56         volumeMounts:
57           - name: {{ include "common.fullname" . }}-config
58             mountPath: /etc/config
59             readOnly: true
60
61       - name: {{ include "common.name" . }}-server
62         image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
63         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64         args:
65           - --config.file=/etc/config/prometheus.yml
66           - --storage.tsdb.path={{ .Values.persistence.containerMountPath }}
67           - --web.console.libraries=/etc/prometheus/console_libraries
68           - --web.console.templates=/etc/prometheus/consoles
69           - --web.enable-lifecycle
70         {{- if .Values.server.enableAdminApi }}
71           - --web.enable-admin-api
72         {{- end }}
73         resources:
74 {{ toYaml .Values.resources | indent 10 }}
75         ports:
76         - containerPort: {{ .Values.service.internalPort }}
77         # disable liveness probe when breakpoints set in debugger
78         # so K8s doesn't restart unresponsive container
79         {{- if .Values.liveness.enabled }}
80         livenessProbe:
81           httpGet:
82             path: /-/healthy
83             port: {{ .Values.service.internalPort }}
84           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
85           periodSeconds: {{ .Values.liveness.periodSeconds }}
86           timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
87         {{ end -}}
88         {{- if .Values.readiness.enabled }}
89         readinessProbe:
90           httpGet:
91             path: /-/ready
92             port: {{ .Values.service.internalPort }}
93           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
94           periodSeconds: {{ .Values.readiness.periodSeconds }}
95           timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
96         {{ end -}}
97         volumeMounts:
98           - name: {{ include "common.fullname" . }}-config
99             mountPath: /etc/config
100           - name: {{ include "common.fullname" . }}-storage
101             mountPath: {{ .Values.persistence.containerMountPath }}
102       {{- if .Values.nodeSelector }}
103       nodeSelector:
104 {{ toYaml .Values.nodeSelector | indent 8 }}
105       {{- end -}}
106       {{- if .Values.affinity }}
107       affinity:
108 {{ toYaml .Values.affinity | indent 8 }}
109       {{- end }}
110       volumes:
111         - name: {{ include "common.fullname" . }}-config
112           configMap:
113             name: {{ include "common.fullname" . }}
114         - name: {{ include "common.fullname" . }}-storage
115         {{- if .Values.persistence.enabled }}
116           persistentVolumeClaim:
117             claimName: {{ include "common.fullname" . }}
118         {{- else }}
119           emptyDir: {}
120         {{- end }}
121       imagePullSecrets:
122       - name: "{{ include "common.namespace" . }}-docker-registry-key"
123       restartPolicy: Always
124
125 {{- end -}}