summaryrefslogtreecommitdiffstats
path: root/kubernetes/common
diff options
context:
space:
mode:
authorAndreas Geissler <andreas-geissler@telekom.de>2021-12-10 07:50:46 +0000
committerLukasz Rajewski <lukasz.rajewski@orange.com>2022-01-04 15:54:39 +0000
commit758c67de3946a37dd47f5eb5ce70c68a567cc39a (patch)
treef93dc0f9bacb1ab608b267ae2015ea1af10b9a01 /kubernetes/common
parent385022413083ad4a8357c8195347ae9c45bcd2cf (diff)
[COMMON] Changed mongo storage location to enable persistance
Added initContainer to fix the permissions of the to be mounted volume and changed intent Issue-ID: OOM-2864 Signed-off-by: Andreas Geissler <andreas-geissler@telekom.de> Change-Id: I188d7f6002405e810dd54d1043824979b4d83d42 (cherry picked from commit 7baf2dbf669abb383b895d4fa5bb624b19d9ea63)
Diffstat (limited to 'kubernetes/common')
-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 }}