diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-04-20 19:43:23 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-20 19:43:23 +0000 |
commit | e5dd0a0d3686271379a909be94d4fb9615f60649 (patch) | |
tree | 8a30f8a9bd5f582d79650e4e0e240d8543f82565 /kubernetes/common | |
parent | 8a4a2669d8e74b5b4e792ede6124c3a3dc84e7d9 (diff) | |
parent | f7768e895c64ff7234e38c35d557dbede2e49988 (diff) |
Merge "[DMaaP DR Node] v1.16+ compatible templates"
Diffstat (limited to 'kubernetes/common')
-rw-r--r-- | kubernetes/common/common/templates/_service.tpl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/kubernetes/common/common/templates/_service.tpl b/kubernetes/common/common/templates/_service.tpl index 15c1f6fbb1..3d745ed819 100644 --- a/kubernetes/common/common/templates/_service.tpl +++ b/kubernetes/common/common/templates/_service.tpl @@ -302,3 +302,33 @@ true {{- end }} {{- end }} {{- end -}} + +{{- define "common.port.buildCache" -}} + {{- $global := . }} + {{- if not $global.Values._DmaapDrNodePortsCache }} + {{- $portCache := dict }} + {{- range $port := .Values.service.ports }} + {{- $_ := set $portCache $port.name (dict "port" $port.port "plain_port" $port.plain_port) }} + {{- end }} + {{- $_ := set $global.Values "_DmaapDrNodePortsCache" $portCache }} + {{- end }} +{{- end -}} + +{/* + Get Port value according to its name and if we want tls or plain port. + The template takes below arguments: + - .global: environment (.) + - .name: name of the port + - .getPlain: boolean allowing to choose between tls (false, default) or + plain (true) + If plain_port is not set and we ask for plain, it will return empty. +*/} +{{- define "common.getPort" -}} + {{- $global := .global }} + {{- $name := .name }} + {{- $getPlain := default false .getPlain }} + {{- include "common.port.buildCache" $global }} + {{- $portCache := $global.Values._DmaapDrNodePortsCache }} + {{- $port := index $portCache $name }} + {{- ternary $port.plain_port $port.port $getPlain }} +{{- end -}} |