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-hss.yaml b/omec/omec-control-plane/templates/statefulset-hss.yaml
index 93c8721..dc461b8 100644
--- a/omec/omec-control-plane/templates/statefulset-hss.yaml
+++ b/omec/omec-control-plane/templates/statefulset-hss.yaml
@@ -70,10 +70,18 @@
           - kubernetes-entrypoint
         volumeMounts:
           []
+    {{- if .Values.config.coreDump.enabled }}
+{{ tuple "hss" . | include "omec-control-plane.coredump_init" | indent 6 }}
+    {{- end }}
       containers:
       - name: hss
         image: {{ .Values.images.tags.hss }}
         imagePullPolicy: {{ .Values.images.pullPolicy }}
+      {{- if .Values.config.coreDump.enabled }}
+        securityContext:
+          privileged: true
+          runAsUser: 0
+      {{- end }}
         stdin: true
         tty: true
         command: ["bash", "-c", "/opt/c3po/hss/hss-run.sh; sleep 3600"]
@@ -87,6 +95,10 @@
           subPath: hss-run.sh
         - name: hss-config
           mountPath: /etc/hss/conf
+      {{- if .Values.config.coreDump.enabled }}
+        - name: coredump
+          mountPath: /tmp/coredump
+      {{- end }}
       volumes:
       - name: hss-script
         configMap:
@@ -96,3 +108,11 @@
         configMap:
           name: hss
           defaultMode: 420
+    {{- if .Values.config.coreDump.enabled }}
+      - name: host-rootfs
+        hostPath:
+          path: /
+      - name: coredump
+        hostPath:
+          path: {{ .Values.config.coreDump.path }}
+    {{- end }}