blob: 49abe46d608f23861eee42897b93a44fa864a237 [file] [log] [blame]
Woojoong Kim7b3d4b12019-02-17 23:45:04 +09001---
2# Copyright 2019-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16---
17apiVersion: v1
18kind: Service
19metadata:
20 labels:
21 name: nginx-rtmp
22 name: nginx-rtmp
23spec:
24 selector:
25 app: nginx-rtmp
26 type: NodePort
27 ports:
28 - name: rtmp
29 port: {{ .Values.nginx.ports.rtmp_orig }}
30 nodePort: {{ .Values.nginx.ports.rtmp_np }}
31 protocol: TCP
32 - name: stream
33 port: {{ .Values.nginx.ports.stream_orig }}
34 nodePort: {{ .Values.nginx.ports.stream_np }}
35 protocol: TCP
36
37---
38apiVersion: apps/v1beta1
39kind: StatefulSet
40metadata:
41 name: nginx-rtmp
42spec:
43 serviceName: nginx-rtmp
44 replicas: {{ .Values.nginx.replicas}}
45 template:
46 metadata:
47 labels:
48 name: nginx-rtmp
49 app: nginx-rtmp
50 annotations:
51 k8s.v1.cni.cncf.io/networks: '[
52 { "name": "sgi-net", "interface": "sgi-net", "namespace": "default" }
53 ]'
54 spec:
55 #hostNetwork: true
56 nodeSelector:
Andy Bavier98bfdee2019-02-18 16:01:56 -070057 kubernetes.io/hostname: {{ .Values.cdn_node_selector }}
Woojoong Kim7b3d4b12019-02-17 23:45:04 +090058 terminationGracePeriodSeconds: 0
59 imagePullSecrets:
60 - name: nexus-docker-secret
61 initContainers:
62 - name: "nginx-rtmp-init"
63 image: {{ .Values.nginx.images.nginx_image }}
64 imagePullPolicy: "IfNotPresent"
65 args:
66 - cp /config/*.sh /shared-vol;cp /conf/* /shared-vol
67 command:
68 - "/bin/bash"
69 - "-c"
70 volumeMounts:
71 - name: "shared-volume"
72 mountPath: "/shared-vol"
73 - name: "nginx-rtmp-config"
74 mountPath: "/config"
75 - name: "nginx-rtmp-conf"
76 mountPath: "/conf"
77 containers:
78 - name: nginx-rtmp
79 image: {{ .Values.nginx.images.nginx_image }}
80 imagePullPolicy: IfNotPresent
81 args:
82 - chmod a+x /config/*.sh;/config/nginx_rtmp_config.sh
83 command:
84 - "/bin/bash"
85 - "-c"
86 tty: true
87 securityContext:
88 privileged: true
89 ports:
90 - containerPort: {{ .Values.nginx.ports.rtmp_orig }}
91 - containerPort: {{ .Values.nginx.ports.stream_orig }}
92 volumeMounts:
93 - name: shared-volume
94 mountPath: /config
95 - name: shared-volume
96 mountPath: /conf
97 resources:
98 limits:
99 intel.com/sriov: '2'
100 - name: streaming
101 image: {{ .Values.local_streaming.images.local_streaming_image }}
102 imagePullPolicy: IfNotPresent
103 ports:
104 - containerPort: {{ .Values.local_streaming.ports.vlc }}
105 - containerPort: {{ .Values.local_streaming.ports.http }}
106 stdin: true
107 tty: true
108 command: [ "bash", "-xc"]
109 args:
110 - sed -i 's/geteuid/getppid/' /usr/bin/vlc;
111 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
112 resources:
113 limits:
114 cpu: {{ .Values.local_streaming.resources.cpu }}
115 memory: {{ .Values.local_streaming.resources.mem }}
116 volumes:
117 - name: nginx-rtmp-config
118 configMap:
119 name: nginx-rtmp-config
120 items:
121 - key: nginx_rtmp_config.sh
122 path: nginx_rtmp_config.sh
123 - name: nginx-rtmp-conf
124 configMap:
125 name: nginx-rtmp-conf
126 items:
127 - key: nginx.conf
128 path: nginx.conf
129 - name: shared-volume
130 emptyDir: {}