Skip to content

Commit fa19558

Browse files
enhance DNS service configuration with TCP/UDP node ports (#146)
Co-authored-by: Mathieu Cloutier <79954947+cloutierMat@users.noreply.github.com>
1 parent 89b852c commit fa19558

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

charts/localstack/templates/service.yaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,35 @@ spec:
3737
{{- if and (or (eq $.Values.service.type "NodePort") (eq $.Values.service.type "LoadBalancer")) (not (empty .Values.service.edgeService.nodePort)) }}
3838
nodePort: {{ .Values.service.edgeService.nodePort }}
3939
{{- end }}
40-
{{- if .Values.service.dnsService }}
40+
{{- $dnsEnabled := false }}
41+
{{- if kindIs "bool" .Values.service.dnsService }}
42+
{{- $dnsEnabled = .Values.service.dnsService }}
43+
{{- else if .Values.service.dnsService.enabled }}
44+
{{- $dnsEnabled = .Values.service.dnsService.enabled }}
45+
{{- end }}
46+
{{- if $dnsEnabled }}
4147
- name: dns-tcp
4248
port: 53
4349
targetPort: 53
4450
protocol: TCP
51+
{{- if and (or (eq $.Values.service.type "NodePort") (eq $.Values.service.type "LoadBalancer")) (kindIs "map" .Values.service.dnsService) (hasKey .Values.service.dnsService "nodePort") }}
52+
nodePort: {{ .Values.service.dnsService.nodePort }}
53+
{{- end }}
4554
- name: dns-udp
4655
port: 53
4756
targetPort: 53
4857
protocol: UDP
58+
{{- if and (or (eq $.Values.service.type "NodePort") (eq $.Values.service.type "LoadBalancer")) (kindIs "map" .Values.service.dnsService) (hasKey .Values.service.dnsService "nodePort") }}
59+
nodePort: {{ .Values.service.dnsService.nodePort }}
60+
{{- end }}
4961
{{- end }}
5062
{{- range $index, $port := untilStep (.Values.service.externalServicePorts.start|int) (.Values.service.externalServicePorts.end|int) 1 }}
5163
- name: "external-service-port-{{ $port }}"
5264
port: {{ $port }}
5365
targetPort: "ext-svc-{{ $port }}"
54-
{{- with $.Values.service.externalServicePorts.nodePortStart|int }}
66+
{{- with $.Values.service.externalServicePorts.nodePortStart|int }}
5567
nodePort: {{ add $index . }}
56-
{{- end }}
68+
{{- end }}
5769
{{- end }}
5870
selector:
5971
{{- include "localstack.selectorLabels" . | nindent 4 }}

charts/localstack/values.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,14 @@ service:
135135
## has to be in the node port range configured. See https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
136136
# nodePortStart: 31510
137137
## @param service.dnsService Enables or disables the exposure of the LocalStack DNS
138+
## see https://docs.localstack.cloud/aws/tooling/dns-server/#system-dns-configuration
139+
## for more information on how to configure LocalStack DNS on your system
138140
##
139-
dnsService: false
141+
dnsService:
142+
enabled: false
143+
## @param service.dnsService.nodePort specifies the nodePort to map the DNS service to
144+
##
145+
nodePort: 31053
140146
## @param service.clusterIP sets a static clusterIP. This is useful alongside the LocalStack DNS setup
141147
## see https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/#configuration-of-stub-domain-and-upstream-nameserver-using-coredns for an example of DNS delegation in Coredns
142148
##

0 commit comments

Comments
 (0)