diff options
| author | Ryan Hallisey <rhallise@redhat.com> | 2016-05-26 05:20:00 -0400 |
|---|---|---|
| committer | Ryan Hallisey <rhallise@redhat.com> | 2016-06-05 12:44:34 -0400 |
| commit | 2b87c883199628d6fb9e73c2856226e25b305563 (patch) | |
| tree | 32f5fdcbf7d44ad0364e983d42d466b708767610 /docker | |
| parent | 994d1e50a5bc53687cb5224f6de70451bf15bde8 (diff) | |
| download | kolla-2b87c883199628d6fb9e73c2856226e25b305563.tar.gz kolla-2b87c883199628d6fb9e73c2856226e25b305563.zip | |
Add kolla-kubernetes bootstrap capability to Keystone
Kolla-kubernetes requires there be an alternative way to bootstrap
the container. Kolla-kubernetes needs to signal the Kubernetes API
endpoint to make the cluster aware a bootstrap is in progress.
Partially-implements: blueprint kolla-kubernetes-extended-dockerfiles
Change-Id: Ie078017496eec81188d4c7c7916a70d1722f8aee
Diffstat (limited to 'docker')
| -rw-r--r-- | docker/keystone/extend_start.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docker/keystone/extend_start.sh b/docker/keystone/extend_start.sh index 594786c1d..992885691 100644 --- a/docker/keystone/extend_start.sh +++ b/docker/keystone/extend_start.sh @@ -1,5 +1,16 @@ #!/bin/bash +function kolla_kubernetes { + KUBE_TOKEN=$(</var/run/secrets/kubernetes.io/serviceaccount/token) + bootstrap_url=$(curl -sSk -H "Authorization: Bearer $KUBE_TOKEN" https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT_443_TCPORT/api/v1/namespaces/default/pods | grep /api/v1/namespaces/default/pods/keystone-bootstrap | cut -d '"' -f 4) || true + KEYSTONE_BOOTSTRAPPED=$(curl -sSk -H "Authorization: Bearer $KUBE_TOKEN" https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT_443_TCPORT$bootstrap_url | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["status"]["phase"]') || KEYSTONE_BOOTSTRAPPED='Succeeded' + + if [[ "$KEYSTONE_BOOTSTRAPPED" != "Succeeded" ]]; then + echo "Keystone bootstrapping isn't complete" + exit 1 + fi +} + # NOTE(pbourke): httpd will not clean up after itself in some cases which # results in the container not being able to restart. (bug #1489676, 1557036) if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then @@ -32,3 +43,10 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then fi ARGS="-DFOREGROUND" + +#***** KOLLA-KUBERNETES ***** +# TODO: Add a kolla_kubernetes script at build time when templating is complete +if [[ "${!KOLLA_KUBERNETES[@]}" ]]; then + kolla_kubernetes +fi +#***** KOLLA-KUBERNETES ***** |
