maabara/manifests/pihole/templates/service-dns.yaml

98 lines
3.0 KiB
YAML

{{- if .Values.serviceDns.mixedService }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "pihole.fullname" . }}-dns
labels:
app: {{ template "pihole.name" . }}
app.kubernetes.io/name: {{ template "pihole.name" . }}
chart: {{ template "pihole.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.serviceDns.extraLabels }}
{{ toYaml .Values.serviceDns.extraLabels | indent 4 }}
{{- end }}
{{- if .Values.serviceDns.annotations }}
annotations:
{{ toYaml .Values.serviceDns.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.serviceDns.type }}
{{- if .Values.serviceDns.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIP }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
ports:
- port: {{ .Values.serviceDns.port }}
targetPort: dns
{{- if .Values.serviceDns.nodePort }}
nodePort: {{ .Values.serviceDns.nodePort }}
{{- end }}
protocol: TCP
name: dns
- port: {{ .Values.serviceDns.port }}
targetPort: dns-udp
{{- if and (.Values.serviceDns.nodePort) (eq .Values.serviceDns.type "NodePort") }}
nodePort: {{ .Values.serviceDns.nodePort }}
{{- end }}
protocol: UDP
name: dns-udp
{{- if .Values.monitoring.sidecar.enabled }}
- port: {{ .Values.monitoring.sidecar.port }}
targetPort: prometheus
protocol: TCP
name: prometheus
{{- end }}
selector:
app: {{ template "pihole.name" . }}
release: {{ .Release.Name }}
---
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceDns.type "LoadBalancer") -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "pihole.fullname" . }}-dns-ipv6
labels:
app: {{ template "pihole.name" . }}
app.kubernetes.io/name: {{ template "pihole.name" . }}
chart: {{ template "pihole.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.serviceDns.annotations }}
annotations:
{{ toYaml .Values.serviceDns.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.serviceDns.type }}
ipFamilies:
- IPv6
ipFamilyPolicy: SingleStack
{{- if .Values.serviceDns.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceDns.loadBalancerIPv6 }}
{{- end }}
{{- if or (eq .Values.serviceDns.type "NodePort") (eq .Values.serviceDns.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDns.externalTrafficPolicy }}
{{- end }}
ports:
- port: {{ .Values.serviceDns.port }}
targetPort: dns
protocol: TCP
name: dns
- port: {{ .Values.serviceDns.port }}
targetPort: dns-udp
protocol: UDP
name: dns-udp
{{- if .Values.monitoring.sidecar.enabled }}
- port: {{ .Values.monitoring.sidecar.port }}
targetPort: prometheus
protocol: TCP
name: prometheus
{{- end }}
selector:
app: {{ template "pihole.name" . }}
release: {{ .Release.Name }}
{{- end }}
{{- end }}