Helm-Toolkit: Reduce delta between OSH and OSH-Infra

This PS reduces the delta between OSH and OSH-Infra helm toolkits.

Change-Id: I5026b0238555513f8415a864adf4e91e81e3fbd8
This commit is contained in:
portdirect 2018-03-30 16:36:49 -04:00
parent 02d2367fcf
commit 63f883b57c
3 changed files with 24 additions and 2 deletions

View File

@ -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 -}}

View File

@ -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 -}}

View File

@ -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 -}}