EDGEPOD-85 Add ability to enable coredump for OMEC apps

Core files will be generated when config.coreDump.enabled is set to
true. Path of the generated core files can be configured by setting
config.coreDump.path, which is set to /tmp/coredump by default.

Change-Id: I5149751ba091a1f49e2eee91a14889898301a7bf
diff --git a/omec/omec-control-plane/templates/statefulset-spgwc.yaml b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
index ebc0cd0..90775c0 100644
--- a/omec/omec-control-plane/templates/statefulset-spgwc.yaml
+++ b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
@@ -63,10 +63,18 @@
             value: "echo done"
           - name: DEPENDENCY_POD_JSON
             value: '[{"labels": {"app": "mme"}, "requireSameNode": false}]'
+    {{- if .Values.config.coreDump.enabled }}
+{{ tuple "spgwc" . | include "omec-control-plane.coredump_init" | indent 6 }}
+    {{- end }}
       containers:
       - name: spgwc
         image: {{ .Values.images.tags.spgwc }}
         imagePullPolicy: {{ .Values.images.pullPolicy }}
+      {{- if .Values.config.coreDump.enabled }}
+        securityContext:
+          privileged: true
+          runAsUser: 0
+      {{- end }}
         stdin: true
         tty: true
         command: ["/opt/cp/scripts/spgwc-run.sh"]
@@ -96,6 +104,10 @@
           subPath: spgwc-run.sh
         - name: cp-config
           mountPath: /etc/cp/config
+      {{- if .Values.config.coreDump.enabled }}
+        - name: coredump
+          mountPath: /tmp/coredump
+      {{- end }}
       volumes:
       - name: cp-script
         configMap:
@@ -105,3 +117,11 @@
         configMap:
           name: spgwc
           defaultMode: 420
+    {{- if .Values.config.coreDump.enabled }}
+      - name: host-rootfs
+        hostPath:
+          path: /
+      - name: coredump
+        hostPath:
+          path: {{ .Values.config.coreDump.path }}
+    {{- end }}