blob: ea08f039620e3a83dc4957797287ccb2b4584020 [file] [log] [blame]
---
# 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/v1
kind: StatefulSet
metadata:
name: nginx-rtmp
spec:
serviceName: nginx-rtmp
replicas: {{ .Values.nginx.replicas}}
selector:
matchLabels:
name: nginx-rtmp
release: {{ .Release.Name }}
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.cdn_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: {}