{{- if .Values.service.dns.udp.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "powerdns.fullname" . }}-service-dns-udp
  labels:
{{ include "powerdns.labels" . | indent 4 }}
{{- with .Values.service.dns.udp.annotations }}
  annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
  type: {{ .Values.service.dns.udp.type }}
  {{- if .Values.service.dns.udp.loadBalancerIP }}
  loadBalancerIP: {{ .Values.service.dns.udp.loadBalancerIP }}
  {{- end }}
  ports:
    - port: {{ .Values.service.dns.udp.port }}
      targetPort: dns-udp
      protocol: UDP
      name: dns-udp
  selector:
    app.kubernetes.io/name: {{ include "powerdns.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    powerdns.com/role: api
{{- end }}
