Support services in different namespaces
Pass the service namespace to kubernetes-entrypoint in order to support dependencies between namespaces. Add documentation about endpoint/service namespaces. Change-Id: I208c3240e9f2c8900323595f7b0e488bef5cb1fc Implements: blueprint entrypoint-namespaces
This commit is contained in:
parent
4399e39a9c
commit
538e630774
@ -98,3 +98,8 @@ Charts should not use hard coded values such as
|
||||
``http://keystone-api:5000`` because these are not compatible with
|
||||
operator overrides and do not support spreading components out over
|
||||
various namespaces.
|
||||
|
||||
By default, each endpoint is located in the same namespace as the current
|
||||
service's helm chart. To connect to a service which is running in a different
|
||||
kubernetes namespace, a ``namespace`` can be provided to each individual
|
||||
endpoint.
|
||||
|
@ -0,0 +1,34 @@
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
# This function returns endpoint "<namespace>:<name>" pair from an endpoint
|
||||
# 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
|
||||
|
||||
{{- define "helm-toolkit.endpoints.service_name_endpoint_with_namespace_lookup" -}}
|
||||
{{- $type := index . 0 -}}
|
||||
{{- $endpoint := index . 1 -}}
|
||||
{{- $context := index . 2 -}}
|
||||
{{- $typeYamlSafe := $type | replace "-" "_" }}
|
||||
{{- $endpointMap := index $context.Values.endpoints $typeYamlSafe }}
|
||||
{{- with $endpointMap -}}
|
||||
{{- $endpointScheme := .scheme }}
|
||||
{{- $endpointName := index .hosts $endpoint | default .hosts.default}}
|
||||
{{- $endpointNamespace := .namespace | default $context.Release.Namespace }}
|
||||
{{- printf "%s:%s" $endpointNamespace $endpointName -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@ -35,7 +35,7 @@ limitations under the License.
|
||||
- name: INTERFACE_NAME
|
||||
value: eth0
|
||||
- name: DEPENDENCY_SERVICE
|
||||
value: "{{ tuple $deps.services $envAll | include "helm-toolkit.utils.comma_joined_hostname_list" }}"
|
||||
value: "{{ tuple $deps.services $envAll | include "helm-toolkit.utils.comma_joined_service_list" }}"
|
||||
- name: DEPENDENCY_JOBS
|
||||
value: "{{ include "helm-toolkit.utils.joinListWithComma" $deps.jobs }}"
|
||||
- name: DEPENDENCY_DAEMONSET
|
||||
|
@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
{{- define "helm-toolkit.utils.comma_joined_hostname_list" -}}
|
||||
{{- define "helm-toolkit.utils.comma_joined_service_list" -}}
|
||||
{{- $deps := index . 0 -}}
|
||||
{{- $envAll := index . 1 -}}
|
||||
{{- range $k, $v := $deps -}}{{- if $k -}},{{- end -}}{{ tuple $v.service $v.endpoint $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}{{- end -}}
|
||||
{{- range $k, $v := $deps -}}{{- if $k -}},{{- end -}}{{ tuple $v.service $v.endpoint $envAll | include "helm-toolkit.endpoints.service_name_endpoint_with_namespace_lookup" }}{{- end -}}
|
||||
{{- end -}}
|
Loading…
Reference in New Issue
Block a user