Kubernetes Entrypoint: Lookup service names for dependency checks

The existing entrypoint logic used static names to reolve dependencies.
This prevented the service names, and thus the hostnames of services
being altered. This PS resolves that issue by looking up the service name
from the endpoints specified in the values for a chart.

Partial-Implements: blueprint enhance-entrypoint-dependency-checking
External-Tracking-Id: OSH-21
Change-Id: Ib49490f332f8cd88e98c50d9335dfd314a170936
This commit is contained in:
Pete Birley 2017-06-20 00:22:49 -05:00
parent 349da76076
commit a7503a7d3f
19 changed files with 427 additions and 227 deletions

View File

@ -63,32 +63,39 @@ keystone:
dependencies:
db_init:
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
db_sync:
jobs:
- barbican-db-init
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
ks_user:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_service:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_endpoints:
jobs:
- barbican-ks-service
service:
- keystone-api
services:
- service: identity
endpoint: internal
api:
jobs:
- barbican-db-sync
- barbican-ks-user
- barbican-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
conf:
paste:
@ -171,7 +178,7 @@ endpoints:
amqp: 5672
oslo_cache:
hosts:
default: memcache
default: memcached
port:
memcache: 11211

View File

@ -153,60 +153,75 @@ conf:
dependencies:
db_init:
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
db_sync:
jobs:
- cinder-db-init
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
ks_user:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_service:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_endpoints:
jobs:
- cinder-ks-service
service:
- keystone-api
services:
- service: identity
endpoint: internal
api:
jobs:
- cinder-db-sync
- cinder-ks-user
- cinder-ks-endpoints
service:
- mariadb
- keystone-api
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
bootstrap:
service:
- keystone-api
- cinder-api
services:
- service: identity
endpoint: internal
- service: volume
endpoint: internal
volume:
jobs:
- cinder-db-sync
- cinder-ks-user
- cinder-ks-endpoints
service:
- keystone-api
- cinder-api
services:
- service: identity
endpoint: internal
- service: volume
endpoint: internal
scheduler:
jobs:
- cinder-db-sync
- cinder-ks-user
- cinder-ks-endpoints
service:
- keystone-api
- cinder-api
services:
- service: identity
endpoint: internal
- service: volume
endpoint: internal
backup:
jobs:
- cinder-db-sync
- cinder-ks-user
- cinder-ks-endpoints
service:
- keystone-api
- cinder-api
services:
- service: identity
endpoint: internal
- service: volume
endpoint: internal
# We use a different layout of the endpoints here to account for versioning
# this swaps the service name and type, and should be rolled out to other
@ -284,7 +299,7 @@ endpoints:
amqp: 5672
oslo_cache:
hosts:
default: memcache
default: memcached
port:
memcache: 11211

View File

@ -232,54 +232,69 @@ resources:
dependencies:
db_init:
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
db_sync:
jobs:
- glance-db-init
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
bootstrap:
jobs:
- glance-db-sync
- glance-ks-user
- glance-ks-endpoints
service:
- mariadb
- glance-api
services:
- service: identity
endpoint: internal
- service: image
endpoint: internal
ks_user:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_service:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_endpoints:
jobs:
- glance-ks-service
service:
- keystone-api
services:
- service: identity
endpoint: internal
api:
jobs:
- glance-db-sync
- glance-ks-user
- glance-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
registry:
jobs:
- glance-db-sync
- glance-ks-user
- glance-ks-endpoints
service:
- keystone-api
- mariadb
- glance-api
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
- service: image
endpoint: internal
tests:
service:
- keystone-api
- glance-api
- glance-registry
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
- service: image
endpoint: internal
# typically overriden by environmental
# values, but should include all endpoints
@ -326,7 +341,7 @@ endpoints:
mysql: 3306
oslo_cache:
hosts:
default: memcache
default: memcached
port:
memcache: 11211
oslo_messaging:

View File

@ -13,7 +13,7 @@
# limitations under the License.
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.init }}
{{- $dependencies := .Values.dependencies.db_init }}
apiVersion: batch/v1
kind: Job
metadata:

View File

@ -181,56 +181,69 @@ network:
dependencies:
db_init:
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
db_sync:
jobs:
- heat-db-init
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
ks_user:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_service:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_endpoints:
jobs:
- heat-ks-service
service:
- keystone-api
services:
- service: identity
endpoint: internal
api:
jobs:
- heat-db-sync
- heat-ks-user
- heat-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
cfn:
jobs:
- heat-db-sync
- heat-ks-user
- heat-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
cloudwatch:
jobs:
- heat-db-sync
- heat-ks-user
- heat-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
engine:
jobs:
- heat-db-sync
- heat-ks-user
- heat-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
# typically overriden by environmental
# values, but should include all endpoints
@ -287,7 +300,7 @@ endpoints:
mysql: 3306
oslo_cache:
hosts:
default: memcache
default: memcached
port:
memcache: 11211
oslo_messaging:

View File

@ -0,0 +1,32 @@
# 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 hostnames from endpoint definitions for use cases
# where the uri style return is not appropriate, and only the short hostname or
# kubernetes servicename is used or relevant in the template:
# { tuple "memcache" "internal" . | include "helm-toolkit.endpoints.hostname_endpoint_lookup" }
# returns: the short internal hostname, which will also match the service name
{{- define "helm-toolkit.endpoints.hostname_endpoint_lookup" -}}
{{- $type := index . 0 -}}
{{- $endpoint := index . 1 -}}
{{- $context := index . 2 -}}
{{- $endpointMap := index $context.Values.endpoints $type }}
{{- with $endpointMap -}}
{{- $endpointScheme := .scheme }}
{{- $endpointHost := index .hosts $endpoint | default .hosts.default}}
{{- printf "%s" $endpointHost -}}
{{- end -}}
{{- end -}}

View File

@ -33,7 +33,7 @@
- name: INTERFACE_NAME
value: eth0
- name: DEPENDENCY_SERVICE
value: "{{ include "helm-toolkit.utils.joinListWithComma" $deps.service }}"
value: "{{ tuple $deps.services $envAll | include "helm-toolkit.utils.comma_joined_hostname_list" }}"
- name: DEPENDENCY_JOBS
value: "{{ include "helm-toolkit.utils.joinListWithComma" $deps.jobs }}"
- name: DEPENDENCY_DAEMONSET

View File

@ -0,0 +1,19 @@
# 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.
{{- define "helm-toolkit.utils.comma_joined_hostname_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_endpoint_lookup" }}{{- end -}}
{{- end -}}

View File

@ -58,9 +58,11 @@ local_settings:
dependencies:
dashboard:
service:
- memcached
- keystone-api
services:
- service: oslo_cache
endpoint: internal
- service: identity
endpoint: internal
resources:
enabled: false
@ -85,6 +87,11 @@ endpoints:
port:
admin: 35357
api: 5000
oslo_cache:
hosts:
default: memcached
port:
memcache: 11211
mounts:
horizon:

View File

@ -13,7 +13,7 @@
# limitations under the License.
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.init }}
{{- $dependencies := .Values.dependencies.db_init }}
{{- $mounts_keystone_db_init := .Values.mounts.keystone_db_init.keystone_db_init }}
{{- $mounts_keystone_db_init_init := .Values.mounts.keystone_db_init.init_container }}

View File

@ -79,23 +79,29 @@ dependencies:
api:
jobs:
- keystone-db-sync
service:
- mariadb
- memcached
services:
- service: oslo_cache
endpoint: internal
- service: oslo_db
endpoint: internal
db_init:
services:
- service: oslo_db
endpoint: internal
db_sync:
jobs:
- keystone-db-init
service:
- mariadb
init:
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
tests:
service:
- keystone-api
services:
- service: identity
endpoint: internal
bootstrap:
service:
- keystone-api
services:
- service: identity
endpoint: internal
resources:
enabled: false
@ -225,6 +231,6 @@ endpoints:
amqp: 5672
oslo_cache:
hosts:
default: memcache
default: memcached
port:
memcache: 11211

View File

@ -13,7 +13,7 @@
# limitations under the License.
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.init }}
{{- $dependencies := .Values.dependencies.db_init }}
apiVersion: batch/v1
kind: Job
metadata:

View File

@ -102,40 +102,49 @@ network:
dependencies:
db_init:
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
db_sync:
jobs:
- magnum-db-init
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
ks_user:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_service:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_endpoints:
jobs:
- magnum-ks-service
service:
- keystone-api
services:
- service: identity
endpoint: internal
api:
jobs:
- magnum-db-sync
- magnum-ks-user
- magnum-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
conductor:
jobs:
- magnum-db-sync
- magnum-ks-user
- magnum-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
# typically overriden by environmental
# values, but should include all endpoints
@ -174,7 +183,7 @@ endpoints:
mysql: 3306
oslo_cache:
hosts:
default: memcache
default: memcached
port:
memcache: 11211
oslo_messaging:

View File

@ -86,56 +86,69 @@ network:
dependencies:
db_init:
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
db_sync:
jobs:
- mistral-db-init
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
ks_user:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_service:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_endpoints:
jobs:
- mistral-ks-service
service:
- keystone-api
services:
- service: identity
endpoint: internal
api:
jobs:
- mistral-db-sync
- mistral-ks-user
- mistral-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
engine:
jobs:
- mistral-db-sync
- mistral-ks-user
- mistral-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
event_engine:
jobs:
- mistral-db-sync
- mistral-ks-user
- mistral-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
executor:
jobs:
- mistral-db-sync
- mistral-ks-user
- mistral-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
# typically overriden by environmental
# values, but should include all endpoints
@ -188,7 +201,7 @@ endpoints:
amqp: 5672
oslo_cache:
hosts:
default: memcache
default: memcached
port:
memcache: 11211

View File

@ -134,57 +134,77 @@ ml2:
dependencies:
db_init:
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
db_sync:
jobs:
- neutron-db-init
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
ks_user:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_service:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_endpoints:
jobs:
- neutron-ks-service
service:
- keystone-api
services:
- service: identity
endpoint: internal
server:
jobs:
- neutron-db-sync
- neutron-ks-user
- neutron-ks-endpoints
service:
- rabbitmq
- mariadb
- keystone-api
- memcached
services:
- service: oslo_db
endpoint: internal
- service: oslo_messaging
endpoint: internal
- service: oslo_cache
endpoint: internal
- service: identity
endpoint: internal
dhcp:
service:
- rabbitmq
- neutron-server
- nova-api
services:
- service: oslo_messaging
endpoint: internal
- service: network
endpoint: internal
- service: compute
endpoint: internal
daemonset:
- ovs-agent
metadata:
service:
- rabbitmq
- neutron-server
- nova-api
services:
- service: oslo_messaging
endpoint: internal
- service: network
endpoint: internal
- service: compute
endpoint: internal
daemonset:
- ovs-agent
ovs_agent:
service:
- rabbitmq
- neutron-server
services:
- service: oslo_messaging
endpoint: internal
- service: network
endpoint: internal
l3:
service:
- rabbitmq
- neutron-server
- nova-api
services:
- service: oslo_messaging
endpoint: internal
- service: network
endpoint: internal
- service: compute
endpoint: internal
daemonset:
- ovs-agent
@ -462,7 +482,7 @@ endpoints:
amqp: 5672
oslo_cache:
hosts:
default: memcache
default: memcached
port:
memcache: 11211
compute:

View File

@ -147,60 +147,94 @@ dependencies:
- nova-db-sync
- nova-ks-user
- nova-ks-endpoints
service:
- mariadb
services:
- service: oslo_messaging
endpoint: internal
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
db_init:
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
db_sync:
jobs:
- nova-db-init
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
bootstrap:
service:
- keystone-api
- nova-api
services:
- service: identity
endpoint: internal
- service: compute
endpoint: internal
ks_user:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_service:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_endpoints:
jobs:
- nova-ks-service
service:
- keystone-api
services:
- service: identity
endpoint: internal
compute:
jobs:
- nova-db-sync
service:
- keystone-api
- nova-api
services:
- service: oslo_messaging
endpoint: internal
- service: compute
endpoint: internal
- service: network
endpoint: internal
daemonset:
- ovs-agent
libvirt:
jobs:
- nova-db-sync
service:
- keystone-api
- nova-api
consoleauth:
jobs:
- nova-db-sync
service:
- mariadb
services:
- service: oslo_messaging
endpoint: internal
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
- service: compute
endpoint: internal
scheduler:
jobs:
- nova-db-sync
service:
- mariadb
services:
- service: oslo_messaging
endpoint: internal
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
- service: compute
endpoint: internal
conductor:
jobs:
- nova-db-sync
service:
- mariadb
services:
- service: oslo_messaging
endpoint: internal
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
- service: compute
endpoint: internal
mounts:
nova_compute:
@ -393,7 +427,7 @@ endpoints:
amqp: 5672
oslo_cache:
hosts:
default: memcache
default: memcached
port:
memcache: 11211
compute:

View File

@ -75,5 +75,6 @@ probes_delay: 180
probes_timeout: 10
dependencies:
service:
- etcd
services:
- service: etcd
endpoint: internal

View File

@ -13,7 +13,7 @@
# limitations under the License.
{{- $envAll := . }}
{{- $dependencies := .Values.dependencies.init }}
{{- $dependencies := .Values.dependencies.db_init }}
apiVersion: batch/v1
kind: Job
metadata:

View File

@ -103,40 +103,49 @@ network:
dependencies:
db_init:
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
db_sync:
jobs:
- senlin-db-init
service:
- mariadb
services:
- service: oslo_db
endpoint: internal
ks_user:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_service:
service:
- keystone-api
services:
- service: identity
endpoint: internal
ks_endpoints:
jobs:
- senlin-ks-service
service:
- keystone-api
services:
- service: identity
endpoint: internal
api:
jobs:
- senlin-db-sync
- senlin-ks-user
- senlin-ks-endpoints
service:
- keystone-api
- mariadb
services:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
engine:
jobs:
- senlin-db-sync
- senlin-ks-user
- senlin-ks-endpoints
service:
- keystone-api
- mariadb
servics:
- service: oslo_db
endpoint: internal
- service: identity
endpoint: internal
# typically overriden by environmental
# values, but should include all endpoints
@ -175,7 +184,7 @@ endpoints:
mysql: 3306
oslo_cache:
hosts:
default: memcache
default: memcached
port:
memcache: 11211
oslo_messaging: