Files
homelab-gitops/apps/coturn/templates/services.yaml
T

55 lines
1.9 KiB
YAML

{{- range $protocol := list "tcp" "udp" }}
apiVersion: v1
kind: Service
metadata:
name: coturn-{{ $protocol }}
namespace: {{ $.Release.Namespace }}
labels:
app.kubernetes.io/name: coturn
app.kubernetes.io/instance: coturn
annotations:
metallb.io/loadBalancerIPs: {{ $.Values.loadBalancerIP | quote }}
metallb.io/allow-shared-ip: coturn
mikrotik.brunner.ninja/router: newgw
mikrotik.brunner.ninja/forwardings: {{ if eq $protocol "tcp" }}'[{"name":"3478-tcp","servicePort":"tcp","dstAddressList":"WANs"},{"name":"5349-tcp","servicePort":"tcp-tls","dstAddressList":"WANs"}]'{{ else }}'[{"name":"3478-udp","servicePort":"udp","dstAddressList":"WANs"},{"name":"5349-udp","servicePort":"udp-tls","dstAddressList":"WANs"}]'{{ end }}
spec:
type: LoadBalancer
externalTrafficPolicy: Local
selector:
app.kubernetes.io/name: coturn
app.kubernetes.io/instance: coturn
ports:
- name: {{ $protocol }}
port: 3478
targetPort: {{ $protocol }}
protocol: {{ upper $protocol }}
- name: {{ $protocol }}-tls
port: 5349
targetPort: {{ $protocol }}-tls
protocol: {{ upper $protocol }}
---
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: coturn-relay
namespace: {{ .Release.Namespace }}
annotations:
metallb.io/loadBalancerIPs: {{ .Values.loadBalancerIP | quote }}
metallb.io/allow-shared-ip: coturn
mikrotik.brunner.ninja/router: newgw
mikrotik.brunner.ninja/forwardings: '[{"name":"relay-udp","servicePortRange":"{{ .Values.relay.minPort }}-{{ .Values.relay.maxPort }}","dstAddressList":"WANs"}]'
spec:
type: LoadBalancer
externalTrafficPolicy: Local
selector:
app.kubernetes.io/instance: coturn
app.kubernetes.io/name: coturn
ports:
{{- range $port := untilStep (int .Values.relay.minPort) (int (add1 .Values.relay.maxPort)) 1 }}
- name: relay-{{ $port }}
port: {{ $port }}
targetPort: {{ $port }}
protocol: UDP
{{- end }}