Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 1 | {{/* |
| 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 | |
milaszki | 305089c | 2020-07-07 12:31:21 +0000 | [diff] [blame] | 17 | apiVersion: apps/v1 |
Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 18 | kind: StatefulSet |
| 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 "+" "_" }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 25 | release: {{ include "common.release" . }} |
Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 26 | heritage: {{ .Release.Service }} |
| 27 | spec: |
| 28 | serviceName: {{ .Values.service.name }} |
| 29 | replicas: {{ .Values.replicaCount }} |
milaszki | 305089c | 2020-07-07 12:31:21 +0000 | [diff] [blame] | 30 | selector: |
| 31 | matchLabels: |
| 32 | app: {{ include "common.name" . }} |
Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 33 | template: |
| 34 | metadata: |
| 35 | labels: |
| 36 | app: {{ include "common.name" . }} |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 37 | release: {{ include "common.release" . }} |
Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 38 | spec: |
Krzysztof Opasiak | 86a28cd | 2020-09-09 21:23:32 +0200 | [diff] [blame] | 39 | {{ include "common.podSecurityContext" . | indent 6 }} |
Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 40 | containers: |
| 41 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | b086445 | 2020-11-19 17:17:17 +0100 | [diff] [blame^] | 42 | image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 43 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Krzysztof Opasiak | 86a28cd | 2020-09-09 21:23:32 +0200 | [diff] [blame] | 44 | command: |
| 45 | - docker-entrypoint.sh |
| 46 | args: |
| 47 | - --nounixsocket |
Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 48 | 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 Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 72 | - name: {{ include "common.fullname" . }}-data |
| 73 | mountPath: /var/lib/mongo |
Sylvain Desbureaux | c27b6a3 | 2020-09-23 10:39:31 +0200 | [diff] [blame] | 74 | resources: {{ include "common.resources" . | nindent 12 }} |
Krzysztof Opasiak | 86a28cd | 2020-09-09 21:23:32 +0200 | [diff] [blame] | 75 | {{ include "common.containerSecurityContext" . | indent 10 }} |
Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 76 | {{- if .Values.nodeSelector }} |
| 77 | nodeSelector: |
| 78 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 79 | {{- end -}} |
| 80 | {{- if .Values.affinity }} |
| 81 | affinity: |
| 82 | {{ toYaml .Values.affinity | indent 10 }} |
| 83 | {{- end }} |
| 84 | volumes: |
| 85 | - name: localtime |
| 86 | hostPath: |
| 87 | path: /etc/localtime |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 88 | {{- if .Values.persistence.enabled }} |
| 89 | volumeClaimTemplates: |
| 90 | - metadata: |
| 91 | name: {{ include "common.fullname" . }}-data |
| 92 | labels: |
| 93 | name: {{ include "common.fullname" . }} |
| 94 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" |
Krzysztof Opasiak | 137d7cc | 2020-01-24 23:49:11 +0100 | [diff] [blame] | 95 | release: "{{ include "common.release" . }}" |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 96 | heritage: "{{ .Release.Service }}" |
| 97 | spec: |
| 98 | accessModes: |
| 99 | - {{ .Values.persistence.accessMode | quote }} |
| 100 | storageClassName: {{ include "common.storageClass" . }} |
| 101 | resources: |
| 102 | requests: |
| 103 | storage: {{ .Values.persistence.size | quote }} |
| 104 | {{- else }} |
| 105 | volumes: |
Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 106 | - name: {{ include "common.fullname" . }}-data |
Sylvain Desbureaux | e44d170 | 2018-05-07 20:39:16 +0200 | [diff] [blame] | 107 | emptyDir: {} |
Sylvain Desbureaux | b7ed2ee | 2019-11-29 11:35:13 +0100 | [diff] [blame] | 108 | {{- end }} |