blob: 11602054e82f62fc65e278ba0d760ee3006f3376 [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 }}
andreas-geisslerf84cccd2021-07-07 15:40:41 +020040 imagePullSecrets:
41 - name: "{{ include "common.namespace" . }}-docker-registry-key"
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020042 containers:
43 - name: {{ include "common.name" . }}
Sylvain Desbureauxb0864452020-11-19 17:17:17 +010044 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020045 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Krzysztof Opasiak86a28cd2020-09-09 21:23:32 +020046 command:
47 - docker-entrypoint.sh
48 args:
49 - --nounixsocket
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020050 env:
51 - name: MONGO_INITDB_DATABASE
52 value: "{{ .Values.config.dbName }}"
53 ports:
54 - containerPort: {{ .Values.service.internalPort }}
55 # disable liveness probe when breakpoints set in debugger
56 # so K8s doesn't restart unresponsive container
57 {{- if eq .Values.liveness.enabled true }}
58 livenessProbe:
59 exec:
60 command:
61 - mongo
62 - --eval
63 - "db.adminCommand('ping')"
64 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
65 periodSeconds: {{ .Values.liveness.periodSeconds }}
66 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
67 {{end -}}
68 readinessProbe:
69 tcpSocket:
70 port: {{ .Values.service.internalPort }}
71 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
72 periodSeconds: {{ .Values.readiness.periodSeconds }}
73 volumeMounts:
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +010074 - name: {{ include "common.fullname" . }}-data
Sylvain Desbureaux4dc42ee2021-11-09 17:22:18 +000075 mountPath: /var/lib/mongo
Sylvain Desbureauxc27b6a32020-09-23 10:39:31 +020076 resources: {{ include "common.resources" . | nindent 12 }}
Krzysztof Opasiak86a28cd2020-09-09 21:23:32 +020077{{ include "common.containerSecurityContext" . | indent 10 }}
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +020078 {{- if .Values.nodeSelector }}
79 nodeSelector:
80{{ toYaml .Values.nodeSelector | indent 10 }}
81 {{- end -}}
82 {{- if .Values.affinity }}
83 affinity:
84{{ toYaml .Values.affinity | indent 10 }}
85 {{- end }}
86 volumes:
87 - name: localtime
88 hostPath:
89 path: /etc/localtime
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +010090 {{- if .Values.persistence.enabled }}
91 volumeClaimTemplates:
92 - metadata:
93 name: {{ include "common.fullname" . }}-data
94 labels:
95 name: {{ include "common.fullname" . }}
96 chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010097 release: "{{ include "common.release" . }}"
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +010098 heritage: "{{ .Release.Service }}"
99 spec:
100 accessModes:
101 - {{ .Values.persistence.accessMode | quote }}
102 storageClassName: {{ include "common.storageClass" . }}
103 resources:
104 requests:
105 storage: {{ .Values.persistence.size | quote }}
106 {{- else }}
107 volumes:
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +0200108 - name: {{ include "common.fullname" . }}-data
Sylvain Desbureauxe44d1702018-05-07 20:39:16 +0200109 emptyDir: {}
Sylvain Desbureauxb7ed2ee2019-11-29 11:35:13 +0100110 {{- end }}