blob: ea08f039620e3a83dc4957797287ccb2b4584020 [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---
Matteo Scandolo5628d4b2021-01-11 11:46:12 -080038apiVersion: apps/v1
Woojoong Kim7b3d4b12019-02-17 23:45:04 +090039kind: StatefulSet
40metadata:
41 name: nginx-rtmp
42spec:
43 serviceName: nginx-rtmp
44 replicas: {{ .Values.nginx.replicas}}
Matteo Scandolo5628d4b2021-01-11 11:46:12 -080045 selector:
46 matchLabels:
47 name: nginx-rtmp
48 release: {{ .Release.Name }}
Woojoong Kim7b3d4b12019-02-17 23:45:04 +090049 template:
50 metadata:
51 labels:
52 name: nginx-rtmp
53 app: nginx-rtmp
54 annotations:
55 k8s.v1.cni.cncf.io/networks: '[
56 { "name": "sgi-net", "interface": "sgi-net", "namespace": "default" }
57 ]'
58 spec:
59 #hostNetwork: true
60 nodeSelector:
Andy Bavier98bfdee2019-02-18 16:01:56 -070061 kubernetes.io/hostname: {{ .Values.cdn_node_selector }}
Woojoong Kim7b3d4b12019-02-17 23:45:04 +090062 terminationGracePeriodSeconds: 0
63 imagePullSecrets:
64 - name: nexus-docker-secret
65 initContainers:
66 - name: "nginx-rtmp-init"
67 image: {{ .Values.nginx.images.nginx_image }}
68 imagePullPolicy: "IfNotPresent"
69 args:
70 - cp /config/*.sh /shared-vol;cp /conf/* /shared-vol
71 command:
72 - "/bin/bash"
73 - "-c"
74 volumeMounts:
75 - name: "shared-volume"
76 mountPath: "/shared-vol"
77 - name: "nginx-rtmp-config"
78 mountPath: "/config"
79 - name: "nginx-rtmp-conf"
80 mountPath: "/conf"
81 containers:
82 - name: nginx-rtmp
83 image: {{ .Values.nginx.images.nginx_image }}
84 imagePullPolicy: IfNotPresent
85 args:
86 - chmod a+x /config/*.sh;/config/nginx_rtmp_config.sh
87 command:
88 - "/bin/bash"
89 - "-c"
90 tty: true
91 securityContext:
92 privileged: true
93 ports:
94 - containerPort: {{ .Values.nginx.ports.rtmp_orig }}
95 - containerPort: {{ .Values.nginx.ports.stream_orig }}
96 volumeMounts:
97 - name: shared-volume
98 mountPath: /config
99 - name: shared-volume
100 mountPath: /conf
101 resources:
102 limits:
103 intel.com/sriov: '2'
104 - name: streaming
105 image: {{ .Values.local_streaming.images.local_streaming_image }}
106 imagePullPolicy: IfNotPresent
107 ports:
108 - containerPort: {{ .Values.local_streaming.ports.vlc }}
109 - containerPort: {{ .Values.local_streaming.ports.http }}
110 stdin: true
111 tty: true
112 command: [ "bash", "-xc"]
113 args:
114 - sed -i 's/geteuid/getppid/' /usr/bin/vlc;
115 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
116 resources:
117 limits:
118 cpu: {{ .Values.local_streaming.resources.cpu }}
119 memory: {{ .Values.local_streaming.resources.mem }}
120 volumes:
121 - name: nginx-rtmp-config
122 configMap:
123 name: nginx-rtmp-config
124 items:
125 - key: nginx_rtmp_config.sh
126 path: nginx_rtmp_config.sh
127 - name: nginx-rtmp-conf
128 configMap:
129 name: nginx-rtmp-conf
130 items:
131 - key: nginx.conf
132 path: nginx.conf
133 - name: shared-volume
134 emptyDir: {}