From eb5ae14dcdd15fb9d09266d165ada065a6ab6cfc Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Fri, 6 Dec 2019 17:48:38 -0600 Subject: [PATCH] HTK: Omit port from uri for http/https when 80/443 used This PS updates htk to omit the port used in the url when this corresponds to the standard ports for the http and https protocols. Change-Id: I46e2237dde99460fd096bd6fe58fe154b220041f Signed-off-by: Pete Birley --- .../templates/endpoints/_keystone_endpoint_uri_lookup.tpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl b/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl index bb8a1e566..5a13b6475 100644 --- a/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl +++ b/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl @@ -16,7 +16,8 @@ limitations under the License. {{/* abstract: | - This function helps resolve uri style endpoints + This function helps resolve uri style endpoints. It will omit the port for + http when 80 is used, and 443 in the case of https. values: | endpoints: cluster_domain_suffix: cluster.local @@ -45,5 +46,9 @@ return: | {{- $endpointHost := tuple $type $endpoint $context | include "helm-toolkit.endpoints.endpoint_host_lookup" }} {{- $endpointPort := tuple $type $endpoint $port $context | include "helm-toolkit.endpoints.endpoint_port_lookup" }} {{- $endpointPath := tuple $type $endpoint $port $context | include "helm-toolkit.endpoints.keystone_endpoint_path_lookup" }} +{{- if or ( and ( eq $endpointScheme "http" ) ( eq $endpointPort "80" ) ) ( and ( eq $endpointScheme "https" ) ( eq $endpointPort "443" ) ) -}} +{{- printf "%s://%s%s" $endpointScheme $endpointHost $endpointPath -}} +{{- else -}} {{- printf "%s://%s:%s%s" $endpointScheme $endpointHost $endpointPort $endpointPath -}} {{- end -}} +{{- end -}}