Skip to content
Snippets Groups Projects
Commit 5f86491b authored by Jenkins's avatar Jenkins Committed by Gerrit Code Review
Browse files

Merge "Add kolla-kubernetes bootstrap capability to mariadb"

parents 2cb0f445 994d1e50
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,17 @@ function bootstrap_db { ...@@ -18,6 +18,17 @@ function bootstrap_db {
mysqladmin -uroot -p"${DB_ROOT_PASSWORD}" shutdown mysqladmin -uroot -p"${DB_ROOT_PASSWORD}" shutdown
} }
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/mariadb-bootstrap | cut -d '"' -f 4) || true
MARIADB_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"]') || MARIADB_BOOTSTRAPPED='Succeeded'
if [[ "$MARIADB_BOOTSTRAPPED" != "Succeeded" ]]; then
echo "Mariadb bootstrapping isn't complete"
exit 1
fi
}
# Only update permissions if permissions need to be updated # Only update permissions if permissions need to be updated
if [[ $(stat -c %U:%G /var/lib/mysql) != "mysql:mysql" ]]; then if [[ $(stat -c %U:%G /var/lib/mysql) != "mysql:mysql" ]]; then
sudo chown mysql: /var/lib/mysql sudo chown mysql: /var/lib/mysql
...@@ -41,3 +52,10 @@ fi ...@@ -41,3 +52,10 @@ fi
if [[ "${!BOOTSTRAP_ARGS[@]}" ]]; then if [[ "${!BOOTSTRAP_ARGS[@]}" ]]; then
ARGS="${BOOTSTRAP_ARGS}" ARGS="${BOOTSTRAP_ARGS}"
fi fi
#***** KOLLA-KUBERNETES *****
# TODO: Add a kolla_kubernetes script at build time when templating is complete
if [[ "${!KOLLA_KUBERNETES[@]}" ]]; then
kolla_kubernetes
fi
#***** KOLLA-KUBERNETES *****
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment