[COMAC-148] Make Accelleran CU support NodePort to connect with RU

Change-Id: I11284fc4a8a922cc0ad573e4495a33a66ccb772d
diff --git a/comac-cu/Chart.yaml b/comac-cu/Chart.yaml
index d676f38..7802fd6 100644
--- a/comac-cu/Chart.yaml
+++ b/comac-cu/Chart.yaml
@@ -17,5 +17,5 @@
 description: A Helm chart to install CU/BBU in COMAC
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 0.0.7
-appVersion: 0.0.7
+version: 0.1.0
+appVersion: 0.1.0
diff --git a/comac-cu/templates/configmap-accelleran.yaml b/comac-cu/templates/configmap-accelleran.yaml
index fc1d934..a70285a 100644
--- a/comac-cu/templates/configmap-accelleran.yaml
+++ b/comac-cu/templates/configmap-accelleran.yaml
@@ -20,5 +20,5 @@
 data:
   bootstrap.txt: |
     redis.hostname:{{ .Values.cu.name }}
-    redis.port:6379
+    redis.port:{{ .Values.cu.accelleran.ports.redis }}
     instance.filter:{{ .Values.cu.accelleran.instid }}
\ No newline at end of file
diff --git a/comac-cu/templates/networks.yaml b/comac-cu/templates/networks.yaml
deleted file mode 100644
index fd6a696..0000000
--- a/comac-cu/templates/networks.yaml
+++ /dev/null
@@ -1,31 +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: "k8s.cni.cncf.io/v1"
-kind: NetworkAttachmentDefinition
-metadata:
-  name: f1-net-cu
-{{- if $.Values.network.sriov.enabled }}
-  annotations:
-    k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_netdevice
-{{- end }}
-spec:
-  config: '{
-    "type": {{ .Values.network.f1.cni_plugin | quote }},
-    "ipam": {
-        "type": {{ .Values.network.f1.ipam | quote }}
-    }
-  }'
\ No newline at end of file
diff --git a/comac-cu/templates/service-accelleran.yaml b/comac-cu/templates/service-accelleran.yaml
index 5f01a95..eab72f9 100644
--- a/comac-cu/templates/service-accelleran.yaml
+++ b/comac-cu/templates/service-accelleran.yaml
@@ -26,6 +26,12 @@
     - name: s1ap
       port: {{ .Values.cu.accelleran.ports.s1ap }}
       protocol: SCTP
+    - name: nats
+      port: {{ .Values.cu.accelleran.ports.nats }}
+      protocol: TCP
+    - name: redis
+      port: {{ .Values.cu.accelleran.ports.redis }}
+      protocol: TCP
 
 ---
 apiVersion: v1
@@ -37,6 +43,15 @@
     app: {{ .Values.cu.name }}
   type: NodePort
   ports:
-    - port: {{ .Values.cu.accelleran.ports.s1ap }}
+    - name: s1ap-external
+      port: {{ .Values.cu.accelleran.ports.s1ap }}
       nodePort: {{ .Values.cu.accelleran.ports.s1ap_external }}
       protocol: SCTP
+    - name: nats-external
+      port: {{ .Values.cu.accelleran.ports.nats }}
+      nodePort: {{ .Values.cu.accelleran.ports.nats_external }}
+      protocol: TCP
+    - name: redis-external
+      port: {{ .Values.cu.accelleran.ports.redis }}
+      nodePort: {{ .Values.cu.accelleran.ports.redis_external }}
+      protocol: TCP
\ No newline at end of file
diff --git a/comac-cu/templates/statefulset-accelleran.yaml b/comac-cu/templates/statefulset-accelleran.yaml
index 6dd84f9..f0a88f0 100644
--- a/comac-cu/templates/statefulset-accelleran.yaml
+++ b/comac-cu/templates/statefulset-accelleran.yaml
@@ -30,18 +30,7 @@
     metadata:
       labels:
         app: {{ .Values.cu.name }}
-      annotations:
-        k8s.v1.cni.cncf.io/networks: '[
-          {
-            "name": "f1-net-cu",
-            "interface": {{ .Values.cu.accelleran.interface | quote }},
-            "ips": {{ .Values.cu.accelleran.ips | quote }}
-          }
-        ]'
-
     spec:
-      nodeSelector:
-{{ toYaml .Values.cu.nodeselector | indent 8 }}
       initContainers:
       - name: init-iptables
         image: {{ .Values.cu.accelleran.images.init }}
@@ -69,9 +58,6 @@
           limits:
             cpu: {{ .Values.cu.accelleran.resources.cpu }}
             memory: {{ .Values.cu.accelleran.resources.mem }}
-{{- if .Values.network.sriov.enabled }}
-            intel.com/sriov_netdevice: '2'
-{{- end }}
         securityContext:
           capabilities:
             add:
@@ -85,15 +71,12 @@
         command: ["sh", "-c"]
         args:
         # FIXME: Redis can't support with dns resolution, can't set hostname at here.
-        - (sleep 5; redis-cli -h localhost -p 6379 set NATS_SERVICE_URL "nat://$(ip route get 116 | awk '{print $NF;exit}'):4222";) &
+        - (sleep 5; redis-cli -h localhost -p {{ .Values.cu.accelleran.ports.redis }} set NATS_SERVICE_URL "nat://{{ .Values.cu.accelleran.node_ip }}:{{ .Values.cu.accelleran.ports.nats }}";) &
           /usr/local/bin/redis-server
         resources:
           limits:
             cpu: {{ .Values.cu.accelleran.resources.cpu }}
             memory: {{ .Values.cu.accelleran.resources.mem }}
-{{- if .Values.network.sriov.enabled }}
-            intel.com/sriov_netdevice: '2'
-{{- end }}
         securityContext:
           capabilities:
             add:
@@ -131,9 +114,6 @@
           limits:
             cpu: {{ .Values.cu.accelleran.resources.cpu }}
             memory: {{ .Values.cu.accelleran.resources.mem }}
-{{- if .Values.network.sriov.enabled }}
-            intel.com/sriov_netdevice: '2'
-{{- end }}
         securityContext:
           capabilities:
             add:
diff --git a/comac-cu/values.yaml b/comac-cu/values.yaml
index 6f7d41a..3824748 100644
--- a/comac-cu/values.yaml
+++ b/comac-cu/values.yaml
@@ -27,11 +27,8 @@
   location: remote # {remote: MME - same cluster, local: MME - different cluster}
   name: accelleran
   type: accelleran
-  nodeselector:
-    sriov: netdevice
   accelleran:
-    ips: 116.0.0.3/24
-    interface: f1-net-cu
+    node_ip: 10.90.0.131
     images:
       init: "ngick8stesting/c3po-mmeinit"
       nats: "node1:30500/accelleran/vran-nats:20190121"
@@ -40,6 +37,10 @@
     ports:
       s1ap: 36412
       s1ap_external: 31412
+      nats: 4222
+      nats_external: 4222
+      redis: 6379
+      redis_external: 6379
     replicas: 1
     instid: "enb_key"
     nats:
@@ -51,13 +52,3 @@
       enabled: false
       ip: "10.90.0.132"
       port: 30410
-
-network:
-  sriov:
-    enabled: true
-  etcdurl: http://node1:32379
-  f1:
-    cni_plugin: sriov
-    ipam: static
-    subnet: 116.0.0.0/24
-    gateway: 116.0.0.254