Add nodeSelctor to omasim

Also, change "conf" to "config" for consistency with omec charts.

Change-Id: I6db9a4d51a131292df1c78b65ed7306d1748388c
diff --git a/oaisim/Chart.yaml b/oaisim/Chart.yaml
index 5a7dd3b..5968db2 100644
--- a/oaisim/Chart.yaml
+++ b/oaisim/Chart.yaml
@@ -16,4 +16,4 @@
 appVersion: "1.0"
 description: openairinterface5g eNB and UE
 name: oaisim
-version: 0.1.1
+version: 0.1.2
diff --git a/oaisim/templates/_helper.tpl b/oaisim/templates/_helper.tpl
index a9d3a15..48c53dd 100644
--- a/oaisim/templates/_helper.tpl
+++ b/oaisim/templates/_helper.tpl
@@ -21,7 +21,7 @@
 {{- $app := index . 0 -}}
 {{- $type := index . 1 -}}
 {{- $context := index . 2 -}}
-{{- $appContext := index $context.Values.conf $app -}}
+{{- $appContext := index $context.Values.config $app -}}
 {{- $appName := $appContext.name -}}
 {{- if eq $type "fqdn" -}}
 {{- printf "%s-0.%s.%s.svc.%s" $appName $appName $context.Release.Namespace "cluster.local" -}}
diff --git a/oaisim/templates/bin/_enb-init.sh.tpl b/oaisim/templates/bin/_enb-init.sh.tpl
index 7852f5b..f5e6f05 100644
--- a/oaisim/templates/bin/_enb-init.sh.tpl
+++ b/oaisim/templates/bin/_enb-init.sh.tpl
@@ -18,11 +18,11 @@
 
 cp /opt/oaisim/enb/config/nfapi.conf /etc/oaisim/enb/nfapi.conf
 
-S1_MME_IFACE={{ .Values.conf.enb.networks.s1_mme.interface }}
+S1_MME_IFACE={{ .Values.config.enb.networks.s1_mme.interface }}
 S1_MME_IP=$(ip addr show $S1_MME_IFACE | grep inet | grep -v inet6 | awk '{print $2}' | cut -d'/' -f1)
 sed -i "s/S1_MME_IP_ADDRESS/\"$S1_MME_IP\"/g" /etc/oaisim/enb/nfapi.conf
 
-S1U_IFACE={{ .Values.conf.enb.networks.s1u.interface }}
+S1U_IFACE={{ .Values.config.enb.networks.s1u.interface }}
 S1U_IP=$(ip addr show $S1U_IFACE | grep inet | grep -v inet6 | awk '{print $2}' | cut -d'/' -f1)
 sed -i "s/S1U_IP_ADDRESS/\"$S1U_IP\"/g" /etc/oaisim/enb/nfapi.conf
 sed -i "s/X2C_IP_ADDRESS/\"$ENB_LOCAL_IP\"/g" /etc/oaisim/enb/nfapi.conf
diff --git a/oaisim/templates/configmap-enb.yaml b/oaisim/templates/configmap-enb.yaml
index 68c7422..be11d02 100644
--- a/oaisim/templates/configmap-enb.yaml
+++ b/oaisim/templates/configmap-enb.yaml
@@ -18,7 +18,7 @@
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ .Values.conf.enb.name }}
+  name: {{ .Values.config.enb.name }}
 data:
   nfapi.conf: |
     Active_eNBs = ("eNB-OAISIM-LTEBox");
@@ -35,9 +35,9 @@
         tracking_area_code = 1;
         plmn_list = (
           {
-            mcc = {{ .Values.conf.plmn.mcc }};
-            mnc = {{ .Values.conf.plmn.mnc }};
-            mnc_length = {{ .Values.conf.plmn.mnc_length }};
+            mcc = {{ .Values.config.plmn.mcc }};
+            mnc = {{ .Values.config.plmn.mnc }};
+            mnc_length = {{ .Values.config.plmn.mnc_length }};
           }
         );
         tr_s_preference     = "local_mac"
@@ -180,7 +180,7 @@
         ////////// MME parameters:
         mme_ip_address = (
           {
-            ipv4       = {{ .Values.conf.enb.mme.address | quote }};
+            ipv4       = {{ .Values.config.enb.mme.address | quote }};
             ipv6       = "192:168:30::17";
             active     = "yes";
             preference = "ipv4";
@@ -189,11 +189,11 @@
 
         NETWORK_INTERFACES :
         {
-          ENB_INTERFACE_NAME_FOR_S1_MME            = {{ .Values.conf.enb.networks.s1_mme.interface | quote }};
+          ENB_INTERFACE_NAME_FOR_S1_MME            = {{ .Values.config.enb.networks.s1_mme.interface | quote }};
           ENB_IPV4_ADDRESS_FOR_S1_MME              = S1_MME_IP_ADDRESS;
-          ENB_INTERFACE_NAME_FOR_S1U               = {{ .Values.conf.enb.networks.s1u.interface | quote }};
+          ENB_INTERFACE_NAME_FOR_S1U               = {{ .Values.config.enb.networks.s1u.interface | quote }};
           ENB_IPV4_ADDRESS_FOR_S1U                 = S1U_IP_ADDRESS;
-          ENB_PORT_FOR_S1U                         = {{ .Values.conf.enb.networks.s1u.port }}; # Spec 2152
+          ENB_PORT_FOR_S1U                         = {{ .Values.config.enb.networks.s1u.port }}; # Spec 2152
           ENB_IPV4_ADDRESS_FOR_X2C                 = X2C_IP_ADDRESS;
           ENB_PORT_FOR_X2C                         = 36422; # Spec 36422
         };
diff --git a/oaisim/templates/configmap-ue.yaml b/oaisim/templates/configmap-ue.yaml
index 1ee07a3..6476f7d 100644
--- a/oaisim/templates/configmap-ue.yaml
+++ b/oaisim/templates/configmap-ue.yaml
@@ -14,20 +14,20 @@
 limitations under the License.
 */}}
 
-{{- $plmn := tuple .Values.conf.plmn.mcc .Values.conf.plmn.mnc | include "oaisim.plmn" | quote -}}
+{{- $plmn := tuple .Values.config.plmn.mcc .Values.config.plmn.mnc | include "oaisim.plmn" | quote -}}
 ---
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: {{ .Values.conf.ue.name }}
+  name: {{ .Values.config.ue.name }}
 data:
   ue_comac_test.conf: |
     PLMN: {
       PLMN0: {
-             FULLNAME={{ .Values.conf.plmn.name | quote }};
-             SHORTNAME={{ .Values.conf.plmn.short_name | quote }};
-             MCC={{ .Values.conf.plmn.mcc | quote }};
-             MNC={{ .Values.conf.plmn.mnc | quote }};
+             FULLNAME={{ .Values.config.plmn.name | quote }};
+             SHORTNAME={{ .Values.config.plmn.short_name | quote }};
+             MCC={{ .Values.config.plmn.mcc | quote }};
+             MNC={{ .Values.config.plmn.mnc | quote }};
       };
     };
     UE0: {
@@ -38,10 +38,10 @@
             PIN="0000";
       };
       SIM: {
-           MSIN={{ .Values.conf.ue.sim.msin | quote }};
-           USIM_API_K={{ .Values.conf.ue.sim.api_key | quote }};
-           OPC={{ .Values.conf.ue.sim.opc | quote }};
-           MSISDN={{ .Values.conf.ue.sim.msisdn | quote }};
+           MSIN={{ .Values.config.ue.sim.msin | quote }};
+           USIM_API_K={{ .Values.config.ue.sim.api_key | quote }};
+           OPC={{ .Values.config.ue.sim.opc | quote }};
+           MSISDN={{ .Values.config.ue.sim.msisdn | quote }};
       };
       HPLMN= {{ $plmn }};
       UCPLMN_LIST = ();
diff --git a/oaisim/templates/job-ue-setup-if.yaml b/oaisim/templates/job-ue-setup-if.yaml
index 1578d9b..9117578 100644
--- a/oaisim/templates/job-ue-setup-if.yaml
+++ b/oaisim/templates/job-ue-setup-if.yaml
@@ -16,7 +16,7 @@
 
 {{- $releaseName := .Release.Name }}
 {{- $namespace := .Release.Namespace }}
-{{- $name := .Values.conf.ue.name }}
+{{- $name := .Values.config.ue.name }}
 ---
 apiVersion: batch/v1
 kind: Job
@@ -33,6 +33,10 @@
       labels:
         app: {{ $name }}
     spec:
+    {{- if .Values.nodeSelectors.enabled }}
+      nodeSelector:
+        {{ .Values.nodeSelectors.ue.label }}: {{ .Values.nodeSelectors.ue.value }}
+    {{- end }}
       restartPolicy: Never
       containers:
         - name: ue-setup-if-job
diff --git a/oaisim/templates/job-ue-teardown-if.yaml b/oaisim/templates/job-ue-teardown-if.yaml
index 09981d0..0d5ce47 100644
--- a/oaisim/templates/job-ue-teardown-if.yaml
+++ b/oaisim/templates/job-ue-teardown-if.yaml
@@ -14,7 +14,7 @@
 limitations under the License.
 */}}
 
-{{- $name := .Values.conf.ue.name }}
+{{- $name := .Values.config.ue.name }}
 ---
 apiVersion: batch/v1
 kind: Job
@@ -31,6 +31,10 @@
       labels:
         app: {{ $name }}
     spec:
+    {{- if .Values.nodeSelectors.enabled }}
+      nodeSelector:
+        {{ .Values.nodeSelectors.ue.label }}: {{ .Values.nodeSelectors.ue.value }}
+    {{- end }}
       restartPolicy: Never
       containers:
         - name: ue-teardown-if-job
diff --git a/oaisim/templates/statefulset-enb.yaml b/oaisim/templates/statefulset-enb.yaml
index 47e31cd..173b868 100644
--- a/oaisim/templates/statefulset-enb.yaml
+++ b/oaisim/templates/statefulset-enb.yaml
@@ -16,7 +16,7 @@
 
 {{- $releaseName := .Release.Name }}
 {{- $namespace := .Release.Namespace }}
-{{- $name := .Values.conf.enb.name }}
+{{- $name := .Values.config.enb.name }}
 ---
 apiVersion: v1
 kind: ServiceAccount
@@ -76,6 +76,10 @@
       labels:
         app: oai-enb
     spec:
+    {{- if .Values.nodeSelectors.enabled }}
+      nodeSelector:
+        {{ .Values.nodeSelectors.enb.label }}: {{ .Values.nodeSelectors.enb.value }}
+    {{- end }}
       serviceAccountName: {{ $releaseName }}-{{ $name }}
       hostNetwork: true
       initContainers:
diff --git a/oaisim/templates/statefulset-ue.yaml b/oaisim/templates/statefulset-ue.yaml
index 2e366b8..1d412b7 100644
--- a/oaisim/templates/statefulset-ue.yaml
+++ b/oaisim/templates/statefulset-ue.yaml
@@ -16,7 +16,7 @@
 
 {{- $releaseName := .Release.Name }}
 {{- $namespace := .Release.Namespace }}
-{{- $name := .Values.conf.ue.name }}
+{{- $name := .Values.config.ue.name }}
 ---
 apiVersion: v1
 kind: ServiceAccount
@@ -76,6 +76,10 @@
       labels:
         app: oai-ue
     spec:
+    {{- if .Values.nodeSelectors.enabled }}
+      nodeSelector:
+        {{ .Values.nodeSelectors.ue.label }}: {{ .Values.nodeSelectors.ue.value }}
+    {{- end }}
       serviceAccountName: {{ $releaseName }}-{{ $name }}
       hostNetwork: true
       initContainers:
diff --git a/oaisim/values.yaml b/oaisim/values.yaml
index 6859207..b9d87f0 100644
--- a/oaisim/values.yaml
+++ b/oaisim/values.yaml
@@ -18,7 +18,17 @@
     enb: omecproject/lte-softmodem:1.0.0
     ue: omecproject/lte-uesoftmodem:1.0.0
   pullPolicy: IfNotPresent
-conf:
+
+nodeSelectors:
+  enabled: false
+  enb:
+    label: oaisim
+    value: enabled
+  ue:
+    label: oaisim
+    value: enabled
+
+config:
   # 1 PLMN is supported for now
   plmn:
     name: "COMAC Test Network"