Backup option for CDN: try to remove wowza trial version
Change-Id: I130b8592dd67a9c2e6b816e9665e4b83c00598d4
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: {}