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..3fbe20a 100644 --- a/charts/localstack/values.yaml +++ b/charts/localstack/values.yaml @@ -135,8 +135,14 @@ 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: false + dnsService: + enabled: false + ## @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 ## 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 ##