Backup option for CDN: try to remove wowza trial version

Change-Id: I130b8592dd67a9c2e6b816e9665e4b83c00598d4
diff --git a/mcord/mcord-cdn-local-free/Chart.yaml b/mcord/mcord-cdn-local-free/Chart.yaml
new file mode 100644
index 0000000..70097f1
--- /dev/null
+++ b/mcord/mcord-cdn-local-free/Chart.yaml
@@ -0,0 +1,20 @@
+---
+# 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
+appVersion: "1.0"
+description: A Helm chart for MCORD CDN Services in Local Edge for free (w/o wowza)
+name: mcord-cdn-local-free
+version: 0.1.1
\ No newline at end of file
diff --git a/mcord/mcord-cdn-local-free/templates/cm.yaml b/mcord/mcord-cdn-local-free/templates/cm.yaml
new file mode 100644
index 0000000..1af5261
--- /dev/null
+++ b/mcord/mcord-cdn-local-free/templates/cm.yaml
@@ -0,0 +1,107 @@
+---
+# 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: nginx-rtmp-config
+data:
+  nginx_rtmp_config.sh: |+
+    #!/bin/bash
+    #ip addr add 192.168.99.2 dev north0
+    #ip addr add 192.168.99.3 dev north0d1
+    #ip route del default dev eth0
+    #ip route add default gw 192.168.99.2 north0
+    mkdir -pZ /var/www/live
+    ip route add {{ .Values.ue_ip_subnet1 }} via {{ .Values.spgwu_sgiip }} dev sgi-net;
+    ip route add {{ .Values.ue_ip_subnet2 }} via {{ .Values.spgwu_sgiip }} dev sgi-net;
+    ip link set sgi-net mtu 1200;
+    cp /conf/nginx.conf  /etc/nginx/
+    #nginx -c /etc/nginx/nginx.conf
+    #while true; do sleep 1; done
+    nginx -g "daemon off;"
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: nginx-rtmp-conf
+data:
+  nginx.conf: |+
+
+    # I'll explain why we only have 1 worker process later
+    worker_processes 1;
+    error_log /var/log/nginx/error.log;
+    pid /run/nginx.pid;
+
+    include /usr/share/nginx/modules/*.conf;
+
+    events {
+        use epoll;
+        worker_connections 1024;
+    }
+
+    http {
+        log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+                        '$status $body_bytes_sent "$http_referer" '
+                        '"$http_user_agent" "$http_x_forwarded_for" $request_time';
+        access_log /var/log/nginx/access.log main;
+        sendfile on;
+        tcp_nopush on;
+        tcp_nodelay on;
+        keepalive_timeout 65;
+        types_hash_max_size 2048;
+        include /etc/nginx/mime.types;
+        default_type application/octet-stream;
+
+        server {
+            listen 1980 default_server;
+            server_name _;
+            root /var/www;
+            expires -1d;
+
+            location ~ ^/live/.+\.ts$ {
+                # MPEG-TS segments can be cached upstream indefinitely
+                expires max;
+            }
+        }
+    }
+
+    rtmp {
+        server {
+            listen 1935;
+
+            application app {
+                live on;
+
+                # Don't allow RTMP playback
+                deny play all;
+
+                # Package streams as HLS
+                hls on;
+                hls_path /var/www/live;
+                hls_nested on;
+                #hls_datetime system;
+                hls_fragment_naming system;
+            }
+            application vod2 {
+               play /var/www/live;
+            }
+            application l {
+               live on;
+               play /opt/cdn/movies;
+            }
+        }
+    }
\ No newline at end of file
diff --git a/mcord/mcord-cdn-local-free/templates/nginx.yaml b/mcord/mcord-cdn-local-free/templates/nginx.yaml
new file mode 100644
index 0000000..ac3d2d9
--- /dev/null
+++ b/mcord/mcord-cdn-local-free/templates/nginx.yaml
@@ -0,0 +1,130 @@
+---
+# 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: Service
+metadata:
+  labels:
+    name: nginx-rtmp
+  name: nginx-rtmp
+spec:
+  selector:
+    app: nginx-rtmp
+  type: NodePort
+  ports:
+  - name: rtmp
+    port: {{ .Values.nginx.ports.rtmp_orig }}
+    nodePort: {{ .Values.nginx.ports.rtmp_np }}
+    protocol: TCP
+  - name: stream
+    port: {{ .Values.nginx.ports.stream_orig }}
+    nodePort: {{ .Values.nginx.ports.stream_np }}
+    protocol: TCP
+
+---
+apiVersion: apps/v1beta1
+kind: StatefulSet
+metadata:
+  name: nginx-rtmp
+spec:
+  serviceName: nginx-rtmp
+  replicas: {{ .Values.nginx.replicas}}
+  template:
+    metadata:
+      labels:
+        name: nginx-rtmp
+        app: nginx-rtmp
+      annotations:
+        k8s.v1.cni.cncf.io/networks: '[
+            { "name": "sgi-net", "interface": "sgi-net", "namespace": "default" }
+        ]'
+    spec:
+      #hostNetwork: true
+      nodeSelector:
+        kubernetes.io/hostname: {{ .Values.node_selector }}
+      terminationGracePeriodSeconds: 0
+      imagePullSecrets:
+      - name: nexus-docker-secret
+      initContainers:
+      - name: "nginx-rtmp-init"
+        image: {{ .Values.nginx.images.nginx_image }}
+        imagePullPolicy: "IfNotPresent"
+        args:
+        - cp /config/*.sh /shared-vol;cp /conf/* /shared-vol
+        command:
+        - "/bin/bash"
+        - "-c"
+        volumeMounts:
+        - name: "shared-volume"
+          mountPath: "/shared-vol"
+        - name: "nginx-rtmp-config"
+          mountPath: "/config"
+        - name: "nginx-rtmp-conf"
+          mountPath: "/conf"
+      containers:
+      - name: nginx-rtmp
+        image: {{ .Values.nginx.images.nginx_image }}
+        imagePullPolicy: IfNotPresent
+        args:
+        - chmod a+x /config/*.sh;/config/nginx_rtmp_config.sh
+        command:
+        - "/bin/bash"
+        - "-c"
+        tty: true
+        securityContext:
+          privileged: true
+        ports:
+        - containerPort: {{ .Values.nginx.ports.rtmp_orig }}
+        - containerPort: {{ .Values.nginx.ports.stream_orig }}
+        volumeMounts:
+        - name: shared-volume
+          mountPath: /config
+        - name: shared-volume
+          mountPath: /conf
+        resources:
+          limits:
+            intel.com/sriov: '2'
+      - name: streaming
+        image: {{ .Values.local_streaming.images.local_streaming_image }}
+        imagePullPolicy: IfNotPresent
+        ports:
+        - containerPort: {{ .Values.local_streaming.ports.vlc }}
+        - containerPort: {{ .Values.local_streaming.ports.http }}
+        stdin: true
+        tty: true
+        command: [ "bash",  "-xc"]
+        args:
+        - sed -i 's/geteuid/getppid/' /usr/bin/vlc;
+          ffmpeg -re -i /opt/cdn/movies/{{ .Values.local_streaming.video_quality }}.mp4 -c copy -f flv rtmp://{{ .Values.local_streaming.nginx_ip }}:1935/app/l
+        resources:
+          limits:
+            cpu: {{ .Values.local_streaming.resources.cpu }}
+            memory: {{ .Values.local_streaming.resources.mem }}
+      volumes:
+      - name: nginx-rtmp-config
+        configMap:
+          name: nginx-rtmp-config
+          items:
+          - key: nginx_rtmp_config.sh
+            path: nginx_rtmp_config.sh
+      - name: nginx-rtmp-conf
+        configMap:
+          name: nginx-rtmp-conf
+          items:
+          - key: nginx.conf
+            path: nginx.conf
+      - name: shared-volume
+        emptyDir: {}
diff --git a/mcord/mcord-cdn-local-free/values.yaml b/mcord/mcord-cdn-local-free/values.yaml
new file mode 100644
index 0000000..271f25b
--- /dev/null
+++ b/mcord/mcord-cdn-local-free/values.yaml
@@ -0,0 +1,46 @@
+---
+# 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.
+
+namespace: epc
+nginx_hostname: "nginx"
+node_selector: "node3"
+spgwu_sgiip: 13.0.0.83
+ue_ip_subnet1: 16.0.0.0/8
+ue_ip_subnet2: 17.0.0.0/8
+
+nginx:
+  images:
+    nginx_image: "woojoong/nginx:onf-video-v2"
+  ports:
+    rtmp_orig: 1935
+    rtmp_np: 31935
+    stream_orig: 1980
+    stream_np: 31980
+  replicas: 1
+
+local_streaming:
+  video_quality: 360
+  nginx_ip: 127.0.0.1
+  images:
+    local_streaming_image: "woojoong/mwc-cdn:local-free"
+  ports:
+    vlc: 8189
+    vlc_np: 31989
+    http: 50002
+    http_np: 30502
+  replicas: 2
+  resources:
+    cpu: 3
+    mem: "1Gi"
diff --git a/mcord/mcord-cdn-remote-free/Chart.yaml b/mcord/mcord-cdn-remote-free/Chart.yaml
new file mode 100644
index 0000000..8825beb
--- /dev/null
+++ b/mcord/mcord-cdn-remote-free/Chart.yaml
@@ -0,0 +1,20 @@
+---
+# 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
+appVersion: "1.0"
+description: A Helm chart for MCORD CDN Services in Remote cloud for free (w/o WOWZA)
+name: mcord-cdn-remote-free
+version: 0.1.1
diff --git a/mcord/mcord-cdn-remote-free/templates/remote-streaming.yaml b/mcord/mcord-cdn-remote-free/templates/remote-streaming.yaml
new file mode 100644
index 0000000..361c07c
--- /dev/null
+++ b/mcord/mcord-cdn-remote-free/templates/remote-streaming.yaml
@@ -0,0 +1,75 @@
+---
+# 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: Service
+metadata:
+  name: remote-streaming
+spec:
+  selector:
+    app: remote-streaming
+  type: NodePort
+  ports:
+  - name: vlc
+    port: {{ .Values.remote_streaming.ports.vlc }}
+    nodePort: {{ .Values.remote_streaming.ports.vlc_np }}
+    protocol: TCP
+  - name: http
+    port: {{ .Values.remote_streaming.ports.http }}
+    nodePort: {{ .Values.remote_streaming.ports.http_np }}
+    protocol: TCP
+
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: remote-streaming
+  labels:
+    name: remote-streaming
+    app: remote-streaming
+spec:
+  replicas: {{ .Values.remote_streaming.replicas }}
+  selector:
+    matchLabels:
+      app: remote-streaming
+  serviceName: "remote-streaming"
+  template:
+    metadata:
+      labels:
+        app: remote-streaming
+        name: remote-streaming
+    spec:
+      #hostNetwork: true
+      terminationGracePeriodSeconds: 1
+      nodeSelector:
+        kubernetes.io/hostname: {{ .Values.node_selector }}
+      containers:
+      - name: streaming
+        image: {{ .Values.remote_streaming.images.remote_streaming_image }}
+        imagePullPolicy: IfNotPresent
+        ports:
+        - containerPort: {{ .Values.remote_streaming.ports.vlc }}
+        - containerPort: {{ .Values.remote_streaming.ports.http }}
+        stdin: true
+        tty: true
+        command: [ "bash",  "-xc"]
+        args:
+        - sed -i 's/geteuid/getppid/' /usr/bin/vlc;
+          ffmpeg -re -i /opt/cdn/movies/{{ .Values.remote_streaming.video_quality }}.mp4 -c copy -f flv rtmp://{{ .Values.remote_streaming.nginx_ip }}:31935/app/r
+        resources:
+          limits:
+            cpu: {{ .Values.remote_streaming.resources.cpu }}
+            memory: {{ .Values.remote_streaming.resources.mem }}
diff --git a/mcord/mcord-cdn-remote-free/values.yaml b/mcord/mcord-cdn-remote-free/values.yaml
new file mode 100644
index 0000000..1d4c6eb
--- /dev/null
+++ b/mcord/mcord-cdn-remote-free/values.yaml
@@ -0,0 +1,33 @@
+---
+# 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.
+
+namespace: remotecdn
+node_selector: node1
+remote_streaming_hostname: "remote-streaming"
+
+remote_streaming:
+  video_quality: 360
+  nginx_ip: 10.90.0.152
+  images:
+    remote_streaming_image: "woojoong/mwc-cdn:remote-free"
+  ports:
+    vlc: 8089
+    vlc_np: 31889
+    http: 50001
+    http_np: 31501
+  replicas: 1
+  resources:
+    cpu: 3
+    mem: "1Gi"