Add Revised Keystone Endpoint Lookup Functions into Helm-Toolkit
This commit adds the revised helm lookup functions from cinder to Helm-Toolkit.
This commit is contained in:
parent
2d4618d944
commit
503ed6cdb8
@ -126,6 +126,29 @@
|
||||
{{- 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:
|
||||
# { tuple "orchestration" "public" "api" . | include "helm-toolkit.endpoint_type_lookup_addr" }
|
||||
# will return the appropriate URI. Once merged this should phase out the above.
|
||||
|
||||
{{- define "helm-toolkit.endpoint_type_lookup_addr" -}}
|
||||
{{- $type := index . 0 -}}
|
||||
{{- $endpoint := index . 1 -}}
|
||||
{{- $port := index . 2 -}}
|
||||
{{- $context := index . 3 -}}
|
||||
{{- $endpointMap := index $context.Values.endpoints $type }}
|
||||
{{- $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 | default "" }}
|
||||
{{- printf "%s://%s.%s:%1.f%s" $endpointScheme $endpointHost $fqdn $endpointPort $endpointPath -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
#-------------------------------
|
||||
# endpoint type lookup
|
||||
@ -145,7 +168,25 @@
|
||||
{{- $endpointType | quote -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
#-------------------------------
|
||||
# endpoint name lookup
|
||||
#-------------------------------
|
||||
|
||||
# this function is used in endpoint management templates
|
||||
# it returns the service type for an openstack service eg:
|
||||
# { tuple orchestration . | include "ks_endpoint_type" }
|
||||
# will return "heat"
|
||||
|
||||
{{- define "helm-toolkit.endpoint_name_lookup" -}}
|
||||
{{- $type := index . 0 -}}
|
||||
{{- $context := index . 1 -}}
|
||||
{{- $endpointMap := index $context.Values.endpoints $type }}
|
||||
{{- $endpointName := index $endpointMap "name" }}
|
||||
{{- $endpointName | quote -}}
|
||||
{{- end -}}
|
||||
|
||||
#-------------------------------
|
||||
# kolla helpers
|
||||
#-------------------------------
|
||||
{{ define "helm-toolkit.keystone_auth" }}{'auth_url':'{{ include "helm-toolkit.endpoint_keystone_internal" . }}', 'username':'{{ .Values.keystone.admin_user }}','password':'{{ .Values.keystone.admin_password }}','project_name':'{{ .Values.keystone.admin_project_name }}','domain_name':'default'}{{end}}
|
||||
{{ define "helm-toolkit.keystone_auth" }}{'auth_url':'{{ tuple "identity" "internal" "api" . | include "helm-toolkit.endpoint_type_lookup_addr" }}', 'username':'{{ .Values.keystone.admin_user }}','password':'{{ .Values.keystone.admin_password }}','project_name':'{{ .Values.keystone.admin_project_name }}','domain_name':'default'}{{end}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user