starting webserver in spgwc and starting corresponding services at configured port

Change-Id: I966337cee0e6861219eac688211521b49609e803
diff --git a/omec/omec-control-plane/Chart.yaml b/omec/omec-control-plane/Chart.yaml
index 62c5985..ca7a7bb 100644
--- a/omec/omec-control-plane/Chart.yaml
+++ b/omec/omec-control-plane/Chart.yaml
@@ -10,4 +10,4 @@
 name: omec-control-plane
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 0.3.4
+version: 0.3.5
diff --git a/omec/omec-control-plane/templates/configmap-spgwc.yaml b/omec/omec-control-plane/templates/configmap-spgwc.yaml
index 4e3ebef..3853a10 100644
--- a/omec/omec-control-plane/templates/configmap-spgwc.yaml
+++ b/omec/omec-control-plane/templates/configmap-spgwc.yaml
@@ -27,6 +27,7 @@
     UPF_PFCP_IP = 127.0.0.1
     UPF_PFCP_PORT = 8805
     PROMETHEUS_PORT = {{ .Values.config.spgwc.prometheus.port }}
+    HTTP_PORT = {{ .Values.config.spgwc.http.port }}
     TRANSMIT_TIMER = 2
     PERIODIC_TIMER = 10
     TRANSMIT_COUNT = 5
diff --git a/omec/omec-control-plane/templates/service-spgwc.yaml b/omec/omec-control-plane/templates/service-spgwc.yaml
index 5dd3ba4..2704ecd 100644
--- a/omec/omec-control-plane/templates/service-spgwc.yaml
+++ b/omec/omec-control-plane/templates/service-spgwc.yaml
@@ -30,6 +30,9 @@
   - name: prometheus-exporter
     port: {{ .Values.config.spgwc.prometheus.port }}
     protocol: TCP
+  - name: restendpoint
+    port: {{ .Values.config.spgwc.http.port }}
+    protocol: TCP
 ---
 apiVersion: v1
 kind: Service
@@ -82,6 +85,12 @@
     port: {{ .Values.config.spgwc.s11.port }}
     protocol: UDP
 {{- end }}
+{{- if .Values.config.spgwc.http.nodePort.enabled }}
+  - name: restendpoint
+    port: {{ .Values.config.spgwc.http.port }}
+    protocol: TCP
+    nodePort: {{ .Values.config.spgwc.http.nodePort.port }}
+{{- end }}
 {{- end }}
 {{- end }}
 {{- end }}
diff --git a/omec/omec-control-plane/templates/statefulset-spgwc.yaml b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
index f2c77db..707cb71 100644
--- a/omec/omec-control-plane/templates/statefulset-spgwc.yaml
+++ b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
@@ -75,6 +75,27 @@
         stdin: true
         tty: true
         command: ["/opt/cp/scripts/spgwc-run.sh"]
+        livenessProbe:
+          httpGet:
+            path: /liveness
+            port: {{ .Values.config.spgwc.http.port }}
+          initialDelaySeconds: 10
+          periodSeconds: 3
+        readinessProbe:
+          httpGet:
+            path: /readiness
+            port: {{ .Values.config.spgwc.http.port }}
+          initialDelaySeconds: 10
+          periodSeconds: 3
+{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
+        startupProbe:
+          #looks like available only in 1.16 K8s version and above
+          httpGet:
+            path: /startup
+            port: {{ .Values.config.spgwc.http.port }}
+          failureThreshold: 30
+          periodSeconds: 10
+{{- end }}
         env:
         - name: MEM_LIMIT
           valueFrom:
diff --git a/omec/omec-control-plane/values.yaml b/omec/omec-control-plane/values.yaml
index 1af0153..a4a2e0d 100644
--- a/omec/omec-control-plane/values.yaml
+++ b/omec/omec-control-plane/values.yaml
@@ -289,6 +289,11 @@
       nodePort:
         enabled: false
         port: 30084
+    http:
+      port: 8080
+      nodePort:
+        enabled: false
+        port: 30080
     jsonCfgFiles:
       subscriber_mapping.json:
         subscriber-selection-rules: