This commit is contained in:
zeaslity
2024-10-30 16:30:51 +08:00
commit 437acbeb63
3363 changed files with 653948 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
{{- define "rtsp.config.zlm" -}}
[api]
apiDebug=1
defaultSnap=./www/logo.png
secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc
snapRoot=./www/snap/
[ffmpeg]
bin=/usr/local/bin/ffmpeg
cmd=%s -i %s -vcodec copy -acodec copy -f flv %s
log=./ffmpeg/ffmpeg.log
snap=%s -i %s -y -f mjpeg -t 0.001 %s
[general]
addMuteAudio=1
enableVhost=0
enable_audio=1
flowThreshold=1024
fmp4_demand=1
hls_demand=0
maxStreamWaitMS=15000
mediaServerId=YAn4fBK6899l3zRG
mergeWriteMS=0
modifyStamp=1
publishToHls=0
publishToMP4=0
resetWhenRePlay=1
rtmp_demand=0
rtsp_demand=0
streamNoneReaderDelayMS=20000
ts_demand=1
[hls]
broadcastRecordTs=0
deleteDelaySec=0
fileBufSize=65536
filePath=./www
segDur=2
segNum=3
segRetain=5
[hook]
admin_params=secret=035c73f7-bb6b-4889-a715-d9eb2d1925cc
enable=1
on_flow_report=
on_http_access=
on_play=
on_publish=http://127.0.0.1:80/index/hook/on_publish
on_record_mp4=
on_record_ts=
on_rtsp_auth=
on_rtsp_realm=
on_server_started=
on_shell_login=
on_stream_changed=
on_stream_none_reader=
on_stream_not_found=
timeoutSec=10
[http]
charSet=utf-8
dirMenu=1
keepAliveSecond=15
maxReqSize=40960
notFound=<html><head><title>404 Not Found</title></head><body><h1>404 Not Found</h1></body></html>
port=80
rootPath=./www
sendBufSize=65536
sslport=443
[multicast]
addrMax=239.255.255.255
addrMin=239.0.0.0
udpTTL=64
[record]
appName=record
fastStart=0
fileBufSize=65536
filePath=./www
fileRepeat=0
fileSecond=3600
sampleMS=500
[rtmp]
handshakeSecond=15
keepAliveSecond=15
modifyStamp=1
port=1935
sslport=19350
[rtp]
audioMtuSize=600
videoMtuSize=1400
[rtp_proxy]
dumpDir=
port={{ .Values.apps.rtsp.ports.rtp }}
timeoutSec=15
[rtsp]
authBasic=0
directProxy=1
handshakeSecond=15
keepAliveSecond=15
port={{ .Values.apps.rtsp.ports.rtsp }}
sslport=332
[shell]
maxReqSize=1024
port=9000
{{- end -}}
{{- define "rtsp.config.op" -}}
zlm:
zlm_ip: 'rtsp-zlm-expose'
zlm_rtsp_port: {{ .Values.apps.rtsp.ports.rtsp }}
zlm_http_port: 80
zlm_secret: '035c73f7-bb6b-4889-a715-d9eb2d1925cc'
srs:
srs_ip: '{{ .Values.deploy.name }}-op-svc'
srs_port: 8080
srs_protocal: 'http'
time_gap: 10
verbose: false
{{- end -}}

View File

@@ -0,0 +1,12 @@
{{- define "rtsp.affinity" -}}
{{- with .Values.deploy.k8s.affinity }}
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: uavcloud.affinity
operator: In
values:
- {{ .node }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,32 @@
{{- define "rtsp.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 }}
{{- end }}
{{- define "rtsp.labels.standard" -}}
cmii.app: live-rtsp
cmii.type: midware
helm.sh/chart: {{ include "rtsp.chart" . }}
app.kubernetes.io/managed-by: {{ $.Release.Service }}
{{- if $.Chart.AppVersion }}
app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
{{- end }}
{{- end -}}
{{- define "rtsp.labels.zlm" -}}
rtsp-role: zlm
{{ include "rtsp.labels.standard" . }}
{{- end -}}
{{- define "rtsp.labels.op" -}}
rtsp-role: op
{{ include "rtsp.labels.standard" . }}
{{- end -}}
{{/*
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "rtsp.matchLabels.zlm" -}}
rtsp-role: zlm
{{- end -}}
{{- define "rtsp.matchLabels.op" -}}
rtsp-role: op
{{- end -}}

View File

@@ -0,0 +1,20 @@
{{- if and .Values.enabled.enabled .Values.enabled.rtsp }}
{{- $namespace := .Release.Namespace -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cmii-rtsp-cm
namespace: {{ $namespace }}
labels:
{{ include "rtsp.labels.standard" . | nindent 4 }}
data:
zlm.conf: |-
{{- include "rtsp.config.zlm" . | nindent 4 }}
op.conf: |-
{{- include "rtsp.config.op" . | nindent 4 }}
{{- end -}}

View File

@@ -0,0 +1,116 @@
{{- if and .Values.enabled.enabled .Values.enabled.rtsp }}
{{- $namespace := .Release.Namespace -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cmii-rtsp-zlm
namespace: {{ $namespace }}
labels:
{{- include "rtsp.labels.zlm" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "rtsp.matchLabels.zlm" . | nindent 6 }}
template:
metadata:
labels:
{{- include "rtsp.labels.zlm" . | nindent 8 }}
annotations:
pod.alpha.kubernetes.io/initialized: "true"
spec:
imagePullSecrets:
- name: {{ .Values.deploy.harbor.secret }}
affinity:
{{- include "rtsp.affinity" . | nindent 8 }}
containers:
- name: operator
image: {{ .Values.apps.rtsp.images.zlm }}
imagePullPolicy: Always
command: ["/opt/media/bin/MediaServer"]
args: ["-s /opt/media/bin/default.pem -c /opt/media/bin/config/config.ini"]
resources:
limits:
memory: 4Gi
cpu: 4800m
requests:
memory: 256Mi
cpu: 100m
ports:
- name: rtsp
containerPort: 554
protocol: TCP
- name: rtp-tcp
containerPort: 10000
protocol: TCP
- name: rtp-udp
containerPort: 10000
protocol: UDP
volumeMounts:
- name: zlm-conf-file
subPath: config.ini
mountPath: /opt/media/bin/config/config.ini
volumes:
- name: zlm-conf-file
configMap:
name: cmii-rtsp-cm
items:
- key: "zlm.conf"
path: "config.ini"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cmii-rtsp-op
namespace: {{ $namespace }}
labels:
{{- include "rtsp.labels.zlm" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "rtsp.matchLabels.op" . | nindent 6 }}
template:
metadata:
labels:
{{- include "rtsp.labels.op" . | nindent 8 }}
annotations:
pod.alpha.kubernetes.io/initialized: "true"
spec:
imagePullSecrets:
- name: {{ .Values.deploy.harbor.secret }}
affinity:
{{- include "rtsp.affinity" . | nindent 8 }}
containers:
- name: operator
image: {{ .Values.apps.rtsp.images.operator }}
imagePullPolicy: Always
command: ["python"]
args: ["rtsp_engine.py"]
resources:
limits:
memory: 4Gi
cpu: 4800m
requests:
memory: 256Mi
cpu: 100m
volumeMounts:
- name: zlm-conf-file
subPath: rtsp_engine_config.yml
mountPath: /workspace/rtsp_engine_config.yml
volumes:
- name: zlm-conf-file
configMap:
name: cmii-rtsp-cm
items:
- key: "op.conf"
path: "rtsp_engine_config.yml"
---
{{- end }}

View File

@@ -0,0 +1,48 @@
{{- if and .Values.enabled.enabled .Values.enabled.rtsp }}
{{- $namespace := .Release.Namespace -}}
---
apiVersion: v1
kind: Service
metadata:
name: rtsp-zlm-expose
namespace: {{ $namespace }}
spec:
type: NodePort
selector:
{{- include "rtsp.matchLabels.zlm" . | nindent 4 }}
ports:
- port: 80
targetPort: 80
name: hook
- port: 554
targetPort: {{ .Values.apps.rtsp.ports.rtsp }}
nodePort: {{ .Values.apps.rtsp.ports.rtsp }}
name: rtsp
- port: 10000
targetPort: {{ .Values.apps.rtsp.ports.rtp }}
nodePort: {{ .Values.apps.rtsp.ports.rtp }}
protocol: UDP
name: rtp-udp
- port: 10000
targetPort: {{ .Values.apps.rtsp.ports.rtp }}
nodePort: {{ .Values.apps.rtsp.ports.rtp }}
protocol: TCP
name: rtp-tcp
---
apiVersion: v1
kind: Service
metadata:
name: rtsp-zlm-inner
namespace: {{ $namespace }}
spec:
type: ClusterIP
selector:
{{- include "rtsp.matchLabels.zlm" . | nindent 4 }}
ports:
- port: 80
targetPort: 80
name: hook
---
{{- end -}}