EDGEPOD-103 : SGW should not take MME address as config parameter

Getting rid of mme-ip exposure to SGWC pod.

Change-Id: I2f87aae435d95dd4be33ab2c00d0721c5ebefe63
diff --git a/omec/omec-control-plane/Chart.yaml b/omec/omec-control-plane/Chart.yaml
index 3a8444e..6809d1a 100644
--- a/omec/omec-control-plane/Chart.yaml
+++ b/omec/omec-control-plane/Chart.yaml
@@ -19,4 +19,4 @@
 name: omec-control-plane
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 0.1.17
+version: 0.1.18
diff --git a/omec/omec-control-plane/templates/bin/_mme-ip.sh.tpl b/omec/omec-control-plane/templates/bin/_mme-ip.sh.tpl
deleted file mode 100644
index 92d8a8c..0000000
--- a/omec/omec-control-plane/templates/bin/_mme-ip.sh.tpl
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2019-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -x
-
-# Check if mme IP has been changed
-kubectl get cm -n $NAMESPACE -o json mme-ip > mme-ip.json
-mme_ip=$(jq '.data.IP' mme-ip.json)
-if [ $mme_ip != null ] && [ $mme_ip = \"$POD_IP\" ]; then
-    return
-fi
-
-# Update mme IP if it has been changed
-cat <<EOF >patch.json
-{"data": {"IP": "$POD_IP"}}
-EOF
-kubectl patch -n $NAMESPACE configmap mme-ip --patch "$(cat patch.json)"
-
-# Update and restart SPGWC if it is deployed
-kubectl get po -n $NAMESPACE --selector app=spgwc | grep Running -q
-if [ $? -eq 0 ]; then
-    kubectl rollout restart -n $NAMESPACE statefulset/spgwc
-fi
diff --git a/omec/omec-control-plane/templates/configmap-mme-ip.yaml b/omec/omec-control-plane/templates/configmap-mme-ip.yaml
deleted file mode 100644
index 4ddc2fc..0000000
--- a/omec/omec-control-plane/templates/configmap-mme-ip.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-{{/*
-Copyright 2019-present Open Networking Foundation
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/}}
-
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: mme-ip
-  labels:
-{{ tuple "spgwc" . | include "omec-control-plane.metadata_labels" | indent 4 }}
-data:
-{{- if hasKey .Values.config.spgwc "mmeAddr" }}
-  IP: {{ .Values.config.spgwc.mmeAddr }}
-{{- end }}
diff --git a/omec/omec-control-plane/templates/configmap-mme.yaml b/omec/omec-control-plane/templates/configmap-mme.yaml
index 6ec9576..139ec8c 100644
--- a/omec/omec-control-plane/templates/configmap-mme.yaml
+++ b/omec/omec-control-plane/templates/configmap-mme.yaml
@@ -92,10 +92,6 @@
 {{ tuple "bin/_mme-init.sh.tpl" . | include "omec-control-plane.template" | indent 4 }}
   mme-run.sh: |
 {{ tuple "bin/_mme-run.sh.tpl" . | include "omec-control-plane.template" | indent 4 }}
-{{- if not (hasKey .Values.config.spgwc "mmeAddr") }}
-  mme-ip.sh: |
-{{ tuple "bin/_mme-ip.sh.tpl" . | include "omec-control-plane.template" | indent 4 }}
-{{- end }}
 {{- range $key, $value := .Values.config.mme.cfgFiles }}
   {{ $key }}: {{ toJson $value | quote }}
 {{- end }}
diff --git a/omec/omec-control-plane/templates/configmap-spgwc.yaml b/omec/omec-control-plane/templates/configmap-spgwc.yaml
index 4a049c2..ea9aeb4 100644
--- a/omec/omec-control-plane/templates/configmap-spgwc.yaml
+++ b/omec/omec-control-plane/templates/configmap-spgwc.yaml
@@ -29,7 +29,7 @@
     CORES="-c $(taskset -p $$ | awk '{print $NF}')"
     EAL_ARGS="${CORES} ${MEMORY} --no-pci"
 
-    MGMT_INFO="-s ${POD_IP} -m ${MME_ADDR} -w {{ .Values.config.spgwc.s1uAddr }}"
+    MGMT_INFO="-s ${POD_IP} -w {{ .Values.config.spgwc.s1uAddr }}"
     APN_INFO="-i {{ .Values.config.spgwc.ueIpPool.ip }} -p {{ .Values.config.spgwc.ueIpPool.mask }} -a {{ .Values.config.spgwc.apn }}"
     MISC="-l 2"
     SPGW_CFG="-d 03"
diff --git a/omec/omec-control-plane/templates/statefulset-mme.yaml b/omec/omec-control-plane/templates/statefulset-mme.yaml
index a858bab..2ea0afe 100644
--- a/omec/omec-control-plane/templates/statefulset-mme.yaml
+++ b/omec/omec-control-plane/templates/statefulset-mme.yaml
@@ -39,26 +39,6 @@
     {{- end }}
       serviceAccountName: mme
       initContainers:
-    {{- if not (hasKey .Values.config.spgwc "mmeAddr") }}
-      - name: mme-configmap-mme-ip
-        image: {{ .Values.images.tags.init | quote }}
-        imagePullPolicy: {{ .Values.images.pullPolicy }}
-        env:
-        - name: NAMESPACE
-          valueFrom:
-            fieldRef:
-              apiVersion: v1
-              fieldPath: metadata.namespace
-        - name: POD_IP
-          valueFrom:
-            fieldRef:
-              fieldPath: status.podIP
-        command: ["/opt/mme/scripts/mme-ip.sh"]
-        volumeMounts:
-        - name: scripts
-          mountPath: /opt/mme/scripts/mme-ip.sh
-          subPath: mme-ip.sh
-    {{- end }}
       - name: mme-load-sctp-module
         image: {{ .Values.images.tags.init | quote }}
         imagePullPolicy: {{ .Values.images.pullPolicy }}
diff --git a/omec/omec-control-plane/templates/statefulset-spgwc.yaml b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
index 90775c0..cd094ee 100644
--- a/omec/omec-control-plane/templates/statefulset-spgwc.yaml
+++ b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
@@ -89,11 +89,6 @@
           valueFrom:
             fieldRef:
               fieldPath: status.podIP
-        - name: MME_ADDR
-          valueFrom:
-            configMapKeyRef:
-              name: mme-ip
-              key: IP
       {{- if .Values.resources.enabled }}
         resources:
 {{ toYaml .Values.resources.spgwc | indent 10 }}
diff --git a/omec/omec-control-plane/values.yaml b/omec/omec-control-plane/values.yaml
index c52ce9b..a607e98 100644
--- a/omec/omec-control-plane/values.yaml
+++ b/omec/omec-control-plane/values.yaml
@@ -19,7 +19,7 @@
     hssdb: docker.io/omecproject/c3po-hssdb:1.0.0
     hss: docker.io/omecproject/c3po-hss:1.0.0
     mme: docker.io/omecproject/openmme:1.0.0
-    spgwc: docker.io/omecproject/ngic-cp:1.0.0
+    spgwc: docker.io/omecproject/ngic-cp:1.1.0
     depCheck: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
   pullPolicy: IfNotPresent
 
@@ -229,8 +229,6 @@
       mask: 255.0.0.0
     # This address must match to S1U IP address configured in omec-data-plane
     s1uAddr: 119.0.0.3
-    # mmeAddr will be set automatically to mme pod IP if it's unset
-    #mmeAddr:
     s11:
       nodePort:
         enabled: false