diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-02-24 13:52:02 +0100 |
---|---|---|
committer | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-02-24 13:57:17 +0100 |
commit | 2f73a0f0d840c2361be68d6eae9084c6737018a4 (patch) | |
tree | 625006d8952db64dfd2e3080c1b98cbed7bbd6d8 /kubernetes | |
parent | b94753a9c2c511f6f531b9e29ac44f27ecbfada2 (diff) |
[COMMON] Allow to choose between nodePortPrefix and nodePortPrefixExt
Add the ability to specify whether a nodePortPrefix or
nodePortPrefixExt should be used while defining a port using common
service template.
Now you can specify:
ports:
- name: http
port: 9098
nodePort: "09"
prefix: nodePortPrefixExt
Issue-ID: OOM-1971
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Change-Id: Ied78584e5b1c8f479ca180890df67ad4dee3501a
Diffstat (limited to 'kubernetes')
-rw-r--r-- | kubernetes/common/common/templates/_service.tpl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kubernetes/common/common/templates/_service.tpl b/kubernetes/common/common/templates/_service.tpl index 075f7965b9..55f73c1635 100644 --- a/kubernetes/common/common/templates/_service.tpl +++ b/kubernetes/common/common/templates/_service.tpl @@ -56,15 +56,18 @@ labels: {{- include "common.labels" $dot | nindent 2 -}} - .dot : environment (.) - .ports : an array of ports - .portType: the type of the service + - .prefix: NodePort prefix to be used + */}} {{- define "common.servicePorts" -}} {{- $portType := .portType -}} {{- $dot := .dot -}} {{- range $index, $port := .ports }} +{{- $portPrefix := default "nodePortPrefix" $port.prefix }} - port: {{ $port.port }} targetPort: {{ $port.name }} {{- if (eq $portType "NodePort") }} - nodePort: {{ $dot.Values.global.nodePortPrefix | default $dot.Values.nodePortPrefix }}{{ $port.nodePort }} + nodePort: {{ index $dot.Values "global" $portPrefix | default (index $dot.Values $portPrefix) }}{{ $port.nodePort }} {{- end }} name: {{ $port.name }} {{- end -}} |