{{- 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 -}}