apiVersion: v1 kind: Service metadata: name: {{ template "unifi.fullname" . }}-stun labels: app: {{ template "unifi.name" . }} chart: {{ template "unifi.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} {{- if .Values.stunService.labels }} {{ toYaml .Values.stunService.labels | indent 4 }} {{- end }} {{- with .Values.stunService.annotations }} annotations: {{ toYaml . | indent 4 }} {{- end }} spec: {{- if (or (eq .Values.stunService.type "ClusterIP") (empty .Values.stunService.type)) }} type: ClusterIP {{- if .Values.stunService.clusterIP }} clusterIP: {{ .Values.stunService.clusterIP }} {{end}} {{- else if eq .Values.stunService.type "LoadBalancer" }} type: {{ .Values.stunService.type }} {{- if .Values.stunService.loadBalancerIP }} loadBalancerIP: {{ .Values.stunService.loadBalancerIP }} {{- end }} {{- if .Values.stunService.loadBalancerSourceRanges }} loadBalancerSourceRanges: {{ toYaml .Values.stunService.loadBalancerSourceRanges | indent 4 }} {{- end -}} {{- else }} type: {{ .Values.stunService.type }} {{- end }} {{- if .Values.stunService.externalIPs }} externalIPs: {{ toYaml .Values.stunService.externalIPs | indent 4 }} {{- end }} {{- if .Values.stunService.externalTrafficPolicy }} externalTrafficPolicy: {{ .Values.stunService.externalTrafficPolicy }} {{- end }} ports: - port: {{ .Values.stunService.port }} targetPort: stun protocol: UDP name: stun {{ if (and (eq .Values.stunService.type "NodePort") (not (empty .Values.stunService.nodePort))) }} nodePort: {{.Values.stunService.nodePort}} {{ end }} selector: app: {{ template "unifi.name" . }} release: {{ .Release.Name }}