Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kolla Ansible
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Very Demiurge Very Mindful
Kolla Ansible
Commits
80c4fbf1
Commit
80c4fbf1
authored
8 years ago
by
Jenkins
Committed by
Gerrit Code Review
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Add kolla-kubernetes bootstap logic endpoint script"
parents
c6cd15d5
e26e278e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docker/keystone/keystone_bootstrap.sh
+20
-0
20 additions, 0 deletions
docker/keystone/keystone_bootstrap.sh
with
20 additions
and
0 deletions
docker/keystone/keystone_bootstrap.sh
+
20
−
0
View file @
80c4fbf1
#!/bin/bash
set
-x
# NOTE(SamYaple): Kolla needs to wraps `keystone-manage bootstrap` to ensure
# any change is reported correctly for idempotency. This script will exit with
# valid json that can be parsed with information about if the task has failed
...
...
@@ -23,6 +25,24 @@ function exit_json {
echo
'{"failed": false, "changed": '
"
${
changed
}
"
'}'
}
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
}
#***** KOLLA-KUBERNETES *****
# TODO: Add a kolla_kubernetes script at build time when templating is complete
if
[[
"
${
!KOLLA_KUBERNETES[@]
}
"
]]
;
then
kolla_kubernetes
fi
#***** KOLLA-KUBERNETES *****
changed
=
"false"
keystone_bootstrap
=
$(
keystone-manage bootstrap
--bootstrap-username
"
${
USERNAME
}
"
--bootstrap-password
"
${
PASSWORD
}
"
--bootstrap-project-name
"
${
PROJECT
}
"
--bootstrap-role-name
"
${
ROLE
}
"
--bootstrap-admin-url
"
${
ADMIN_URL
}
"
--bootstrap-internal-url
"
${
INTERNAL_URL
}
"
--bootstrap-public-url
"
${
PUBLIC_URL
}
"
--bootstrap-service-name
"keystone"
--bootstrap-region-id
"
${
REGION
}
"
2>&1
)
if
[[
$?
!=
0
]]
;
then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment