---
kind: ConfigMap
apiVersion: v1
metadata:
  name: helm-live-srs-cm
  namespace: szzsj
  labels:
    app.kubernetes.io/managed-by: Helm
    cmii.app: live-srs
    cmii.type: midware
    helm.sh/chart: cmlc-live-srs-rtc-2.0.0
data:
  srs.rtc.conf: |-
    listen              30935;
    max_connections     4096;
    srs_log_tank        console;
    srs_log_level       info;
    srs_log_file        /home/srs.log;
    daemon              off;
    http_api {
        enabled         on;
        listen          1985;
        crossdomain     on;
    }
    stats {
        network         0;
    }
    http_server {
        enabled         on;
        listen          8080;
        dir             /home/hls;
    }
    srt_server {
        enabled         on;
        listen          30556;
        maxbw           1000000000;
        connect_timeout 4000;
        peerlatency     600;
        recvlatency     600;
    }
    rtc_server {
        enabled         on;
        listen          30090;
        candidate       $CANDIDATE;
    }
    vhost __defaultVhost__ {
        http_hooks {
            enabled       on;
            on_publish    http://helm-live-op-svc-v2:8080/hooks/on_push;
        }
        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      100;
            mw_msgs         10;
        }
        publish {
            firstpkt_timeout    8000;
            normal_timeout      4000;
            mr on;
        }
        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;
            hls_entry_prefix http://10.190.217.227:8888;
        }
    }
---
kind: Service
apiVersion: v1
metadata:
  name: helm-live-srs-svc-exporter
  namespace: szzsj
  labels:
    app.kubernetes.io/managed-by: Helm
spec:
  ports:
    - name: rtmp
      protocol: TCP
      port: 30935
      targetPort: 30935
      nodePort: 30935
    - name: rtc
      protocol: UDP
      port: 30090
      targetPort: 30090
      nodePort: 30090
    - name: srt
      protocol: UDP
      port: 30556
      targetPort: 30556
      nodePort: 30556
    - name: api
      protocol: TCP
      port: 1985
      targetPort: 1985
      nodePort: 30557
  selector:
    srs-role: rtc
  type: NodePort
  sessionAffinity: None
  externalTrafficPolicy: Cluster

---
kind: Service
apiVersion: v1
metadata:
  name: helm-live-srs-svc
  namespace: szzsj
  labels:
    app.kubernetes.io/managed-by: Helm
spec:
  ports:
    - name: http
      protocol: TCP
      port: 8080
      targetPort: 8080
    - name: api
      protocol: TCP
      port: 1985
      targetPort: 1985
  selector:
    srs-role: rtc
  type: ClusterIP
  sessionAffinity: None

---
kind: Service
apiVersion: v1
metadata:
  name: helm-live-srsrtc-svc
  namespace: szzsj
  labels:
    app.kubernetes.io/managed-by: Helm
spec:
  ports:
    - name: rtmp
      protocol: TCP
      port: 30935
      targetPort: 30935
  selector:
    srs-role: rtc
  type: ClusterIP
  sessionAffinity: None

---
kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: helm-live-srs-rtc
  namespace: szzsj
  labels:
    app.kubernetes.io/managed-by: Helm
    cmii.app: live-srs
    cmii.type: midware
    helm.sh/chart: cmlc-live-srs-rtc-2.0.0
    srs-role: rtc
spec:
  replicas: 1
  selector:
    matchLabels:
      srs-role: rtc
  template:
    metadata:
      creationTimestamp: null
      labels:
        srs-role: rtc
    spec:
      volumes:
        - name: srs-conf-file
          configMap:
            name: helm-live-srs-cm
            items:
              - key: srs.rtc.conf
                path: docker.conf
            defaultMode: 420
        - name: srs-vol
          emptyDir:
            sizeLimit: 8Gi
      containers:
        - name: srs-rtc
          image: '172.10.125.92:8033/cmii/srs:v4.0-r3'
          ports:
            - name: srs-rtmp
              containerPort: 30935
              protocol: TCP
            - name: srs-api
              containerPort: 1985
              protocol: TCP
            - name: srs-flv
              containerPort: 8080
              protocol: TCP
            - name: srs-webrtc
              containerPort: 30090
              protocol: UDP
            - name: srs-srt
              containerPort: 30556
              protocol: UDP
          env:
            - name: CANDIDATE
              value: 10.190.217.227
          resources:
            limits:
              cpu: 1200m
              memory: 6Gi
            requests:
              cpu: 100m
              memory: 256Mi
          volumeMounts:
            - name: srs-conf-file
              mountPath: /usr/local/srs/conf/docker.conf
              subPath: docker.conf
            - name: srs-vol
              mountPath: /home/dvr
              subPath: szzsj/helm-live/dvr
            - name: srs-vol
              mountPath: /home/hls
              subPath: szzsj/helm-live/hls
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always
        - name: oss-adaptor
          image: '172.10.125.92:8033/cmii/cmii-srs-oss-adaptor:v4.0.6-arm'
          env:
            - name: OSS_ENDPOINT
              value: 'http://10.190.217.185:9000'
            - name: OSS_AK
              value: cmii
            - name: OSS_SK
              value: 'B#923fC7mk'
            - name: OSS_BUCKET
              value: live-cluster-hls
            - name: SRS_OP
              value: 'http://helm-live-op-svc-v2:8080'
            - name: MYSQL_ENDPOINT
              value: 'helm-mysql:3306'
            - name: MYSQL_USERNAME
              value: k8s_admin
            - name: MYSQL_PASSWORD
              value: fP#UaH6qQ3)8
            - name: MYSQL_DATABASE
              value: cmii_live_srs_op
            - name: MYSQL_TABLE
              value: live_segment
            - name: LOG_LEVEL
              value: info
            - name: OSS_META
              value: 'yes'
          resources:
            limits:
              cpu: 1200m
              memory: 4Gi
            requests:
              cpu: 100m
              memory: 256Mi
          volumeMounts:
            - name: srs-vol
              mountPath: /cmii/share/hls
              subPath: szzsj/helm-live/hls
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      imagePullSecrets:
        - name: harborsecret
      affinity: {}
      schedulerName: default-scheduler
  serviceName: helm-live-srsrtc-svc
  podManagementPolicy: OrderedReady
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      partition: 0
  revisionHistoryLimit: 10
---
# live-srs部分
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: helm-live-op-v2
  namespace: szzsj
  labels:
    app.kubernetes.io/managed-by: Helm
    cmii.app: live-engine
    cmii.type: midware
    helm.sh/chart: cmlc-live-live-op-2.0.0
    live-role: op-v2
spec:
  replicas: 1
  selector:
    matchLabels:
      live-role: op-v2
  template:
    metadata:
      creationTimestamp: null
      labels:
        live-role: op-v2
    spec:
      volumes:
        - name: srs-conf-file
          configMap:
            name: helm-live-op-cm-v2
            items:
              - key: live.op.conf
                path: bootstrap.yaml
            defaultMode: 420
      containers:
        - name: operator
          image: '172.10.125.92:8033/cmii/cmii-live-operator:4.0.6-arm'
          ports:
            - name: operator
              containerPort: 8080
              protocol: TCP
          resources:
            limits:
              cpu: 4800m
              memory: 4Gi
            requests:
              cpu: 100m
              memory: 256Mi
          volumeMounts:
            - name: srs-conf-file
              mountPath: /cmii/bootstrap.yaml
              subPath: bootstrap.yaml
          livenessProbe:
            httpGet:
              path: /cmii/ping
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 60
            timeoutSeconds: 5
            periodSeconds: 20
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /cmii/ping
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 60
            timeoutSeconds: 5
            periodSeconds: 20
            successThreshold: 1
            failureThreshold: 3
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      securityContext: {}
      imagePullSecrets:
        - name: harborsecret
      affinity: {}
      schedulerName: default-scheduler
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  revisionHistoryLimit: 10
  progressDeadlineSeconds: 600
---
kind: Service
apiVersion: v1
metadata:
  name: helm-live-op-svc-v2
  namespace: szzsj
  labels:
    app.kubernetes.io/managed-by: Helm
spec:
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080
      nodePort: 30333
  selector:
    live-role: op-v2
  type: NodePort
  sessionAffinity: None
---
kind: Service
apiVersion: v1
metadata:
  name: helm-live-op-svc
  namespace: szzsj
  labels:
    app.kubernetes.io/managed-by: Helm
spec:
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080
  selector:
    live-role: op
  type: ClusterIP
  sessionAffinity: None
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: helm-live-op-cm-v2
  namespace: szzsj
  labels:
    app.kubernetes.io/managed-by: Helm
    cmii.app: live-engine
    cmii.type: midware
data:
  live.op.conf: |-
    server:
      port: 8080
    spring:
      main:
        allow-bean-definition-overriding: true
        allow-circular-references: true
      application:
        name: cmii-live-operator
      platform:
        info:
          name: cmii-live-operator
          description: cmii-live-operator
          version: 4.0.6
          scanPackage: com.cmii.live.op
      cloud:
        nacos:
          config:
            username: developer
            password: N@cos14Good
            server-addr: helm-nacos:8848
            extension-configs:
              - data-id: cmii-live-operator.yml
                group: 5.2.0
                refresh: true
            shared-configs:
              - data-id: cmii-backend-system.yml
                group: 5.2.0
                refresh: true
          discovery:
            enabled: false

    live:
      engine:
        type: srs
        endpoint:  'http://helm-live-srs-svc:1985'
      proto:
        rtmp: 'rtmp://10.190.217.227:30935'
        rtsp: 'rtsp://10.190.217.227:30554'
        srt: 'srt://10.190.217.227:30556'
        flv: 'http://10.190.217.227:30500'
        hls: 'http://10.190.217.227:30500'
        rtc: 'webrtc://10.190.217.227:30557'
        replay: 'https://10.190.217.227:30333'
      minio:
        endpoint: http://10.190.217.185:9000
        access-key: cmii
        secret-key: B#923fC7mk
        bucket: live-cluster-hls
---




