summaryrefslogtreecommitdiffstats
path: root/kubernetes/common/mongo/templates/statefulset.yaml
diff options
context:
space:
mode:
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>2021-12-13 07:35:54 +0000
committerGerrit Code Review <gerrit@onap.org>2021-12-13 07:35:54 +0000
commit77db44818d7ecad8e96dbd5e6ab13344d85043dc (patch)
treec65c34d2ab01f432aebe42913175115182c0b5c7 /kubernetes/common/mongo/templates/statefulset.yaml
parentd09f363e87c98d19ba2fccdf8f235d5cbfb908ee (diff)
parent7baf2dbf669abb383b895d4fa5bb624b19d9ea63 (diff)
Merge "[COMMON] Changed mongo storage location to enable persistance"
Diffstat (limited to 'kubernetes/common/mongo/templates/statefulset.yaml')
-rw-r--r--kubernetes/common/mongo/templates/statefulset.yaml19
1 files changed, 18 insertions, 1 deletions
diff --git a/kubernetes/common/mongo/templates/statefulset.yaml b/kubernetes/common/mongo/templates/statefulset.yaml
index 11602054e8..e156db27db 100644
--- a/kubernetes/common/mongo/templates/statefulset.yaml
+++ b/kubernetes/common/mongo/templates/statefulset.yaml
@@ -39,6 +39,23 @@ spec:
{{ include "common.podSecurityContext" . | indent 6 }}
imagePullSecrets:
- name: "{{ include "common.namespace" . }}-docker-registry-key"
+ initContainers:
+ # we shouldn't need this but for unknown reason, it's fsGroup is not
+ # applied
+ - name: fix-permission
+ command:
+ - /bin/sh
+ args:
+ - -c
+ - |
+ chown -R {{ .Values.securityContext.user_id }}:{{ .Values.securityContext.group_id }} /data
+ image: {{ include "repositoryGenerator.image.busybox" . }}
+ imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+ securityContext:
+ runAsUser: 0
+ volumeMounts:
+ - name: {{ include "common.fullname" . }}-data
+ mountPath: /data
containers:
- name: {{ include "common.name" . }}
image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
@@ -72,7 +89,7 @@ spec:
periodSeconds: {{ .Values.readiness.periodSeconds }}
volumeMounts:
- name: {{ include "common.fullname" . }}-data
- mountPath: /var/lib/mongo
+ mountPath: /data/db
resources: {{ include "common.resources" . | nindent 12 }}
{{ include "common.containerSecurityContext" . | indent 10 }}
{{- if .Values.nodeSelector }}