blob: abc71b31334425defe88976692c715bf6c411fb9 [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:
Krzysztof Opasiak86a28cd2020-09-09 21:23:32 +020039{{ include "common.podSecurityContext" . | indent 6 }}
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020040 containers:
41 - name: {{ include "common.name" . }}
42 image: "{{ .Values.dockerHubRepository }}/{{ .Values.image }}"
43 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Krzysztof Opasiak86a28cd2020-09-09 21:23:32 +020044 command:
45 - docker-entrypoint.sh
46 args:
47 - --nounixsocket
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020048 env:
49 - name: MONGO_INITDB_DATABASE
50 value: "{{ .Values.config.dbName }}"
51 ports:
52 - containerPort: {{ .Values.service.internalPort }}
53 # disable liveness probe when breakpoints set in debugger
54 # so K8s doesn't restart unresponsive container
55 {{- if eq .Values.liveness.enabled true }}
56 livenessProbe:
57 exec:
58 command:
59 - mongo
60 - --eval
61 - "db.adminCommand('ping')"
62 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
63 periodSeconds: {{ .Values.liveness.periodSeconds }}
64 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
65 {{end -}}
66 readinessProbe:
67 tcpSocket:
68 port: {{ .Values.service.internalPort }}
69 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
70 periodSeconds: {{ .Values.readiness.periodSeconds }}
71 volumeMounts:
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +010072 - name: {{ include "common.fullname" . }}-data
73 mountPath: /var/lib/mongo
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020074 resources:
Mandeep Khinda5e3f36a2018-09-24 15:25:42 +000075{{ include "common.resources" . | indent 12 }}
Krzysztof Opasiak86a28cd2020-09-09 21:23:32 +020076{{ include "common.containerSecurityContext" . | indent 10 }}
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020077 {{- if .Values.nodeSelector }}
78 nodeSelector:
79{{ toYaml .Values.nodeSelector | indent 10 }}
80 {{- end -}}
81 {{- if .Values.affinity }}
82 affinity:
83{{ toYaml .Values.affinity | indent 10 }}
84 {{- end }}
85 volumes:
86 - name: localtime
87 hostPath:
88 path: /etc/localtime
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +010089 {{- if .Values.persistence.enabled }}
90 volumeClaimTemplates:
91 - metadata:
92 name: {{ include "common.fullname" . }}-data
93 labels:
94 name: {{ include "common.fullname" . }}
95 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010096 release: "{{ include "common.release" . }}"
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +010097 heritage: "{{ .Release.Service }}"
98 spec:
99 accessModes:
100 - {{ .Values.persistence.accessMode | quote }}
101 storageClassName: {{ include "common.storageClass" . }}
102 resources:
103 requests:
104 storage: {{ .Values.persistence.size | quote }}
105 {{- else }}
106 volumes:
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +0200107 - name: {{ include "common.fullname" . }}-data
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +0200108 emptyDir: {}
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100109 {{- end }}