add
This commit is contained in:
24
1-outside-deploy/2-helm-chart/charts/srs-cluster/.helmignore
Normal file
24
1-outside-deploy/2-helm-chart/charts/srs-cluster/.helmignore
Normal file
@@ -0,0 +1,24 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
ci/*
|
||||
12
1-outside-deploy/2-helm-chart/charts/srs-cluster/Chart.yaml
Normal file
12
1-outside-deploy/2-helm-chart/charts/srs-cluster/Chart.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v2
|
||||
name: srs-cluster
|
||||
description: cmlc srs cluster
|
||||
|
||||
type: application
|
||||
version: 2.1.0
|
||||
appVersion: 2.0.0
|
||||
|
||||
keywords:
|
||||
- cmlc
|
||||
- midware
|
||||
- srs
|
||||
@@ -0,0 +1,7 @@
|
||||
# OSS adaptor
|
||||
## build docker images
|
||||
```shell
|
||||
cd ${path}/ci/oss-adaptor
|
||||
docker build -f Dockerfile -t harbor-qa.sre.cdcyy.cn/cmii/cmii-srs-oss-adaptor:v1.0.0 .
|
||||
docker push harbor-qa.sre.cdcyy.cn/cmii/cmii-srs-oss-adaptor:v1.0.0
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v2
|
||||
name: cmlc-live-rtsp
|
||||
description: rtsp server powered by zlm
|
||||
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: 1.0.0
|
||||
|
||||
keywords:
|
||||
- cmlc
|
||||
- midware
|
||||
- rtsp
|
||||
|
||||
maintainers:
|
||||
- email: zhoujinfu@cmii.chinamobile.com
|
||||
name: zhoujinfu
|
||||
@@ -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 -}}
|
||||
@@ -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 }}
|
||||
@@ -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 -}}
|
||||
@@ -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 -}}
|
||||
@@ -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 }}
|
||||
@@ -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 -}}
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
enabled:
|
||||
enabled: false # 总开关,控制srs是否开启
|
||||
webrtc: true # 开启默认的web rtc模式
|
||||
cluster: false # 是否开启集群模式,集群模式下 webrtc低时延功能不可用
|
||||
nginx: false
|
||||
hook: true # 默认需要开启,鉴权模式
|
||||
ingress: false
|
||||
rtsp: false # rtsp业务,默认不部署
|
||||
|
||||
|
||||
deploy:
|
||||
name: helm-srs
|
||||
harbor:
|
||||
secret: harborsecret
|
||||
k8s:
|
||||
affinity:
|
||||
node: common
|
||||
ingress:
|
||||
domain: ig-dev.uavcmlc.com
|
||||
|
||||
apps:
|
||||
rtsp:
|
||||
enable: false
|
||||
images:
|
||||
operator: "harbor-qa.sre.cdcyy.cn/cmii/cmii-rtsp-operator:v1.0.0"
|
||||
zlm: "harbor-qa.sre.cdcyy.cn/cmii/zlm-mediaserver:v1.0.6"
|
||||
ports:
|
||||
rtsp: 30554
|
||||
rtp: 30556
|
||||
@@ -0,0 +1,4 @@
|
||||
- Make sure exported ports and origin nodes are corresponding to which defined in configuration files.
|
||||
- 1 origin + 3edge cluster may work for 300 input and 3000 output concurrence.
|
||||
- Api services are inconsistent between multiple origin in one cluster.
|
||||
- srsog, srsrtc is the headless svc for get pod's ip which were created by stateful set.
|
||||
@@ -0,0 +1,208 @@
|
||||
{{- define "srs.config.apilist" -}}
|
||||
{{- range $i, $e := int .Values.apps.srs.replicas.origin | until }} {{ $.Values.deploy.name }}-og-{{ $i }}.{{ $.Values.apps.srs.service.headless.og }}:{{ $.Values.apps.srs.ports.api }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "srs.config.rtmplist" -}}
|
||||
{{- range $i, $e := int .Values.apps.srs.replicas.origin | until }} {{ $.Values.deploy.name }}-og-{{ $i }}.{{ $.Values.apps.srs.service.headless.og }}:{{ $.Values.apps.srs.ports.rtmp }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "srs.config.hooks" -}}
|
||||
{{ if .Values.enabled.hook }}
|
||||
http_hooks {
|
||||
enabled on;
|
||||
on_publish http://{{ $.Values.deploy.name }}-op-svc:8080/hooks/on_publish;
|
||||
}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "srs.config.origin" -}}
|
||||
listen {{ .Values.apps.srs.ports.rtmp }};
|
||||
max_connections 4096;
|
||||
srs_log_tank console;
|
||||
srs_log_file /home/srs.log;
|
||||
daemon off;
|
||||
http_api {
|
||||
enabled on;
|
||||
listen {{ .Values.apps.srs.ports.api }};
|
||||
crossdomain on;
|
||||
raw_api {
|
||||
enabled on;
|
||||
allow_reload on;
|
||||
allow_query on;
|
||||
allow_update on;
|
||||
}
|
||||
}
|
||||
http_server {
|
||||
enabled on;
|
||||
listen {{ .Values.apps.srs.ports.flv }};
|
||||
dir /home/hls;
|
||||
}
|
||||
stats {
|
||||
network 0;
|
||||
}
|
||||
{{- if lt .Values.apps.srs.replicas.origin 2.0 }}
|
||||
rtc_server {
|
||||
enabled on;
|
||||
listen {{ .Values.apps.srs.ports.rtc }};
|
||||
candidate $CANDIDATE;
|
||||
}
|
||||
{{- end }}
|
||||
vhost __defaultVhost__ {
|
||||
cluster {
|
||||
origin_cluster on;
|
||||
coworkers {{ include "srs.config.apilist" . }};
|
||||
}
|
||||
http_hooks {
|
||||
enabled off;
|
||||
}
|
||||
{{- if lt .Values.apps.srs.replicas.origin 2.0 }}
|
||||
rtc {
|
||||
enabled on;
|
||||
rtmp_to_rtc on;
|
||||
rtc_to_rtmp on;
|
||||
keep_bframe off;
|
||||
}
|
||||
{{- end }}
|
||||
tcp_nodelay on;
|
||||
min_latency on;
|
||||
play {
|
||||
gop_cache off;
|
||||
mw_latency 0;
|
||||
mw_msgs 0;
|
||||
}
|
||||
publish {
|
||||
firstpkt_timeout 4000;
|
||||
normal_timeout 2000;
|
||||
mr off;
|
||||
}
|
||||
dvr {
|
||||
enabled off;
|
||||
dvr_path /home/dvr/[app]/[stream]/[2006][01]/[timestamp].mp4;
|
||||
dvr_plan session;
|
||||
}
|
||||
hls {
|
||||
enabled on;
|
||||
hls_path /home/hls;
|
||||
hls_fragment 10;
|
||||
hls_window 60;
|
||||
hls_m3u8_file [app]/[stream].m3u8;
|
||||
hls_ts_file [app]/[stream]/[2006][01][02]/[timestamp]-[duration].ts;
|
||||
hls_cleanup on;
|
||||
}
|
||||
}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "srs.config.edge" -}}
|
||||
listen {{ .Values.apps.srs.ports.rtmp }};
|
||||
max_connections 4096;
|
||||
srs_log_tank file;
|
||||
srs_log_file /home/srs.log;
|
||||
daemon on;
|
||||
http_api {
|
||||
enabled on;
|
||||
listen {{ .Values.apps.srs.ports.api }};
|
||||
crossdomain on;
|
||||
raw_api {
|
||||
enabled on;
|
||||
allow_reload on;
|
||||
allow_query on;
|
||||
allow_update on;
|
||||
}
|
||||
}
|
||||
http_server {
|
||||
enabled on;
|
||||
listen {{ .Values.apps.srs.ports.flv }};
|
||||
dir /home/hls;
|
||||
}
|
||||
stats {
|
||||
network 0;
|
||||
}
|
||||
vhost __defaultVhost__ {
|
||||
cluster {
|
||||
mode remote;
|
||||
origin {{ include "srs.config.rtmplist" . }};
|
||||
}
|
||||
{{- include "srs.config.hooks" . }}
|
||||
http_remux {
|
||||
enabled on;
|
||||
}
|
||||
tcp_nodelay on;
|
||||
min_latency on;
|
||||
play {
|
||||
gop_cache off;
|
||||
mw_latency 0;
|
||||
mw_msgs 0;
|
||||
}
|
||||
publish {
|
||||
firstpkt_timeout 4000;
|
||||
normal_timeout 2000;
|
||||
mr off;
|
||||
}
|
||||
}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "srs.config.rtc" -}}
|
||||
listen {{ .Values.apps.srs.ports.rtmp }};
|
||||
max_connections 4096;
|
||||
srs_log_tank console;
|
||||
srs_log_file /home/srs.log;
|
||||
daemon off;
|
||||
http_api {
|
||||
enabled on;
|
||||
listen {{ .Values.apps.srs.ports.api }};
|
||||
crossdomain on;
|
||||
}
|
||||
stats {
|
||||
network 0;
|
||||
}
|
||||
http_server {
|
||||
enabled on;
|
||||
listen {{ .Values.apps.srs.ports.flv }};
|
||||
dir /home/hls;
|
||||
}
|
||||
rtc_server {
|
||||
enabled on;
|
||||
listen {{ .Values.apps.srs.ports.rtc }};
|
||||
candidate $CANDIDATE;
|
||||
}
|
||||
vhost __defaultVhost__ {
|
||||
{{- include "srs.config.hooks" . }}
|
||||
http_remux {
|
||||
enabled on;
|
||||
}
|
||||
rtc {
|
||||
enabled on;
|
||||
rtmp_to_rtc on;
|
||||
rtc_to_rtmp on;
|
||||
keep_bframe off;
|
||||
}
|
||||
tcp_nodelay on;
|
||||
min_latency on;
|
||||
play {
|
||||
gop_cache off;
|
||||
mw_latency 0;
|
||||
mw_msgs 0;
|
||||
}
|
||||
publish {
|
||||
firstpkt_timeout 4000;
|
||||
normal_timeout 2000;
|
||||
mr off;
|
||||
}
|
||||
dvr {
|
||||
enabled off;
|
||||
dvr_path /home/dvr/[app]/[stream]/[2006][01]/[timestamp].mp4;
|
||||
dvr_plan session;
|
||||
}
|
||||
hls {
|
||||
enabled on;
|
||||
hls_path /home/hls;
|
||||
hls_fragment 10;
|
||||
hls_window 60;
|
||||
hls_m3u8_file [app]/[stream].m3u8;
|
||||
hls_ts_file [app]/[stream]/[2006][01][02]/[timestamp]-[duration].ts;
|
||||
hls_cleanup on;
|
||||
}
|
||||
}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,22 @@
|
||||
{{- define "srs.affinity" -}} {{/* 废弃, 不适用此部分 */}}
|
||||
{{- with .Values.deploy.k8s.affinity }}
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: uavcloud.affinity
|
||||
operator: In
|
||||
values:
|
||||
- {{ .node }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "srs.vol.main" -}}
|
||||
{{- if eq .Values.apps.srs.storage.class "emptyDir" }}
|
||||
emptyDir:
|
||||
sizeLimit: {{ .Values.apps.srs.storage.size }}
|
||||
{{- else if eq .Values.apps.srs.storage.class "gfs" }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Values.apps.srs.storage.pvc }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,58 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{- define "srs.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "srs.labels.standard" -}}
|
||||
cmii.app: video-live-srs
|
||||
cmii.type: middleware
|
||||
helm.sh/chart: {{ include "srs.chart" . }}
|
||||
app.kubernetes.io/managed-by: {{ $.Release.Service }}
|
||||
{{- if $.Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "srs.labels.origin" -}}
|
||||
srs-role: origin
|
||||
{{ include "srs.labels.standard" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "srs.labels.edge" -}}
|
||||
srs-role: edge
|
||||
{{ include "srs.labels.standard" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "srs.labels.nginx" -}}
|
||||
srs-role: nginx
|
||||
{{ include "srs.labels.standard" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "srs.labels.webrtc" -}}
|
||||
srs-role: webrtc
|
||||
{{ include "srs.labels.standard" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "srs.labels.op" -}}
|
||||
srs-role: op
|
||||
{{ include "srs.labels.standard" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector
|
||||
*/}}
|
||||
{{- define "srs.matchLabels.origin" -}}
|
||||
srs-role: origin
|
||||
{{- end -}}
|
||||
{{- define "srs.matchLabels.edge" -}}
|
||||
srs-role: edge
|
||||
{{- end -}}
|
||||
{{- define "srs.matchLabels.nginx" -}}
|
||||
srs-role: nginx
|
||||
{{- end -}}
|
||||
{{- define "srs.matchLabels.webrtc" -}}
|
||||
srs-role: webrtc
|
||||
{{- end -}}
|
||||
{{- define "srs.matchLabels.op" -}}
|
||||
srs-role: op
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,114 @@
|
||||
{{- if .Values.enabled.enabled }}
|
||||
{{- $namespace := .Release.Namespace -}}
|
||||
{{- $deployName := .Values.deploy.name -}}
|
||||
{{- $domain := ternary (first (regexSplit ":" .Values.global.domain.DeployDomainName -1)) ( .Values.global.domain.DeployDomainName ) (contains ":" .Values.global.domain.DeployDomainName) -}}
|
||||
{{- $httpPort := ternary (last (regexSplit ":" .Values.global.domain.DeployDomainName -1)) ( 80 ) (contains ":" .Values.global.domain.DeployDomainName) -}}
|
||||
{{- $rtmpPort := .Values.apps.srs.ports.rtmp }}
|
||||
{{- $scheme := .Values.global.ingress.tls_enabled | ternary "https" "http" }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ $deployName }}-cm
|
||||
namespace: {{ $namespace }}
|
||||
labels:
|
||||
{{ include "srs.labels.standard" . | nindent 4 }}
|
||||
data:
|
||||
{{- if .Values.enabled.cluster }}
|
||||
srs.origin.conf: |-
|
||||
{{- include "srs.config.origin" . | nindent 4 }}
|
||||
|
||||
srs.edge.conf: |-
|
||||
{{- include "srs.config.edge" . | nindent 4 }}
|
||||
|
||||
{{- else }}
|
||||
srs.rtc.conf: |-
|
||||
{{- include "srs.config.rtc" . | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.enabled.nginx }}
|
||||
srs.nginx.conf: "empty"
|
||||
{{- end }}
|
||||
|
||||
srs.op.conf: |-
|
||||
debug: false
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: cmii-srs-operator
|
||||
platform:
|
||||
info:
|
||||
name: cmii-live-srs-operator
|
||||
description: cmii-live-srs-operator
|
||||
version: 1.2.0
|
||||
scanPackage: com.cmii.live
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
url: jdbc:mysql://{{ .Values.apps.mysql.endpoint }}/cmii_live_srs_op?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: {{ .Values.apps.mysql.username }}
|
||||
password: {{ .Values.apps.mysql.password }}
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
enabled: false
|
||||
url: http://127.0.0.1:8888
|
||||
instance:
|
||||
service-url: http://127.0.0.1:8080
|
||||
|
||||
druid:
|
||||
mysql:
|
||||
usePingMethod: false
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
enabled-by-default: true
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
|
||||
live:
|
||||
srs:
|
||||
rtmp-base: "rtmp://{{ $domain }}:{{ $rtmpPort }}"
|
||||
rtsp-base: "rtsp://{{ $domain }}:{{ .Values.apps.rtsp.ports.rtsp }}"
|
||||
srt-base: "srt://{{ $domain }}:23333"
|
||||
flv-base: "{{ $scheme }}://{{ $domain }}:{{ $httpPort }}"
|
||||
rtc-base: "webrtc://{{ $domain }}:{{ $httpPort }}"
|
||||
{{- if .Values.enabled.cluster }}
|
||||
api-base: "http://{{ $deployName }}-origin-svc:{{ .Values.apps.srs.ports.api }}"
|
||||
{{- else }}
|
||||
api-base: "http://{{ $deployName }}-rtc-svc:{{ .Values.apps.srs.ports.api }}"
|
||||
{{- end }}
|
||||
hls:
|
||||
max-ts: 200
|
||||
interval-ms: 6000
|
||||
minio:
|
||||
endpoint: {{ .Values.apps.srs.oss.endpoint }}
|
||||
access-key: {{ .Values.apps.srs.oss.ak }}
|
||||
secret-key: {{ .Values.apps.srs.oss.sk }}
|
||||
bucket: {{ .Values.apps.srs.oss.bucket }}
|
||||
sync:
|
||||
onStart: false
|
||||
pool:
|
||||
core: 8
|
||||
max: 12
|
||||
queue: 0
|
||||
keepalive: 20
|
||||
interval:
|
||||
sync: 150
|
||||
elect: 8
|
||||
keepalive: 20
|
||||
heartbeat: 8
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.cmii.live.srs.mapper: info
|
||||
|
||||
---
|
||||
{{- end}}
|
||||
@@ -0,0 +1,61 @@
|
||||
{{- /*
|
||||
{{- if .Values.enabled.cluster }}
|
||||
{{- $namespace := .Release.Namespace -}}
|
||||
{{- $applicationName := .Values.deploy.name -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $applicationName }}-eg
|
||||
namespace: {{ $namespace }}
|
||||
labels:
|
||||
{{- include "srs.labels.edge" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.apps.srs.replicas.edge }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "srs.matchLabels.edge" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "srs.labels.edge" . | nindent 8 }}
|
||||
annotations:
|
||||
pod.alpha.kubernetes.io/initialized: "true"
|
||||
spec:
|
||||
affinity:
|
||||
{{- include "srs.affinity" . | nindent 8 }}
|
||||
containers:
|
||||
- name: srs
|
||||
image: {{ .Values.apps.srs.image.srs.name }}:{{ .Values.apps.srs.image.srs.tag }}
|
||||
resources:
|
||||
limits:
|
||||
memory: 4Gi
|
||||
cpu: 1200m
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 100m
|
||||
ports:
|
||||
- name: srs-rtmp
|
||||
containerPort: {{ .Values.apps.srs.ports.rtmp }}
|
||||
protocol: TCP
|
||||
- name: srs-api
|
||||
containerPort: {{ .Values.apps.srs.ports.api }}
|
||||
protocol: TCP
|
||||
- name: srs-flv
|
||||
containerPort: {{ .Values.apps.srs.ports.flv }}
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- name: srs-conf-file
|
||||
mountPath: /usr/local/srs/conf/docker.conf
|
||||
subPath: docker.conf
|
||||
volumes:
|
||||
- name: srs-conf-file
|
||||
configMap:
|
||||
name: {{ $applicationName }}-cm
|
||||
items:
|
||||
- key: "srs.edge.conf"
|
||||
path: "docker.conf"
|
||||
|
||||
---
|
||||
|
||||
{{- end -}}*/}}
|
||||
@@ -0,0 +1,98 @@
|
||||
{{- /*
|
||||
{{- if .Values.enabled.ingress }}
|
||||
{{- $namespace := .Release.Namespace -}}
|
||||
{{- $applicationName := .Values.deploy.name -}}
|
||||
{{- $domain := ternary (first (regexSplit ":" .Values.global.domain.DeployDomainName -1)) ( .Values.global.domain.DeployDomainName ) (contains ":" .Values.global.domain.DeployDomainName) -}}
|
||||
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $applicationName }}-ingress
|
||||
namespace: {{ $namespace }}
|
||||
labels:
|
||||
{{- include "srs.labels.standard" . | nindent 4 }}
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
nginx.ingress.kubernetes.io/enable-cors: "true"
|
||||
nginx.ingress.kubernetes.io/configuration-snippet: |
|
||||
if ($request_uri ~* ^/console){
|
||||
return 403;
|
||||
}
|
||||
|
||||
spec:
|
||||
{{- if .Values.deploy.k8s.ingress.tls.enabled }}
|
||||
tls:
|
||||
- hosts:
|
||||
- live.{{ $domain }}
|
||||
- live-op.{{ $domain }}
|
||||
- live-api.{{ $domain }}
|
||||
{{- if .Values.enabled.nginx }}
|
||||
- live-hls.{{ $domain }}
|
||||
{{- end }}
|
||||
secretName: x.{{ $domain }}-tls
|
||||
{{- end }}
|
||||
|
||||
rules:
|
||||
- host: live.{{ $domain }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
{{- if .Values.enabled.cluster }}
|
||||
serviceName: {{ $applicationName }}-edge-svc
|
||||
{{- else }}
|
||||
serviceName: {{ $applicationName }}-rtc-svc
|
||||
{{- end }}
|
||||
servicePort: {{ .Values.apps.srs.ports.flv }}
|
||||
|
||||
- path: /rtc/v1
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
{{- if .Values.enabled.cluster }}
|
||||
serviceName: {{ $applicationName }}-origin-svc
|
||||
{{- else }}
|
||||
serviceName: {{ $applicationName }}-rtc-svc
|
||||
{{- end }}
|
||||
servicePort: {{ .Values.apps.srs.ports.api }}
|
||||
|
||||
- host: live-op.{{ $domain }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
serviceName: {{ $applicationName }}-op-svc
|
||||
servicePort: 8080
|
||||
|
||||
- host: live-api.{{ $domain }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
{{- if .Values.enabled.cluster }}
|
||||
serviceName: {{ $applicationName }}-origin-svc
|
||||
{{- else }}
|
||||
serviceName: {{ $applicationName }}-rtc-svc
|
||||
{{- end }}
|
||||
servicePort: {{ .Values.apps.srs.ports.api }}
|
||||
|
||||
{{- if .Values.enabled.nginx }}
|
||||
- host: live-hls.{{ $domain }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
{{- if .Values.enabled.cluster }}
|
||||
serviceName: {{ .Values.apps.srs.service.headless.og }}
|
||||
{{- else }}
|
||||
serviceName: {{ .Values.apps.srs.service.headless.rtc }}
|
||||
{{- end }}
|
||||
servicePort: {{ .Values.apps.srs.ports.flv }}
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
{{- end }}*/}}
|
||||
@@ -0,0 +1,54 @@
|
||||
{{- if .Values.enabled.enabled }}
|
||||
{{- $namespace := .Release.Namespace -}}
|
||||
{{- $applicationName := .Values.deploy.name -}}
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $applicationName }}-op
|
||||
namespace: {{ $namespace }}
|
||||
labels:
|
||||
{{- include "srs.labels.op" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.apps.srs.replicas.op }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "srs.matchLabels.op" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "srs.labels.op" . | nindent 8 }}
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.deploy.harbor.secret }}
|
||||
affinity:
|
||||
{}
|
||||
containers:
|
||||
- name: operator
|
||||
image: "{{ .Values.global.image.repository }}/{{ .Values.apps.srs.image.op }}"
|
||||
imagePullPolicy: Always
|
||||
resources:
|
||||
limits:
|
||||
memory: 4Gi
|
||||
cpu: 4800m
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 100m
|
||||
ports:
|
||||
- name: operator
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
volumeMounts:
|
||||
- name: srs-conf-file
|
||||
mountPath: /cmii/application.yaml
|
||||
subPath: application.yaml
|
||||
volumes:
|
||||
- name: srs-conf-file
|
||||
configMap:
|
||||
name: "{{ $applicationName }}-cm"
|
||||
items:
|
||||
- key: "srs.op.conf"
|
||||
path: "application.yaml"
|
||||
---
|
||||
{{- end }}
|
||||
@@ -0,0 +1,109 @@
|
||||
{{- if and .Values.enabled.enabled .Values.enabled.cluster }}
|
||||
{{- $namespace := .Release.Namespace -}}
|
||||
{{- $applicationName := .Values.deploy.name -}}
|
||||
{{- $domain := ternary (first (regexSplit ":" .Values.global.domain.DeployDomainName -1)) ( .Values.global.domain.DeployDomainName ) (contains ":" .Values.global.domain.DeployDomainName) -}}
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ $applicationName }}-og
|
||||
namespace: {{ $namespace }}
|
||||
labels:
|
||||
{{- include "srs.labels.origin" . | nindent 4 }}
|
||||
spec:
|
||||
serviceName: srsog
|
||||
replicas: {{ .Values.apps.srs.replicas.origin }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "srs.matchLabels.origin" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "srs.labels.origin" . | nindent 8 }}
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.deploy.harbor.secret }}
|
||||
{{- /* affinity:*/}}
|
||||
{{- /* {{- include "srs.affinity" . | nindent 8 }}*/}}
|
||||
containers:
|
||||
- name: srs
|
||||
image: {{ .Values.apps.srs.image.srs }}
|
||||
resources:
|
||||
limits:
|
||||
memory: 4Gi
|
||||
cpu: 1200m
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 100m
|
||||
ports:
|
||||
- containerPort: {{ .Values.apps.srs.ports.rtmp }}
|
||||
name: srs-rtmp
|
||||
protocol: TCP
|
||||
- containerPort: {{ .Values.apps.srs.ports.api }}
|
||||
name: srs-api
|
||||
protocol: TCP
|
||||
{{- if lt .Values.apps.srs.replicas.origin 2.0 }}
|
||||
- containerPort: {{ .Values.apps.srs.ports.rtc }}
|
||||
name: srs-webrtc
|
||||
protocol: UDP
|
||||
{{- end }}
|
||||
env:
|
||||
- name: CANDIDATE
|
||||
value: {{ $domain }}
|
||||
volumeMounts:
|
||||
- name: srs-conf-file
|
||||
mountPath: /usr/local/srs/conf/docker.conf
|
||||
subPath: docker.conf
|
||||
- name: srs-vol
|
||||
mountPath: /home/dvr
|
||||
subPath: {{ $namespace }}/{{ $applicationName }}/dvr
|
||||
- name: srs-vol
|
||||
mountPath: /home/hls
|
||||
subPath: {{ $namespace }}/{{ $applicationName }}/hls
|
||||
|
||||
- name: oss-adaptor
|
||||
{{/* image: {{ .Values.apps.srs.image.oss }}*/}}
|
||||
image: "{{ .Values.global.image.repository }}/{{ .Values.apps.srs.image.oss }}"
|
||||
imagePullPolicy: Always
|
||||
resources:
|
||||
limits:
|
||||
memory: 4Gi
|
||||
cpu: 1200m
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 100m
|
||||
env:
|
||||
- name: OSS_ENDPOINT
|
||||
value: {{ .Values.apps.srs.oss.endpoint }}
|
||||
- name: OSS_AK
|
||||
value: {{ .Values.apps.srs.oss.ak }}
|
||||
- name: OSS_SK
|
||||
value: {{ .Values.apps.srs.oss.sk }}
|
||||
- name: OSS_BUCKET
|
||||
value: {{ .Values.apps.srs.oss.bucket }}
|
||||
- name: SRS_OP
|
||||
value: "http://{{ $applicationName }}-op-svc:8080"
|
||||
- name: MYSQL_ENDPOINT
|
||||
value: {{ .Values.apps.mysql.endpoint }}
|
||||
- name: MYSQL_USERNAME
|
||||
value: {{ .Values.apps.mysql.username }}
|
||||
- name: MYSQL_PASSWORD
|
||||
value: {{ .Values.apps.mysql.password }}
|
||||
volumeMounts:
|
||||
- name: srs-vol
|
||||
mountPath: /cmii/share/hls
|
||||
subPath: "{{ $namespace }}/{{ $applicationName }}/hls"
|
||||
|
||||
volumes:
|
||||
- name: srs-conf-file
|
||||
configMap:
|
||||
name: "{{ $applicationName }}-cm"
|
||||
items:
|
||||
- key: "srs.origin.conf"
|
||||
path: "docker.conf"
|
||||
- name: srs-vol
|
||||
{{- include "srs.vol.main" . | nindent 10 }}
|
||||
|
||||
---
|
||||
{{- end }}
|
||||
@@ -0,0 +1,151 @@
|
||||
{{- if .Values.enabled.enabled }}
|
||||
{{- $namespace := .Release.Namespace -}}
|
||||
{{- $applicationName := .Values.deploy.name -}}
|
||||
|
||||
{{- if and .Values.enabled.cluster ( not .Values.enabled.webrtc )}}
|
||||
{{- /*
|
||||
开启集群模式的情况
|
||||
*/}}
|
||||
---
|
||||
{{/*
|
||||
srsog: used to get srs-og stateful-set's ip.
|
||||
*/}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.apps.srs.service.headless.og }}
|
||||
namespace: {{ $namespace }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
selector:
|
||||
{{- include "srs.matchLabels.origin" . | nindent 4 }}
|
||||
ports:
|
||||
- name: srsog-rtmp
|
||||
port: {{ .Values.apps.srs.ports.rtmp }}
|
||||
targetPort: {{ .Values.apps.srs.ports.rtmp }}
|
||||
- name: srsog-hls
|
||||
port: {{ .Values.apps.srs.ports.flv }}
|
||||
targetPort: {{ .Values.apps.srs.ports.flv }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $applicationName }}-origin-svc
|
||||
namespace: {{ $namespace }}
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
{{- include "srs.matchLabels.origin" . | nindent 4 }}
|
||||
ports:
|
||||
- name: srsog-api
|
||||
port: {{ .Values.apps.srs.ports.api }}
|
||||
targetPort: {{ .Values.apps.srs.ports.api }}
|
||||
nodePort: {{ .Values.apps.srs.ports.api }}
|
||||
{{- if lt .Values.apps.srs.replicas.origin 2.0 }}
|
||||
- name: srsog-rtc
|
||||
port: {{ .Values.apps.srs.ports.rtc }}
|
||||
targetPort: {{ .Values.apps.srs.ports.rtc }}
|
||||
nodePort: {{ .Values.apps.srs.ports.rtc }}
|
||||
protocol: UDP
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $applicationName }}-edge-svc
|
||||
namespace: {{ $namespace }}
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
{{- include "srs.matchLabels.edge" . | nindent 4 }}
|
||||
ports:
|
||||
- name: srseg-rtmp
|
||||
port: {{ .Values.apps.srs.ports.rtmp }}
|
||||
targetPort: {{ .Values.apps.srs.ports.rtmp }}
|
||||
nodePort: {{ .Values.apps.srs.ports.rtmp }}
|
||||
- name: srseg-flv
|
||||
port: {{ .Values.apps.srs.ports.flv }}
|
||||
targetPort: {{ .Values.apps.srs.ports.flv }}
|
||||
nodePort: {{ .Values.apps.srs.ports.flv }}
|
||||
|
||||
{{- end }}
|
||||
---
|
||||
{{- if and .Values.enabled.webrtc (not .Values.enabled.cluster) }}
|
||||
{{- /*
|
||||
默认的模式! web-rtc
|
||||
*/}}
|
||||
---
|
||||
{{/*
|
||||
srsrtc: used to get srs-rtc stateful-set's ip.
|
||||
*/}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.apps.srs.service.headless.rtc }}
|
||||
namespace: {{ $namespace }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
selector:
|
||||
{{- include "srs.matchLabels.webrtc" . | nindent 4 }}
|
||||
ports:
|
||||
- name: srsrtc-rtmp
|
||||
port: {{ .Values.apps.srs.ports.rtmp }}
|
||||
targetPort: {{ .Values.apps.srs.ports.rtmp }}
|
||||
- name: srsrtc-hls
|
||||
port: {{ .Values.apps.srs.ports.flv }}
|
||||
targetPort: {{ .Values.apps.srs.ports.flv }}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $applicationName }}-rtc-svc
|
||||
namespace: {{ $namespace }}
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
{{- include "srs.matchLabels.webrtc" . | nindent 4 }}
|
||||
ports:
|
||||
- name: srs-rtmp
|
||||
port: {{ .Values.apps.srs.ports.rtmp }}
|
||||
targetPort: {{ .Values.apps.srs.ports.rtmp }}
|
||||
nodePort: {{ .Values.apps.srs.ports.rtmp }}
|
||||
- name: srs-api
|
||||
port: {{ .Values.apps.srs.ports.api }}
|
||||
targetPort: {{ .Values.apps.srs.ports.api }}
|
||||
nodePort: {{ .Values.apps.srs.ports.api }}
|
||||
- name: srs-rtc
|
||||
port: {{ .Values.apps.srs.ports.rtc }}
|
||||
targetPort: {{ .Values.apps.srs.ports.rtc }}
|
||||
nodePort: {{ .Values.apps.srs.ports.rtc }}
|
||||
protocol: UDP
|
||||
- name: srs-flv
|
||||
port: {{ .Values.apps.srs.ports.flv }}
|
||||
targetPort: {{ .Values.apps.srs.ports.flv }}
|
||||
nodePort: {{ .Values.apps.srs.ports.flv }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $applicationName }}-op-svc
|
||||
namespace: {{ $namespace }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
{{- include "srs.matchLabels.op" . | nindent 4 }}
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
|
||||
---
|
||||
{{- end }}
|
||||
@@ -0,0 +1,105 @@
|
||||
{{- if and .Values.enabled.enabled .Values.enabled.webrtc }}
|
||||
{{- $namespace := .Release.Namespace -}}
|
||||
{{- $applicationName := .Values.deploy.name -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ $applicationName }}-rtc
|
||||
namespace: {{ $namespace }}
|
||||
labels:
|
||||
{{- include "srs.labels.webrtc" . | nindent 4 }}
|
||||
spec:
|
||||
serviceName: srsrtc
|
||||
replicas: {{ .Values.apps.srs.replicas.rtc }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "srs.matchLabels.webrtc" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "srs.labels.webrtc" . | nindent 8 }}
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: {{ .Values.deploy.harbor.secret }}
|
||||
affinity:
|
||||
{{- /* nodeAffinity: {{- include "common.affinities.nodes" (dict "type" $.Values.global.nodeAffinityPreset.type "key" $.Values.global.nodeAffinityPreset.key "values" $.Values.global.nodeAffinityPreset.values) | nindent 10 -}}*/}}
|
||||
containers:
|
||||
- name: {{ $applicationName }}
|
||||
image: "{{ .Values.global.image.repository }}/{{ .Values.apps.srs.image.srs }}"
|
||||
resources:
|
||||
limits:
|
||||
memory: 4Gi
|
||||
cpu: 1200m
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 100m
|
||||
ports:
|
||||
- name: srs-rtmp
|
||||
containerPort: {{ .Values.apps.srs.ports.rtmp }}
|
||||
protocol: TCP
|
||||
- name: srs-api
|
||||
containerPort: {{ .Values.apps.srs.ports.api }}
|
||||
protocol: TCP
|
||||
- name: srs-flv
|
||||
containerPort: {{ .Values.apps.srs.ports.flv }}
|
||||
protocol: TCP
|
||||
- name: srs-webrtc
|
||||
containerPort: {{ .Values.apps.srs.ports.rtc }}
|
||||
protocol: UDP
|
||||
env:
|
||||
- name: CANDIDATE
|
||||
value: "{{ .Values.deploy.domain }}"
|
||||
volumeMounts:
|
||||
- name: srs-conf-file
|
||||
mountPath: /usr/local/srs/conf/docker.conf
|
||||
subPath: docker.conf
|
||||
- name: srs-vol
|
||||
mountPath: /home/dvr
|
||||
subPath: "{{ $namespace }}/{{ $applicationName }}/dvr"
|
||||
- name: srs-vol
|
||||
mountPath: /home/hls
|
||||
subPath: "{{ $namespace }}/{{ $applicationName }}/hls"
|
||||
- name: oss-adaptor
|
||||
image: "{{ .Values.global.image.repository }}/{{ .Values.apps.srs.image.oss }}"
|
||||
imagePullPolicy: Always
|
||||
resources:
|
||||
limits:
|
||||
memory: 4Gi
|
||||
cpu: 1200m
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 100m
|
||||
env:
|
||||
- name: OSS_ENDPOINT
|
||||
value: {{ .Values.apps.srs.oss.endpoint }}
|
||||
- name: OSS_AK
|
||||
value: {{ .Values.apps.srs.oss.ak }}
|
||||
- name: OSS_SK
|
||||
value: {{ .Values.apps.srs.oss.sk }}
|
||||
- name: OSS_BUCKET
|
||||
value: {{ .Values.apps.srs.oss.bucket }}
|
||||
- name: SRS_OP
|
||||
value: "http://{{ $applicationName }}-op-svc:8080"
|
||||
- name: MYSQL_ENDPOINT
|
||||
value: {{ .Values.apps.mysql.endpoint }}
|
||||
- name: MYSQL_USERNAME
|
||||
value: {{ .Values.apps.mysql.username }}
|
||||
- name: MYSQL_PASSWORD
|
||||
value: {{ .Values.apps.mysql.password }}
|
||||
volumeMounts:
|
||||
- name: srs-vol
|
||||
mountPath: /cmii/share/hls
|
||||
subPath: {{ $namespace }}/{{ $applicationName }}/hls
|
||||
volumes:
|
||||
- name: srs-conf-file
|
||||
configMap:
|
||||
name: "{{ $applicationName }}-cm"
|
||||
items:
|
||||
- key: "srs.rtc.conf"
|
||||
path: "docker.conf"
|
||||
- name: srs-vol
|
||||
{{- include "srs.vol.main" . | nindent 10 }}
|
||||
|
||||
---
|
||||
{{- end }}
|
||||
107
1-outside-deploy/2-helm-chart/charts/srs-cluster/values.yaml
Normal file
107
1-outside-deploy/2-helm-chart/charts/srs-cluster/values.yaml
Normal file
@@ -0,0 +1,107 @@
|
||||
global:
|
||||
# override all applications
|
||||
image:
|
||||
repository: harbor.cdcyy.com.cn/cmii # override all applications image repository
|
||||
tag: "3.2.1" # override all applications' image tag/version
|
||||
pullPolicy: Always # override all applications' image pullPolicy
|
||||
domain:
|
||||
TenantEnvironment: "demo" # which will affect the chosen of frontend AppClientId, and the swagger url of backend Application.
|
||||
# if just PublicIP:Port is actually deployed, a fake domain and ingress-nginx http port should be assigned
|
||||
DeployDomainName: "www.demo.uavcmlc.com:18000"
|
||||
IsPrivateDeployment: true # 是否是私有化部署
|
||||
ingress:
|
||||
# tls should be placed in frontend dedicated nginx, this can be enabled in exactly situation
|
||||
# please don't modify this unless you know what exactly you are doing
|
||||
tls_enabled: false
|
||||
middlewareService:
|
||||
type: ClusterIP
|
||||
appServiceType:
|
||||
backend: ClusterIP
|
||||
frontend: ClusterIP
|
||||
pvc:
|
||||
storageClass: heketi-glusterfs-distribute
|
||||
affinity: {} # don't modify this unless you know the whole application of affinity
|
||||
nodeAffinityPreset: # just modify this for nodeAffinity
|
||||
type: hard
|
||||
key: uavcloud.env
|
||||
values:
|
||||
- "demo"
|
||||
|
||||
enabled:
|
||||
enabled: false # 总开关,控制srs是否开启
|
||||
webrtc: true # 开启默认的web rtc模式
|
||||
cluster: false # 是否开启集群模式,集群模式下 webrtc低时延功能不可用
|
||||
nginx: false
|
||||
hook: true # 默认需要开启,鉴权模式
|
||||
ingress: false
|
||||
rtsp: false # rtsp业务,默认不部署
|
||||
|
||||
deploy:
|
||||
name: helm-srs
|
||||
harbor:
|
||||
secret: harborsecret
|
||||
ingress:
|
||||
domain: ig-dev.uavcmlc.com
|
||||
port: 31500
|
||||
tls:
|
||||
enabled: true
|
||||
|
||||
apps:
|
||||
mysql:
|
||||
endpoint: helm-mysql:3306
|
||||
username: k8s_admin
|
||||
password: fP#UaH6qQ3)8
|
||||
srs:
|
||||
image:
|
||||
srs: "ossrs/srs:v4.0-b9"
|
||||
oss: "cmii-srs-oss-adaptor:v1.0.0-no-retention"
|
||||
op: "cmii-srs-operator:v1.0.0"
|
||||
nginx: "nginx:1.21.3"
|
||||
replicas: # 集群模式才有用处
|
||||
origin: 1
|
||||
edge: 3
|
||||
nginx: 2
|
||||
rtc: 1 # 默认单实例,双实例无效!
|
||||
op: 1
|
||||
oss:
|
||||
endpoint: https://oss.dev.uavcmlc.com # 需要和minio部署的公网地址保持一致
|
||||
ak: ossuser
|
||||
sk: TgGiAHxF.r@Q6
|
||||
bucket: srs-hls
|
||||
ports:
|
||||
rtmp: 30935
|
||||
rtc: 30090
|
||||
api: 30985
|
||||
flv: 30080
|
||||
hls: 30088
|
||||
storage:
|
||||
pvc: glusterfs-middleware-srs-pvc
|
||||
size: 10Gi # 大小待议
|
||||
class: emptyDir # 不需要修改此部分
|
||||
service: # service-headless 的名称
|
||||
headless:
|
||||
og: srs-og
|
||||
rtc: srs-rtc
|
||||
rtsp: # 对外部署大概率不使用,无需修改!
|
||||
ports:
|
||||
rtsp: 30554
|
||||
|
||||
cmlc-live-rtsp:
|
||||
apps:
|
||||
rtsp:
|
||||
enable: false # 从这里控制开关!--废弃
|
||||
ports:
|
||||
rtsp: 30554
|
||||
rtp: 30556
|
||||
|
||||
deploy:
|
||||
name: helm-srs
|
||||
harbor:
|
||||
secret: harborsecret
|
||||
k8s:
|
||||
affinity:
|
||||
node: common
|
||||
ingress:
|
||||
domain: ig-dev.uavcmlc.com
|
||||
|
||||
|
||||
Reference in New Issue
Block a user