AETHER-357 Add ability to run control plane components selectively

Change-Id: I73cd5bab0fa624cf6cd3bb26b465f18c4ab5fc64
diff --git a/omec/omec-control-plane/Chart.yaml b/omec/omec-control-plane/Chart.yaml
index 002de3c..eb46c4a 100644
--- a/omec/omec-control-plane/Chart.yaml
+++ b/omec/omec-control-plane/Chart.yaml
@@ -11,4 +11,4 @@
 name: omec-control-plane
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 0.1.32
+version: 0.2.0
diff --git a/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl b/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl
index 6b6cb9e..469424d 100644
--- a/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl
+++ b/omec/omec-control-plane/templates/bin/_hss-bootstrap.sh.tpl
@@ -85,9 +85,6 @@
     echo -e "Added mme $id\n"
 }
 
-mme_identity={{ tuple "mme" "identity" . | include "omec-control-plane.diameter_endpoint" }}
-mme_realm={{ tuple "mme" "realm" . | include "omec-control-plane.diameter_endpoint" }}
-
 {{- range .Values.config.hss.bootstrap.users }}
 provision_users \
     {{ .count }} \
@@ -113,15 +110,15 @@
     {{ $.Values.config.hss.hssdb }} \
     $mme_identity \
     $mme_realm \
-    {{ .staticAddr }} 
+    {{ .staticAddr }}
 {{- end }}
 
 {{- range .Values.config.hss.bootstrap.mmes }}
 provision_mme \
     {{ .id }} \
     {{ .isdn }} \
-    $mme_identity \
-    $mme_realm \
+    {{ .mme_identity }} \
+    {{ .mme_realm }} \
     {{ .unreachability }} \
     {{ $.Values.config.hss.hssdb }}
 {{- end }}
diff --git a/omec/omec-control-plane/templates/configmap-hss.yaml b/omec/omec-control-plane/templates/configmap-hss.yaml
index 72b5bbb..7e2dc5d 100644
--- a/omec/omec-control-plane/templates/configmap-hss.yaml
+++ b/omec/omec-control-plane/templates/configmap-hss.yaml
@@ -8,6 +8,7 @@
 Declare variables to be passed into your templates.
 */}}
 
+{{- if .Values.config.hss.deploy }}
 {{- $hssJson := index .Values.config.hss.cfgFiles "hss.json" }}
 {{- $hssJsonCommon := index $hssJson "common" }}
 {{- $hssJsonHss := index $hssJson "hss" }}
@@ -98,3 +99,4 @@
 {{- range $key, $value := .Values.config.hss.cfgFiles }}
   {{ $key }}: {{ toJson $value | quote }}
 {{- end }}
+{{- end }}
diff --git a/omec/omec-control-plane/templates/configmap-mme.yaml b/omec/omec-control-plane/templates/configmap-mme.yaml
index f1c51af..bc5db25 100644
--- a/omec/omec-control-plane/templates/configmap-mme.yaml
+++ b/omec/omec-control-plane/templates/configmap-mme.yaml
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
 */}}
 
+{{- if .Values.config.mme.deploy }}
 {{- $configJson := index .Values.config.mme.cfgFiles "config.json" }}
 {{- $configJsonS6a := index $configJson "s6a" }}
 
@@ -34,7 +35,7 @@
     #Port = 3868;
     #SecPort = 3869;
 
-    ConnectPeer = {{ tuple "hss" "identity" . | include "omec-control-plane.diameter_endpoint" | quote }} { No_TLS; port = 3868; };
+    ConnectPeer = {{ index $configJsonS6a "host" | quote }} { No_TLS; port = 3868; };
 
     LoadExtension = "/usr/local/lib/freeDiameter/dict_3gpp2_avps.fdx";
     LoadExtension = "/usr/local/lib/freeDiameter/dict_draftload_avps.fdx";
@@ -85,3 +86,4 @@
 {{- range $key, $value := .Values.config.mme.cfgFiles }}
   {{ $key }}: {{ toJson $value | quote }}
 {{- end }}
+{{- end }}
diff --git a/omec/omec-control-plane/templates/configmap-spgwc.yaml b/omec/omec-control-plane/templates/configmap-spgwc.yaml
index b3a9566..030a09a 100644
--- a/omec/omec-control-plane/templates/configmap-spgwc.yaml
+++ b/omec/omec-control-plane/templates/configmap-spgwc.yaml
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
 */}}
 
+{{- if .Values.config.spgwc.deploy }}
 ---
 apiVersion: v1
 kind: ConfigMap
@@ -91,3 +92,4 @@
 {{- range $key, $value := .Values.config.spgwc.jsonCfgFiles }}
   {{ $key }}: {{ toJson $value | quote }}
 {{- end }}
+{{- end }}
diff --git a/omec/omec-control-plane/templates/service-hss.yaml b/omec/omec-control-plane/templates/service-hss.yaml
index cdf5dc0..fad2a27 100644
--- a/omec/omec-control-plane/templates/service-hss.yaml
+++ b/omec/omec-control-plane/templates/service-hss.yaml
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
 */}}
 
+{{- if .Values.config.hss.deploy }}
 ---
 apiVersion: v1
 kind: Service
@@ -51,3 +52,4 @@
     protocol: TCP
     nodePort: {{ .Values.config.hss.s6a.nodePort.port }}
 {{- end }}
+{{- end }}
diff --git a/omec/omec-control-plane/templates/service-mme.yaml b/omec/omec-control-plane/templates/service-mme.yaml
index 9fa454f..1d112e6 100644
--- a/omec/omec-control-plane/templates/service-mme.yaml
+++ b/omec/omec-control-plane/templates/service-mme.yaml
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
 */}}
 
+{{- if .Values.config.mme.deploy }}
 {{- $configJson := index .Values.config.mme.cfgFiles "config.json" }}
 {{- $configJsonS11 := index $configJson "s11" }}
 {{- $configJsonS1ap := index $configJson "s1ap" }}
@@ -88,3 +89,4 @@
       nodePort: {{ .Values.prometheusExporter.mme.port }}
       protocol: TCP
   {{- end }}
+{{- end }}
diff --git a/omec/omec-control-plane/templates/service-spgwc.yaml b/omec/omec-control-plane/templates/service-spgwc.yaml
index e00b805..aeb8f5b 100644
--- a/omec/omec-control-plane/templates/service-spgwc.yaml
+++ b/omec/omec-control-plane/templates/service-spgwc.yaml
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
 */}}
 
+{{- if .Values.config.spgwc.deploy }}
 ---
 apiVersion: v1
 kind: Service
@@ -74,3 +75,4 @@
 {{- end }}
 {{- end }}
 {{- end }}
+{{- end }}
diff --git a/omec/omec-control-plane/templates/statefulset-hss.yaml b/omec/omec-control-plane/templates/statefulset-hss.yaml
index 8b32515..432dadb 100644
--- a/omec/omec-control-plane/templates/statefulset-hss.yaml
+++ b/omec/omec-control-plane/templates/statefulset-hss.yaml
@@ -8,6 +8,7 @@
 Declare variables to be passed into your templates.
 */}}
 
+{{- if .Values.config.hss.deploy }}
 {{ tuple "hss" . | include "omec-control-plane.service_account" }}
 ---
 apiVersion: apps/v1
@@ -106,3 +107,4 @@
         hostPath:
           path: {{ .Values.config.coreDump.path }}
     {{- end }}
+{{- end }}
diff --git a/omec/omec-control-plane/templates/statefulset-mme.yaml b/omec/omec-control-plane/templates/statefulset-mme.yaml
index 7d2f5f4..0d47a40 100644
--- a/omec/omec-control-plane/templates/statefulset-mme.yaml
+++ b/omec/omec-control-plane/templates/statefulset-mme.yaml
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
 */}}
 
+{{- if .Values.config.mme.deploy }}
 {{ tuple "mme" . | include "omec-control-plane.service_account" }}
 ---
 apiVersion: apps/v1
@@ -45,6 +46,7 @@
         volumeMounts:
         - name: host-rootfs
           mountPath: /mnt/host-rootfs
+    {{- if .Values.config.hss.deploy }}
       - name: mme-dep-check
         image: {{ .Values.images.tags.depCheck | quote }}
         imagePullPolicy: {{ .Values.images.pullPolicy }}
@@ -74,6 +76,7 @@
           - kubernetes-entrypoint
         volumeMounts:
           []
+    {{- end }}
       - name: mme-init
         image: {{ .Values.images.tags.mme | quote }}
         imagePullPolicy: {{ .Values.images.pullPolicy }}
@@ -266,3 +269,4 @@
         hostPath:
           path: {{ .Values.config.coreDump.path }}
     {{- end }}
+{{- end }}
diff --git a/omec/omec-control-plane/templates/statefulset-spgwc.yaml b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
index eaf3100..885d873 100644
--- a/omec/omec-control-plane/templates/statefulset-spgwc.yaml
+++ b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
 */}}
 
+{{- if .Values.config.spgwc.deploy }}
 {{ tuple "spgwc" . | include "omec-control-plane.service_account" }}
 ---
 apiVersion: apps/v1
@@ -110,3 +111,4 @@
         hostPath:
           path: {{ .Values.config.coreDump.path }}
     {{- end }}
+{{- end }}
diff --git a/omec/omec-control-plane/values.yaml b/omec/omec-control-plane/values.yaml
index 8e838bf..98045cc 100644
--- a/omec/omec-control-plane/values.yaml
+++ b/omec/omec-control-plane/values.yaml
@@ -83,6 +83,7 @@
     enabled: false
     path: /tmp/coredump
   hss:
+    deploy: true
     hssdb: cassandra
     s6a:
       nodePort:
@@ -105,12 +106,10 @@
         - imsiStart: "208014567891200"
           msisdnStart: "1122334455"
           count: 10
-      staticusers:
-        - imsi: "208014567891201"
-          msisdn: "1122334455"
-          staticAddr: 0.0.0.0
       mmes:
         - id: 1
+          mme_identity: mme.omec.svc.cluster.local
+          mme_realm: omec.svc.cluster.local
           isdn: "19136246000"
           unreachability: 1
     # See https://github.com/omec-project/c3po for details of config options
@@ -176,6 +175,7 @@
                   - id: frequency
                     type: integer
   mme:
+    deploy: true
     spgwAddr: spgwc
     s11:
       nodePort:
@@ -234,6 +234,7 @@
         - imsi: 208014567891201
           phoneType: "iPhone11-Pro"
   spgwc:
+    deploy: true
     pfcp: false
     apn: internet
     # ueStaticPool is used only when multiUpfs is not enabled.