From 80e2aa8f14850cda97a377cf5f7143425e4dd6b0 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Tue, 7 Mar 2017 02:11:54 +0000 Subject: [PATCH] Cleanup for Keystone Endpoint Lookup refactor --- helm-toolkit/templates/_endpoints.tpl | 128 -------------------------- 1 file changed, 128 deletions(-) diff --git a/helm-toolkit/templates/_endpoints.tpl b/helm-toolkit/templates/_endpoints.tpl index 6e26c5c9c2..a18225d82e 100644 --- a/helm-toolkit/templates/_endpoints.tpl +++ b/helm-toolkit/templates/_endpoints.tpl @@ -16,115 +16,6 @@ # endpoints #----------------------------------------- -# this should be a generic function leveraging a tuple -# for input, e.g. { endpoint keystone internal . } -# however, constructing this appears to be a -# herculean effort in gotpl - -{{- define "helm-toolkit.endpoint_keystone_internal" -}} -{{- $fqdn := .Release.Namespace -}} -{{- if .Values.endpoints.fqdn -}} -{{- $fqdn := .Values.endpoints.fqdn -}} -{{- end -}} -{{- with .Values.endpoints.keystone -}} - {{.scheme}}://{{.hosts.internal | default .hosts.default}}.{{ $fqdn }}:{{.port.public}}{{.path}} -{{- end -}} -{{- end -}} - -{{- define "helm-toolkit.endpoint_keystone_admin" -}} -{{- $fqdn := .Release.Namespace -}} -{{- if .Values.endpoints.fqdn -}} -{{- $fqdn := .Values.endpoints.fqdn -}} -{{- end -}} -{{- with .Values.endpoints.keystone -}} - {{.scheme}}://{{.hosts.internal | default .hosts.default}}.{{ $fqdn }}:{{.port.admin}}{{.path}} -{{- end -}} -{{- end -}} - -{{- define "helm-toolkit.endpoint_nova_api_internal" -}} -{{- $fqdn := .Release.Namespace -}} -{{- if .Values.endpoints.fqdn -}} -{{- $fqdn := .Values.endpoints.fqdn -}} -{{- end -}} -{{- with .Values.endpoints.nova -}} - {{.scheme}}://{{.hosts.internal | default .hosts.default}}.{{ $fqdn }}:{{.port.api}}{{.path}} -{{- end -}} -{{- end -}} - -{{- define "helm-toolkit.endpoint_nova_metadata_internal" -}} -{{- $fqdn := .Release.Namespace -}} -{{- if .Values.endpoints.fqdn -}} -{{- $fqdn := .Values.endpoints.fqdn -}} -{{- end -}} -{{- with .Values.endpoints.nova -}} - {{.scheme}}://{{.hosts.internal | default .hosts.default}}.{{ $fqdn }}:{{.port.metadata}}{{.path}} -{{- end -}} -{{- end -}} - -{{- define "helm-toolkit.endpoint_nova_novncproxy_internal" -}} -{{- $fqdn := .Release.Namespace -}} -{{- if .Values.endpoints.fqdn -}} -{{- $fqdn := .Values.endpoints.fqdn -}} -{{- end -}} -{{- with .Values.endpoints.nova -}} - {{.scheme}}://{{.hosts.internal | default .hosts.default}}.{{ $fqdn }}:{{.port.novncproxy}}{{.path}} -{{- end -}} -{{- end -}} - -{{- define "helm-toolkit.endpoint_glance_api_internal" -}} -{{- $fqdn := .Release.Namespace -}} -{{- if .Values.endpoints.fqdn -}} -{{- $fqdn := .Values.endpoints.fqdn -}} -{{- end -}} -{{- with .Values.endpoints.glance -}} - {{.scheme}}://{{.hosts.internal | default .hosts.default}}.{{ $fqdn }}:{{.port.api}}{{.path}} -{{- end -}} -{{- end -}} - -{{- define "helm-toolkit.endpoint_glance_registry_internal" -}} -{{- $fqdn := .Release.Namespace -}} -{{- if .Values.endpoints.fqdn -}} -{{- $fqdn := .Values.endpoints.fqdn -}} -{{- end -}} -{{- with .Values.endpoints.glance -}} - {{.scheme}}://{{.hosts.internal | default .hosts.default}}.{{ $fqdn }}:{{.port.registry}}{{.path}} -{{- end -}} -{{- end -}} - -{{- define "helm-toolkit.endpoint_neutron_api_internal" -}} -{{- $fqdn := .Release.Namespace -}} -{{- if .Values.endpoints.fqdn -}} -{{- $fqdn := .Values.endpoints.fqdn -}} -{{- end -}} -{{- with .Values.endpoints.neutron -}} - {{.scheme}}://{{.hosts.internal | default .hosts.default}}.{{ $fqdn }}:{{.port.api}}{{.path}} -{{- end -}} -{{- end -}} - -# this function returns the endpoint uri for a service, it takes an tuple -# input in the form: service-name, endpoint-class, port-name. eg: -# { tuple "heat" "public" "api" . | include "helm-toolkit.endpoint_uri_lookup" } -# will return the appropriate URI. Once merged this should phase out the above. - -{{- define "helm-toolkit.endpoint_uri_lookup" -}} -{{- $name := index . 0 -}} -{{- $endpoint := index . 1 -}} -{{- $port := index . 2 -}} -{{- $context := index . 3 -}} -{{- $nameNorm := $name | replace "-" "_" }} -{{- $endpointMap := index $context.Values.endpoints $nameNorm }} -{{- $fqdn := $context.Release.Namespace -}} -{{- if $context.Values.endpoints.fqdn -}} -{{- $fqdn := $context.Values.endpoints.fqdn -}} -{{- end -}} -{{- with $endpointMap -}} -{{- $endpointScheme := .scheme }} -{{- $endpointHost := index .hosts $endpoint | default .hosts.default}} -{{- $endpointPort := index .port $port }} -{{- $endpointPath := .path }} -{{- printf "%s://%s.%s:%1.f%s" $endpointScheme $endpointHost $fqdn $endpointPort $endpointPath | quote -}} -{{- end -}} -{{- end -}} # this function returns the endpoint uri for a service, it takes an tuple # input in the form: service-type, endpoint-class, port-name. eg: @@ -150,25 +41,6 @@ {{- end -}} {{- end -}} -#------------------------------- -# endpoint type lookup -#------------------------------- - -# this function is used in endpoint management templates -# it returns the service type for an openstack service eg: -# { tuple heat . | include "ks_endpoint_type" } -# will return "orchestration" - -{{- define "helm-toolkit.endpoint_type_lookup" -}} -{{- $name := index . 0 -}} -{{- $context := index . 1 -}} -{{- $nameNorm := $name | replace "-" "_" }} -{{- $endpointMap := index $context.Values.endpoints $nameNorm }} -{{- $endpointType := index $endpointMap "type" }} -{{- $endpointType | quote -}} -{{- end -}} - - #------------------------------- # endpoint name lookup #-------------------------------