From 49efcfdb3f7ca534fa50cde2c4c65ce96ce6b03a Mon Sep 17 00:00:00 2001
From: arora <sagar.arora@eurecom.fr>
Date: Thu, 29 Jul 2021 15:50:45 +0200
Subject: [PATCH] Updated helm charts

---
 charts/oai-amf/templates/deployment.yaml       | 12 ++++++------
 charts/oai-amf/values.yaml                     | 16 ++++++++++++----
 charts/oai-nrf/templates/deployment.yaml       |  4 ++--
 charts/oai-nrf/templates/pvc.yaml              |  2 +-
 charts/oai-nrf/values.yaml                     | 13 +++++++++++--
 charts/oai-smf/templates/deployment.yaml       |  4 ++--
 charts/oai-smf/values.yaml                     | 18 +++++++++++++-----
 .../oai-spgwu-tiny/templates/deployment.yaml   |  9 +++++----
 charts/oai-spgwu-tiny/templates/multus.yaml    |  4 ++--
 charts/oai-spgwu-tiny/values.yaml              | 18 ++++++++++++------
 docs/DEPLOY_SA5G_HC.md                         | 17 +++++++++++------
 11 files changed, 77 insertions(+), 40 deletions(-)

diff --git a/charts/oai-amf/templates/deployment.yaml b/charts/oai-amf/templates/deployment.yaml
index e5b79cfd..8afcd266 100644
--- a/charts/oai-amf/templates/deployment.yaml
+++ b/charts/oai-amf/templates/deployment.yaml
@@ -28,7 +28,7 @@ spec:
         {{- toYaml .Values.podSecurityContext | nindent 8 }}
       containers:
       - name: tcpdump
-        image: corfr/tcpdump:latest
+        image: "{{ .Values.tcpdumpimage.repository }}:{{ .Values.tcpdumpimage.version }}"
         {{- if .Values.start.tcpdump}}
         command:
           - /bin/sh
@@ -39,13 +39,13 @@ spec:
           - /bin/sleep
           - infinity
         {{- end}}
-        {{- if .Values.persistent.sharedvolume}}
+        {{- if .Values.persistence.sharedvolume}}
         volumeMounts:
         - mountPath: "/pcap"
           name: cn5g-pv
         {{- end}}
       - name: amf
-        image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
+        image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
         {{- if .Values.resources.define}}
         resources:
           requests:
@@ -58,7 +58,7 @@ spec:
         securityContext:
           {{- toYaml .Values.securityContext | nindent 12 }}
         ports:
-        - containerPort: {{ .Values.service.n1Port }}
+        - containerPort: {{ .Values.service.sctpPort }}
           name: oai-amf
           protocol: SCTP
         - containerPort: {{ .Values.service.http1Port }}
@@ -304,10 +304,10 @@ spec:
               configMapKeyRef:
                 name: {{ .Chart.Name }}-configmap
                 key: operatorKey
-      {{- if .Values.persistent.sharedvolume}}
+      {{- if .Values.persistence.sharedvolume}}
       volumes:
       - name: cn5g-pv
-        persistentVolumeClaim:
+        persistenceVolumeClaim:
           claimName: cn5g-pvc
       {{- end }}
       dnsPolicy: ClusterFirst
diff --git a/charts/oai-amf/values.yaml b/charts/oai-amf/values.yaml
index e43eac82..f1bea5f5 100644
--- a/charts/oai-amf/values.yaml
+++ b/charts/oai-amf/values.yaml
@@ -5,13 +5,21 @@ replicaCount: 1
 
 namespace: "oai"
 
-image:
+nfimage:
   registry: local
-  repository: oai-amf # image name either locally present or in a public/private repository
+  repository: rdefosseoai/oai-amf # image name either locally present or in a public/private repository
   version: v1.1.0 # image tag
   # pullPolicy: IfNotPresent or Never or Always
   pullPolicy: Always
 
+tcpdumpimage:
+  registry: local
+  repository: corfr/tcpdump
+  version: latest
+  #pullPolicy: IfNotPresent or Never or Always
+  pullPolicy: Always
+
+
 serviceAccount:
   # Specifies whether a service account should be created
   create: true
@@ -30,7 +38,7 @@ securityContext:
 
 service:
   type: ClusterIP
-  n1Port: 38412
+  sctpPort: 38412
   http1Port: 80
   http2Port: 9090
 
@@ -42,7 +50,7 @@ start:
 ## This interface will be for N1/N2/NGAP
 
 multus:
-  create: false
+  create: true
   n1IPadd: "192.168.18.177"
   n1Netmask: "24"
   n1Gateway: "192.168.18.129"
diff --git a/charts/oai-nrf/templates/deployment.yaml b/charts/oai-nrf/templates/deployment.yaml
index 18ec6e0a..f9e85295 100644
--- a/charts/oai-nrf/templates/deployment.yaml
+++ b/charts/oai-nrf/templates/deployment.yaml
@@ -24,7 +24,7 @@ spec:
         {{- toYaml .Values.podSecurityContext | nindent 8 }}
       containers:
       - name: tcpdump
-        image: corfr/tcpdump:latest
+        image: "{{ .Values.tcpdumpimage.repository }}:{{ .Values.tcpdumpimage.version }}"
         {{- if .Values.start.tcpdump}}
         command:
           - /bin/sh
@@ -41,7 +41,7 @@ spec:
           name: cn5g-pv
         {{- end}}
       - name: nrf
-        image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
+        image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
         {{- if .Values.resources.define}}
         resources:
           requests:
diff --git a/charts/oai-nrf/templates/pvc.yaml b/charts/oai-nrf/templates/pvc.yaml
index 111bc06c..1fd316c3 100644
--- a/charts/oai-nrf/templates/pvc.yaml
+++ b/charts/oai-nrf/templates/pvc.yaml
@@ -1,4 +1,4 @@
-{{- if .Values.persistent.sharedvolume }}
+{{- if .Values.persistence.sharedvolume }}
 apiVersion: v1
 kind: PersistentVolumeClaim
 metadata:
diff --git a/charts/oai-nrf/values.yaml b/charts/oai-nrf/values.yaml
index d6f7df5b..8ae8704d 100644
--- a/charts/oai-nrf/values.yaml
+++ b/charts/oai-nrf/values.yaml
@@ -6,13 +6,22 @@ replicaCount: 1
 
 namespace: "oai"
 
-image:
+# NF image
+nfimage:
+  registry: local
+  repository: rdefosseoai/oai-nrf
+  version: v1.1.0
+  # pullPolicy: IfNotPresent or Never or Always
+  pullPolicy: Always
+
+tcpdumpimage:
   registry: local
   repository: oai-nrf
   version: v1.1.0
   # pullPolicy: IfNotPresent or Never or Always
   pullPolicy: Always
 
+
 serviceAccount:
   # Specifies whether a service account should be created
   create: true
@@ -53,7 +62,7 @@ config:
 
 persistence:
   sharedvolume: false
-  volumneName: managed-nfs-storage
+  volumeName: managed-nfs-storage
   size: 1Gi
 
 resources:
diff --git a/charts/oai-smf/templates/deployment.yaml b/charts/oai-smf/templates/deployment.yaml
index 30a73821..7106f053 100644
--- a/charts/oai-smf/templates/deployment.yaml
+++ b/charts/oai-smf/templates/deployment.yaml
@@ -24,7 +24,7 @@ spec:
         {{- toYaml .Values.podSecurityContext | nindent 8 }}
       containers:
       - name: tcpdump
-        image: corfr/tcpdump:latest
+        image: "{{ .Values.tcpdumpimage.repository }}:{{ .Values.tcpdumpimage.version }}"
         {{- if .Values.start.tcpdump}}
         command:
           - /bin/sh
@@ -41,7 +41,7 @@ spec:
           name: cn5g-pv
         {{- end}}
       - name: smf
-        image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
+        image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
         securityContext:
           {{- toYaml .Values.securityContext | nindent 12 }}
         ports:
diff --git a/charts/oai-smf/values.yaml b/charts/oai-smf/values.yaml
index f0383a16..af4bfa81 100644
--- a/charts/oai-smf/values.yaml
+++ b/charts/oai-smf/values.yaml
@@ -5,13 +5,21 @@ replicaCount: 1
 
 namespace: "oai"
 
-image:
+nfimage:
   registry: local
-  repository: oai-smf
+  repository: rdefosseoai/oai-smf
   version: v1.1.0
   #pullPolicy: IfNotPresent or Never or Always
   pullPolicy: Always
 
+tcpdumpimage:
+  registry: local
+  repository: corfr/tcpdump
+  version: latest
+  #pullPolicy: IfNotPresent or Never or Always
+  pullPolicy: Always
+
+
 imagePullSecrets: []
 
 serviceAccount:
@@ -61,7 +69,7 @@ config:
   amfIpv4Address: "127.0.0.1" # configure if NRF is not used 
   amfPort: "80" # configure if NRF is not used
   amfApiVersion: "v1" # configure if NRF is not used
-  amfFqdn: "localhost" # configure if NRF is not used
+  amfFqdn: "oai-amf-svc" # configure if NRF is not used
   udmIpv4Address: "127.0.0.1" # configure if UDM is used
   udmPort: "80" # configure if UDM is used
   udmApiVersion: "v1" # configure if UDM is used
@@ -71,10 +79,10 @@ config:
   nrfApiVersion: "v1"
   nrfFqdn: "oai-nrf-svc" # configure if NRF can be reached using Kubernetes service
   upfIpv4Address: "127.0.0.1" # configure if NRF is not used 
-  upfFqdn0: "localhost" # configure if NRF is not used and useFqdnDns is true
+  upfFqdn0: "oai-spgwu-svc" # configure if NRF is not used and useFqdnDns is true
     
 ## currently only used by tcpdump container to store the tcpdump, this volume will be shared between all the network functions
-persistent:
+persistence:
   sharedvolume: false  # should be true when if wants to store the tcpdump of all the network functions at same place
   volumneName: managed-nfs-storage
   size: 1Gi
diff --git a/charts/oai-spgwu-tiny/templates/deployment.yaml b/charts/oai-spgwu-tiny/templates/deployment.yaml
index 7b200673..21837816 100644
--- a/charts/oai-spgwu-tiny/templates/deployment.yaml
+++ b/charts/oai-spgwu-tiny/templates/deployment.yaml
@@ -19,8 +19,8 @@ spec:
       annotations:
         k8s.v1.cni.cncf.io/networks: >-
           [{
-                 "name": "{{ .Chart.Name }}-{{ .Values.namespace }}-net1",
-                 "default-route": ["{{ .Values.config.pgwuSgiGw }}"]
+                 "name": "{{ .Chart.Name }}-{{ .Values.namespace }}-n3-net1",
+                 "default-route": ["{{ .Values.multus.sgiGw }}"]
           }]
     {{- end }}
     spec:
@@ -28,7 +28,7 @@ spec:
         {{- toYaml .Values.podSecurityContext | nindent 8 }}
       containers:
       - name: tcpdump
-        image: corfr/tcpdump:latest
+        image: "{{ .Values.tcpdumpimage.repository }}:{{ .Values.tcpdumpimage.version }}"
         {{- if .Values.start.tcpdump}}
         command:
           - /bin/sh
@@ -45,7 +45,7 @@ spec:
           name: cn5g-pv
         {{- end}}
       - name: spgwu
-        image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
+        image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
         securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
         ports:
@@ -230,6 +230,7 @@ spec:
       dnsPolicy: ClusterFirst
       restartPolicy: Always
       schedulerName: default-scheduler
+      serviceAccountName: {{ .Values.serviceAccount.name }}
       terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
       {{- if .Values.nodeSelector}}
       nodeSelector: {{- toYaml .Values.nodeSelector | nindent 4 }}
diff --git a/charts/oai-spgwu-tiny/templates/multus.yaml b/charts/oai-spgwu-tiny/templates/multus.yaml
index 90ac20a4..a307c8a9 100644
--- a/charts/oai-spgwu-tiny/templates/multus.yaml
+++ b/charts/oai-spgwu-tiny/templates/multus.yaml
@@ -3,7 +3,7 @@
 apiVersion: "k8s.cni.cncf.io/v1"
 kind: NetworkAttachmentDefinition 
 metadata:
-  name: {{ .Chart.Name }}-{{ .Values.namespace }}-net1
+  name: {{ .Chart.Name }}-{{ .Values.namespace }}-n3-net1
 spec:
   config: '{ 
       "cniVersion": "0.3.0",
@@ -14,7 +14,7 @@ spec:
         "type": "static",
         "addresses": [
                 {
-                        "address": {{- cat .Values.config.n3Ip "/" .Values.config.n3Netmask | nospace | quote }}
+                        "address": {{- cat .Values.multus.n3Ip "/" .Values.multus.n3Netmask | nospace | quote }}
                 }
         ]
       }
diff --git a/charts/oai-spgwu-tiny/values.yaml b/charts/oai-spgwu-tiny/values.yaml
index 985dd8d8..d4a02335 100644
--- a/charts/oai-spgwu-tiny/values.yaml
+++ b/charts/oai-spgwu-tiny/values.yaml
@@ -6,13 +6,19 @@ replicaCount: 1
 
 namespace: "oai"
 
-image:
+nfimage:
   registry: local
-  repository: oai-spgwu
+  repository: rdefosseoai/oai-spgwu-tiny
   version: v1.1.2
   # pullPolicy: IfNotPresent or Never or Always
   pullPolicy: Always
 
+tcpdumpimage:
+  registry: local
+  repository: corfr/tcpdump
+  version: latest
+  #pullPolicy: IfNotPresent or Never or Always
+  pullPolicy: Always
 
 serviceAccount:
   # Specifies whether a service account should be created
@@ -30,8 +36,8 @@ securityContext:
 
 service:
   type: ClusterIP
-  n4Port: 8805 # default port no need to change unless necessary
-  n3Port: 2152 # default port no need to change unless necessary
+  pfcpPort: 8805 # default port no need to change unless necessary
+  gtpuPort: 2152 # default port no need to change unless necessary
 
 start:
   spgwu: true
@@ -42,7 +48,7 @@ multus:
   create: true
   n3Ip: "192.168.18.179"
   n3Netmask: "24"
-  SgiGw: "192.168.18.129"
+  sgiGw: "192.168.18.129"
 
 config:
   gwId: 1 # no need to configure
@@ -77,7 +83,7 @@ config:
   upfFqdn5g: "oai-spgwu-tiny-svc" # fqdn of upf 
 
 ## currently only used by tcpdump container to store the tcpdump, this volume will be shared between all the network functions
-persistent:
+persistence:
   sharedvolume: false  # should be true when if wants to store the tcpdump of all the network functions at same place
   volumneName: managed-nfs-storage
   size: 1Gi
diff --git a/docs/DEPLOY_SA5G_HC.md b/docs/DEPLOY_SA5G_HC.md
index 68167f5f..12cc4024 100644
--- a/docs/DEPLOY_SA5G_HC.md
+++ b/docs/DEPLOY_SA5G_HC.md
@@ -19,6 +19,11 @@ The cloud native network functions in production will be deployed using a produc
 ![Helm Chart Deployment](./images/helm_diag.png)
 
 
+**Reading time: ~40mins**
+
+**Tutorial replication time: ~1h30mins**
+
+
 **TABLE OF CONTENTS**
 
 1.  [Description](#1-description)
@@ -227,15 +232,15 @@ $ helm install nrf oai-nrf/
 # wait for the pod to come up
 $ helm install smf oai-smf/
 # wait for the pod to come up
-$ helm install spgwu oai-spgwu-tiny/
+$ helm install upf oai-spgwu-tiny/
 # wait for the pod to come up
 $ helm list
 NAME  NAMESPACE       REVISION  UPDATED                                   STATUS    CHART                 APP VERSION
-amf   oai-5g-develop  1         2021-05-12 12:07:36.345877418 +0200 CEST  deployed  oai-amf-0.1.0         0.1.0 
-mysql oai-5g-develop  1         2021-05-12 11:09:32.597525506 +0200 CEST  deployed  mysql-1.6.9           5.7.30     
-nrf   oai-5g-develop  1         2021-05-12 11:32:43.648706741 +0200 CEST  deployed  oai-nrf-0.1.0         0.1.0 
-smf   oai-5g-develop  1         2021-05-12 12:05:38.251220635 +0200 CEST  deployed  oai-smf-0.1.0         0.1.0 
-spgwu oai-5g-develop  1         2021-05-12 12:08:31.408369994 +0200 CEST  deployed  oai-spgwu-tiny-0.1.1  0.1.1 
+mysql oai-5g-develop  1         2021-07-29 14:20:34.010881045 +0200 CEST  deployed  mysql-1.6.9           5.7.30
+amf   oai-5g-develop  1         2021-07-29 14:25:34.010881045 +0200 CEST  deployed  oai-amf-1.1.0         1.1.0      
+nrf   oai-5g-develop  1         2021-07-29 14:16:11.530949242 +0200 CEST  deployed  oai-nrf-1.1.0         1.1.0      
+smf   oai-5g-develop  1         2021-07-29 15:34:15.62785988 +0200 CEST   deployed  oai-smf-1.1.0         1.1.0      
+upf   oai-5g-develop  1         2021-07-29 15:28:04.773480519 +0200 CEST  deployed  oai-spgwu-tiny-1.1.2  1.1.2  
 ```
 
 Now go ahead and use OAI-gNB/dsTest/gNBSIM or any other gNB or emulator to test the deployed core network.
\ No newline at end of file
-- 
GitLab