From 7d788b21afb247b3ba03bdc18f6525b92170443d Mon Sep 17 00:00:00 2001 From: Daniel Fangl Date: Wed, 12 Jun 2024 10:28:53 +0200 Subject: [PATCH] Add option to define a pre-known nodeport range for service ports (#123) --- charts/localstack/templates/service.yaml | 11 +++++++---- charts/localstack/values.yaml | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/charts/localstack/templates/service.yaml b/charts/localstack/templates/service.yaml index 52c2d3a..7407d20 100644 --- a/charts/localstack/templates/service.yaml +++ b/charts/localstack/templates/service.yaml @@ -47,10 +47,13 @@ spec: containerPort: 53 protocol: UDP {{- end }} - {{- range untilStep (.Values.service.externalServicePorts.start|int) (.Values.service.externalServicePorts.end|int) 1 }} - - name: "external-service-port-{{ . }}" - port: {{ . }} - targetPort: "ext-svc-{{ . }}" + {{- 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 }} + nodePort: {{ add $index . }} + {{- end }} {{- end }} selector: {{- include "localstack.selectorLabels" . | nindent 4 }} diff --git a/charts/localstack/values.yaml b/charts/localstack/values.yaml index a06abc6..3451e36 100644 --- a/charts/localstack/values.yaml +++ b/charts/localstack/values.yaml @@ -123,6 +123,9 @@ service: externalServicePorts: start: 4510 end: 4560 + ## @param service.externalServicePorts.nodePortStart specifies the starting node ports the serviceports are mapped to + ## 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 ## dnsService: false