From 0a2291b2872028a6ef7b5e9e4cd0c07f4b40f793 Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Tue, 9 Feb 2021 14:59:21 +0100 Subject: [GENERAL] Allow different port for svc and pod Instead of having the exact same port number for service and container, let's allow to use an internal port (usually > 1024) and a service port (usually 80 or 443). Issue-ID: OOM-2674 Signed-off-by: Sylvain Desbureaux Change-Id: Ib90073fc8b069fceed7666778ae0c7b8a8ffcdca --- kubernetes/common/common/templates/_pod.tpl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'kubernetes/common') diff --git a/kubernetes/common/common/templates/_pod.tpl b/kubernetes/common/common/templates/_pod.tpl index de2548562d..b38a7f1105 100644 --- a/kubernetes/common/common/templates/_pod.tpl +++ b/kubernetes/common/common/templates/_pod.tpl @@ -36,13 +36,13 @@ {{- $global := . }} {{- range $index, $port := $ports }} {{- if (include "common.needTLS" $global) }} -- containerPort: {{ $port.port }} +- containerPort: {{ default $port.port $port.internal_port }} {{- else }} -- containerPort: {{ default $port.port $port.plain_port }} +- containerPort: {{ default (default $port.port $port.internal_port) (default $port.plain_port $port.internal_plain_port) }} {{- end }} name: {{ $port.name }} {{- if (and $port.plain_port (and (include "common.needTLS" $global) $both_tls_and_plain)) }} -- containerPort: {{ $port.plain_port }} +- containerPort: {{ default $port.plain_port $port.internal_plain_port }} name: {{ $port.name }}-plain {{- end }} {{- end }} @@ -67,4 +67,3 @@ securityContext: privileged: false allowPrivilegeEscalation: false {{- end }} - -- cgit 1.2.3-korg