Merge "Add kolla-kubernetes bootstrap capability to Keystone"

This commit is contained in:
Jenkins 2016-06-16 12:01:44 +00:00 committed by Gerrit Code Review
commit 07aa95274d

View File

@ -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 *****