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

Change-Id: I11284fc4a8a922cc0ad573e4495a33a66ccb772d
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: