blob: 111bc805865b3dc8b94a9b30587d6190c63ada92 [file] [log] [blame]
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +02001{{/*
2# Copyright © 2018 Orange
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
milaszki305089c2020-07-07 12:31:21 +000017apiVersion: apps/v1
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020018kind: StatefulSet
19metadata:
20 name: {{ include "common.fullname" . }}
21 namespace: {{ include "common.namespace" . }}
22 labels:
23 app: {{ include "common.name" . }}
24 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010025 release: {{ include "common.release" . }}
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020026 heritage: {{ .Release.Service }}
27spec:
28 serviceName: {{ .Values.service.name }}
29 replicas: {{ .Values.replicaCount }}
milaszki305089c2020-07-07 12:31:21 +000030 selector:
31 matchLabels:
32 app: {{ include "common.name" . }}
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020033 template:
34 metadata:
35 labels:
36 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010037 release: {{ include "common.release" . }}
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020038 spec:
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020039 containers:
40 - name: {{ include "common.name" . }}
41 image: "{{ .Values.dockerHubRepository }}/{{ .Values.image }}"
42 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
43 env:
44 - name: MONGO_INITDB_DATABASE
45 value: "{{ .Values.config.dbName }}"
46 ports:
47 - containerPort: {{ .Values.service.internalPort }}
48 # disable liveness probe when breakpoints set in debugger
49 # so K8s doesn't restart unresponsive container
50 {{- if eq .Values.liveness.enabled true }}
51 livenessProbe:
52 exec:
53 command:
54 - mongo
55 - --eval
56 - "db.adminCommand('ping')"
57 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
58 periodSeconds: {{ .Values.liveness.periodSeconds }}
59 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
60 {{end -}}
61 readinessProbe:
62 tcpSocket:
63 port: {{ .Values.service.internalPort }}
64 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
65 periodSeconds: {{ .Values.readiness.periodSeconds }}
66 volumeMounts:
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +010067 - name: {{ include "common.fullname" . }}-data
68 mountPath: /var/lib/mongo
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020069 resources:
Mandeep Khinda5e3f36a2018-09-24 15:25:42 +000070{{ include "common.resources" . | indent 12 }}
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020071 {{- if .Values.nodeSelector }}
72 nodeSelector:
73{{ toYaml .Values.nodeSelector | indent 10 }}
74 {{- end -}}
75 {{- if .Values.affinity }}
76 affinity:
77{{ toYaml .Values.affinity | indent 10 }}
78 {{- end }}
79 volumes:
80 - name: localtime
81 hostPath:
82 path: /etc/localtime
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +010083 {{- if .Values.persistence.enabled }}
84 volumeClaimTemplates:
85 - metadata:
86 name: {{ include "common.fullname" . }}-data
87 labels:
88 name: {{ include "common.fullname" . }}
89 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010090 release: "{{ include "common.release" . }}"
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +010091 heritage: "{{ .Release.Service }}"
92 spec:
93 accessModes:
94 - {{ .Values.persistence.accessMode | quote }}
95 storageClassName: {{ include "common.storageClass" . }}
96 resources:
97 requests:
98 storage: {{ .Values.persistence.size | quote }}
99 {{- else }}
100 volumes:
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +0200101 - name: {{ include "common.fullname" . }}-data
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +0200102 emptyDir: {}
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100103 {{- end }}