[COMAC-102] allow CDN-Local to use HostNetwork for non-SRIOV environment

Change-Id: I03501d09756db547eadba2989642aee3d730dc59
diff --git a/cdn-services/cdn-local/Chart.yaml b/cdn-services/cdn-local/Chart.yaml
index ba270fe..85faa98 100644
--- a/cdn-services/cdn-local/Chart.yaml
+++ b/cdn-services/cdn-local/Chart.yaml
@@ -17,4 +17,4 @@
 appVersion: "1.0"
 description: A Helm chart for M-CORD CDN Services in Local Edge
 name: cdn-local
-version: 0.2.0
+version: 0.2.1
diff --git a/cdn-services/cdn-local/templates/networks.yaml b/cdn-services/cdn-local/templates/networks.yaml
index 54b44a2..b3bf674 100644
--- a/cdn-services/cdn-local/templates/networks.yaml
+++ b/cdn-services/cdn-local/templates/networks.yaml
@@ -14,15 +14,14 @@
 limitations under the License.
 */}}
 
+{{ if .Values.config.sriov.enabled }}
 ---
 apiVersion: "k8s.cni.cncf.io/v1"
 kind: NetworkAttachmentDefinition
 metadata:
   name: sgi-net-cdn
-{{- if .Values.config.sriov.enabled }}
   annotations:
     k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_netdevice
-{{- end }}
 spec:
   config: '{
     "type": {{ .Values.networks.cniPlugin | quote }},
@@ -30,3 +29,4 @@
         "type": {{ .Values.networks.ipam | quote }}
     }
   }'
+{{ end }}
\ No newline at end of file
diff --git a/cdn-services/cdn-local/templates/statefulset-nginx.yaml b/cdn-services/cdn-local/templates/statefulset-nginx.yaml
index 93b1f13..1e67e1c 100644
--- a/cdn-services/cdn-local/templates/statefulset-nginx.yaml
+++ b/cdn-services/cdn-local/templates/statefulset-nginx.yaml
@@ -33,6 +33,7 @@
     metadata:
       labels:
 {{ tuple "nginx" . | include "cdn-local.metadata_labels" | indent 8 }}
+{{ if .Values.config.sriov.enabled }}
       annotations:
         k8s.v1.cni.cncf.io/networks: '[
           {
@@ -41,11 +42,13 @@
             "ips": {{ .Values.config.nginx.sgi.ip | quote }}
           }
         ]'
+{{ end }}
     spec:
     {{- if .Values.nodeSelectors.enabled }}
       nodeSelector:
         {{ .Values.nodeSelectors.antMedia.label }}: {{ .Values.nodeSelectors.antMedia.value }}
     {{- end }}
+      hostNetwork: {{ not .Values.config.sriov.enabled }}
       serviceAccountName: nginx
       initContainers:
       - name: nginx-init
diff --git a/cdn-services/cdn-local/values.yaml b/cdn-services/cdn-local/values.yaml
index 069b9d1..6f6e675 100644
--- a/cdn-services/cdn-local/values.yaml
+++ b/cdn-services/cdn-local/values.yaml
@@ -36,7 +36,7 @@
 
 config:
   sriov:
-    enabled: true # default value. Do not use here as false now.
+    enabled: true # If you want to use Host Network, please unset this flag.
     netDevice:
       pfNames:
         - eno2