diff --git a/helm-toolkit/templates/endpoints/_hostname_short_endpoint_lookup.tpl b/helm-toolkit/templates/endpoints/_hostname_short_endpoint_lookup.tpl index cc1fe8af84..6fc17c314e 100644 --- a/helm-toolkit/templates/endpoints/_hostname_short_endpoint_lookup.tpl +++ b/helm-toolkit/templates/endpoints/_hostname_short_endpoint_lookup.tpl @@ -29,7 +29,11 @@ limitations under the License. {{- with $endpointMap -}} {{- $endpointScheme := .scheme }} {{- $endpointHost := index .hosts $endpoint | default .hosts.default}} +{{- if regexMatch "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+" $endpointHost }} +{{- printf "%s" $typeYamlSafe -}} +{{- else }} {{- $endpointHostname := printf "%s" $endpointHost }} {{- printf "%s" $endpointHostname -}} +{{- end }} {{- end -}} {{- end -}} diff --git a/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl b/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl index 25837d1682..8c13651ef7 100644 --- a/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl +++ b/helm-toolkit/templates/endpoints/_keystone_endpoint_uri_lookup.tpl @@ -35,7 +35,11 @@ limitations under the License. {{- $endpointPort := index $endpointPortMAP $endpoint | default (index $endpointPortMAP "default") }} {{- $endpointPath := index .path $endpoint | default .path.default | default "/" }} {{- $endpointClusterHostname := printf "%s.%s.%s" $endpointHost $namespace $clusterSuffix }} -{{- $endpointHostname := index .host_fqdn_override $endpoint | default .host_fqdn_override.default | default $endpointClusterHostname }} -{{- printf "%s://%s:%1.f%s" $endpointScheme $endpointHostname $endpointPort $endpointPath -}} +{{- if regexMatch "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+" $endpointHost }} +{{- printf "%s://%s:%1.f%s" $endpointScheme $endpointHost $endpointPort $endpointPath -}} +{{- else -}} +{{- $endpointFqdnHostname := index .host_fqdn_override $endpoint | default .host_fqdn_override.default | default $endpointClusterHostname }} +{{- printf "%s://%s:%1.f%s" $endpointScheme $endpointFqdnHostname $endpointPort $endpointPath -}} +{{- end -}} {{- end -}} {{- end -}} diff --git a/helm-toolkit/templates/endpoints/_service_name_endpoint_with_namespace_lookup.tpl b/helm-toolkit/templates/endpoints/_service_name_endpoint_with_namespace_lookup.tpl index c4a82a60a9..a3c2f496a3 100644 --- a/helm-toolkit/templates/endpoints/_service_name_endpoint_with_namespace_lookup.tpl +++ b/helm-toolkit/templates/endpoints/_service_name_endpoint_with_namespace_lookup.tpl @@ -18,6 +18,12 @@ limitations under the License. # definition. This is used in kubernetes-entrypoint to support dependencies # between different services in different namespaces. # returns: the endpoint namespace and the service name, delimited by a colon +# +# Normally, the service name is constructed dynamically from the hostname +# however when an ip address is used as the hostname, we default to +# namespace:endpointCategoryName in order to construct a valid service name +# however this can be overriden to a custom service name by defining +# .service.name within the endpoint definition {{- define "helm-toolkit.endpoints.service_name_endpoint_with_namespace_lookup" -}} {{- $type := index . 0 -}} @@ -29,6 +35,14 @@ limitations under the License. {{- $endpointScheme := .scheme }} {{- $endpointName := index .hosts $endpoint | default .hosts.default}} {{- $endpointNamespace := .namespace | default $context.Release.Namespace }} +{{- if regexMatch "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+" $endpointName }} +{{- if .service.name }} +{{- printf "%s:%s" $endpointNamespace .service.name -}} +{{- else -}} +{{- printf "%s:%s" $endpointNamespace $typeYamlSafe -}} +{{- end -}} +{{- else -}} {{- printf "%s:%s" $endpointNamespace $endpointName -}} {{- end -}} {{- end -}} +{{- end -}}