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

79 lines
2.4 KiB
YAML

{{- if .Values.serviceDhcp.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "pihole.fullname" . }}-dhcp
labels:
app: {{ template "pihole.name" . }}
chart: {{ template "pihole.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.serviceDhcp.extraLabels }}
{{ toYaml .Values.servicesDhcp.extraLabels | indent 4 }}
{{- end }}
{{- if .Values.serviceDhcp.annotations }}
annotations:
{{ toYaml .Values.serviceDhcp.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.serviceDhcp.type }}
{{- if and (.Values.dualStack.enabled) (not (eq .Values.serviceDhcp.type "LoadBalancer")) }}
ipFamilies:
- IPv4
- IPv6
ipFamilyPolicy: PreferDualStack
{{- end }}
{{- if .Values.serviceDhcp.loadBalancerIP }}
loadBalancerIP: {{ .Values.serviceDhcp.loadBalancerIP }}
{{- end }}
{{- if or (eq .Values.serviceDhcp.type "NodePort") (eq .Values.serviceDhcp.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDhcp.externalTrafficPolicy }}
{{- end }}
ports:
- port: {{ .Values.serviceDhcp.port }}
targetPort: client-udp
{{- if and (.Values.serviceDhcp.nodePort) (eq .Values.serviceDhcp.type "NodePort") }}
nodePort: {{ .Values.serviceDhcp.nodePort }}
{{- end }}
protocol: UDP
name: client-udp
selector:
app: {{ template "pihole.name" . }}
release: {{ .Release.Name }}
---
{{- if and (.Values.dualStack.enabled) (eq .Values.serviceDhcp.type "LoadBalancer") -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "pihole.fullname" . }}-dhcp-ivp6
labels:
app: {{ template "pihole.name" . }}
chart: {{ template "pihole.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.serviceDhcp.annotations }}
annotations:
{{ toYaml .Values.serviceDhcp.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.serviceDhcp.type }}
ipFamilies:
- IPv6
ipFamilyPolicy: SingleStack
{{- if .Values.serviceDhcp.loadBalancerIPv6 }}
loadBalancerIP: {{ .Values.serviceDhcp.loadBalancerIPv6 }}
{{- end }}
{{- if or (eq .Values.serviceDhcp.type "NodePort") (eq .Values.serviceDhcp.type "LoadBalancer") }}
externalTrafficPolicy: {{ .Values.serviceDhcp.externalTrafficPolicy }}
{{- end }}
ports:
- port: 67
targetPort: client-udp
protocol: UDP
name: client-udp
selector:
app: {{ template "pihole.name" . }}
release: {{ .Release.Name }}
{{- end }}
{{- end }}