Policy Nexus component needs persistent volume
[oom.git] / kubernetes / policy / charts / drools / charts / nexus / templates / deployment.yaml
index c4cc253..c59ed08 100644 (file)
@@ -30,6 +30,14 @@ spec:
         app: {{ include "common.name" . }}
         release: {{ .Release.Name }}
     spec:
+      initContainers:
+      - command: ["sh", "-c", "chown -R 200:200 /share"]
+        image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.global.ubuntuInitImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        name: {{ include "common.name" . }}-init
+        volumeMounts:
+        - mountPath: /share
+          name: nexus-data
       containers:
         - name: {{ include "common.name" . }}
           image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
@@ -53,6 +61,8 @@ spec:
           - mountPath: /etc/localtime
             name: localtime
             readOnly: true
+          - mountPath: /sonatype-work
+            name: nexus-data
           resources:
 {{ toYaml .Values.resources | indent 12 }}
         {{- if .Values.nodeSelector }}
@@ -67,5 +77,12 @@ spec:
         - name: localtime
           hostPath:
             path: /etc/localtime
+        - name: nexus-data
+        {{- if .Values.persistence.enabled }}
+          persistentVolumeClaim:
+            claimName: {{ include "common.fullname" . }}
+        {{- else }}
+          emptyDir: {}
+        {{- end }}
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"