From 3647f924b755c13b573eec1929b95ef4caedb6ab Mon Sep 17 00:00:00 2001 From: nik-localstack Date: Wed, 29 Oct 2025 11:19:54 +0200 Subject: [PATCH 1/3] enhance DNS service configuration with node ports This change resolves template errors and provides more granular control over DNS service exposure in Kubernetes environments. --- charts/localstack/templates/service.yaml | 18 +++++++++++++++--- charts/localstack/values.yaml | 6 +++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/charts/localstack/templates/service.yaml b/charts/localstack/templates/service.yaml index 2cfb2bf..fddce5a 100644 --- a/charts/localstack/templates/service.yaml +++ b/charts/localstack/templates/service.yaml @@ -37,23 +37,35 @@ spec: {{- if and (or (eq $.Values.service.type "NodePort") (eq $.Values.service.type "LoadBalancer")) (not (empty .Values.service.edgeService.nodePort)) }} nodePort: {{ .Values.service.edgeService.nodePort }} {{- end }} - {{- if .Values.service.dnsService }} + {{- $dnsEnabled := false }} + {{- if kindIs "bool" .Values.service.dnsService }} + {{- $dnsEnabled = .Values.service.dnsService }} + {{- else if .Values.service.dnsService.enabled }} + {{- $dnsEnabled = .Values.service.dnsService.enabled }} + {{- end }} + {{- if $dnsEnabled }} - name: dns-tcp port: 53 targetPort: 53 protocol: TCP + {{- if and (or (eq $.Values.service.type "NodePort") (eq $.Values.service.type "LoadBalancer")) (kindIs "map" .Values.service.dnsService) (hasKey .Values.service.dnsService "nodePort") }} + nodePort: {{ .Values.service.dnsService.nodePort }} + {{- end }} - name: dns-udp port: 53 targetPort: 53 protocol: UDP + {{- if and (or (eq $.Values.service.type "NodePort") (eq $.Values.service.type "LoadBalancer")) (kindIs "map" .Values.service.dnsService) (hasKey .Values.service.dnsService "nodePort") }} + nodePort: {{ .Values.service.dnsService.nodePort }} + {{- end }} {{- end }} {{- range $index, $port := untilStep (.Values.service.externalServicePorts.start|int) (.Values.service.externalServicePorts.end|int) 1 }} - name: "external-service-port-{{ $port }}" port: {{ $port }} targetPort: "ext-svc-{{ $port }}" - {{- with $.Values.service.externalServicePorts.nodePortStart|int }} + {{- with $.Values.service.externalServicePorts.nodePortStart|int }} nodePort: {{ add $index . }} - {{- end }} + {{- end }} {{- end }} selector: {{- include "localstack.selectorLabels" . | nindent 4 }} diff --git a/charts/localstack/values.yaml b/charts/localstack/values.yaml index 61a54ad..3923641 100644 --- a/charts/localstack/values.yaml +++ b/charts/localstack/values.yaml @@ -136,7 +136,11 @@ service: # nodePortStart: 31510 ## @param service.dnsService Enables or disables the exposure of the LocalStack DNS ## - dnsService: false + dnsService: + enabled: false + ## @param service.dnsService.nodePort specifies the nodePort to map theDNS service to + ## + nodePort: 31053 ## @param service.clusterIP sets a static clusterIP. This is useful alongside the LocalStack DNS setup ## 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 ## From e4f654fb233a9dbefe391fd90e5427ae60be417c Mon Sep 17 00:00:00 2001 From: Nikos Date: Wed, 5 Nov 2025 11:13:49 +0200 Subject: [PATCH 2/3] Update charts/localstack/values.yaml Co-authored-by: Mathieu Cloutier <79954947+cloutierMat@users.noreply.github.com> --- charts/localstack/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/localstack/values.yaml b/charts/localstack/values.yaml index 3923641..b317595 100644 --- a/charts/localstack/values.yaml +++ b/charts/localstack/values.yaml @@ -138,7 +138,7 @@ service: ## dnsService: enabled: false - ## @param service.dnsService.nodePort specifies the nodePort to map theDNS service to + ## @param service.dnsService.nodePort specifies the nodePort to map the DNS service to ## nodePort: 31053 ## @param service.clusterIP sets a static clusterIP. This is useful alongside the LocalStack DNS setup From 394d690604cb4a97cb3a7459f57086f3453565bd Mon Sep 17 00:00:00 2001 From: Nikos Date: Wed, 5 Nov 2025 11:14:01 +0200 Subject: [PATCH 3/3] Update charts/localstack/values.yaml Co-authored-by: Mathieu Cloutier <79954947+cloutierMat@users.noreply.github.com> --- charts/localstack/values.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/localstack/values.yaml b/charts/localstack/values.yaml index b317595..3fbe20a 100644 --- a/charts/localstack/values.yaml +++ b/charts/localstack/values.yaml @@ -135,6 +135,8 @@ service: ## has to be in the node port range configured. See https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport # nodePortStart: 31510 ## @param service.dnsService Enables or disables the exposure of the LocalStack DNS + ## see https://docs.localstack.cloud/aws/tooling/dns-server/#system-dns-configuration + ## for more information on how to configure LocalStack DNS on your system ## dnsService: enabled: false