-
Notifications
You must be signed in to change notification settings - Fork 59
Separate skyline secret creation and Update docs #1266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
reet8598
wants to merge
3
commits into
rackerlabs:main
Choose a base branch
from
reet8598:ospc-1566/skyline-secret-updation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+188
−61
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,3 +129,6 @@ base-kustomize/**/charts | |
|
|
||
| # mkdocs | ||
| site/ | ||
|
|
||
| # skyline secrets | ||
| /etc/genestack/skylinesecrets.yaml | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| #!/bin/bash | ||
| # shellcheck disable=SC2086 | ||
|
|
||
| usage() { | ||
| echo "Usage: $0 [--region <region [RegionOne]>" | ||
| exit 1 | ||
| } | ||
|
|
||
| region="RegionOne" | ||
|
|
||
| # Parse command-line arguments | ||
| while [[ "$#" -gt 0 ]]; do | ||
| case $1 in | ||
| --help) | ||
| usage | ||
| ;; | ||
| -h) | ||
| usage | ||
| ;; | ||
| --region) | ||
| region="$2" | ||
| shift 2 | ||
| ;; | ||
| *) | ||
| echo "Unknown parameter passed: $1" | ||
| usage | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| # Check if the region argument is provided | ||
| if [ -z "$region" ]; then | ||
| usage | ||
| fi | ||
|
|
||
| # Generate random password function | ||
| generate_password() { | ||
| < /dev/urandom tr -dc _A-Za-z0-9 | head -c${1:-32} | ||
| } | ||
|
|
||
| OUTPUT_FILE="/etc/genestack/kubesecrets.yaml" | ||
| SKYLINE_SECRETS_FILE="/etc/genestack/skylinesecrets.yaml" | ||
|
|
||
| # Check if skylinesecrets.yaml already exists | ||
| if [[ -f ${SKYLINE_SECRETS_FILE} ]]; then | ||
| echo "Error: ${SKYLINE_SECRETS_FILE} already exists." | ||
| echo " Skyline secrets have already been generated." | ||
| echo " If you want to regenerate skyline secrets, please delete ${SKYLINE_SECRETS_FILE} first." | ||
| echo " WARNING: This will generate NEW passwords and break existing Skyline installations!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check if kubesecrets.yaml exists | ||
| if [[ ! -f ${OUTPUT_FILE} ]]; then | ||
| echo "Error: ${OUTPUT_FILE} does not exist." | ||
| echo " Please run create-secrets.sh first to generate the base secrets file." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Generate Skyline passwords | ||
| echo "Generating new Skyline secrets..." | ||
| skyline_service_password=$(generate_password 32) | ||
| skyline_db_password=$(generate_password 32) | ||
| skyline_secret_key_password=$(generate_password 32) | ||
|
|
||
| # Create the Skyline secrets YAML content | ||
| SKYLINE_SECRET_CONTENT="--- | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: skyline-apiserver-secrets | ||
| namespace: openstack | ||
| type: Opaque | ||
| data: | ||
| service-username: $(echo -n "skyline" | base64) | ||
| service-password: $(echo -n $skyline_service_password | base64 -w0) | ||
| service-domain: $(echo -n "service" | base64) | ||
| service-project: $(echo -n "service" | base64) | ||
| service-project-domain: $(echo -n "service" | base64) | ||
| db-endpoint: $(echo -n "mariadb-cluster-primary.openstack.svc.cluster.local" | base64 -w0) | ||
| db-name: $(echo -n "skyline" | base64) | ||
| db-username: $(echo -n "skyline" | base64) | ||
| db-password: $(echo -n $skyline_db_password | base64 -w0) | ||
| secret-key: $(echo -n $skyline_secret_key_password | base64 -w0) | ||
| keystone-endpoint: $(echo -n "http://keystone-api.openstack.svc.cluster.local:5000/v3" | base64 -w0) | ||
| keystone-username: $(echo -n "skyline" | base64) | ||
| default-region: $(echo -n "$region" | base64) | ||
| prometheus_basic_auth_password: $(echo -n "" | base64) | ||
| prometheus_basic_auth_user: $(echo -n "" | base64) | ||
| prometheus_enable_basic_auth: $(echo -n "false" | base64) | ||
| prometheus_endpoint: $(echo -n "http://kube-prometheus-stack-prometheus.prometheus.svc.cluster.local:9090" | base64 -w0)" | ||
|
|
||
| # Write to skylinesecrets.yaml | ||
| echo "$SKYLINE_SECRET_CONTENT" > ${SKYLINE_SECRETS_FILE} | ||
| chmod 0640 ${SKYLINE_SECRETS_FILE} | ||
| echo "Created ${SKYLINE_SECRETS_FILE}" | ||
|
|
||
| # Check if skyline section already exists in kubesecrets.yaml | ||
| if grep -q "name: skyline-apiserver-secrets" ${OUTPUT_FILE}; then | ||
| echo "Warning: skyline-apiserver-secrets already exists in ${OUTPUT_FILE}" | ||
| echo " This suggests skylinesecrets.yaml was previously generated." | ||
| echo " Aborting to prevent duplicate entries." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Append to kubesecrets.yaml | ||
| echo "$SKYLINE_SECRET_CONTENT" >> $OUTPUT_FILE | ||
|
|
||
| echo "Skyline secret appended to ${OUTPUT_FILE}" | ||
| echo "" | ||
| echo "✓ Successfully created ${SKYLINE_SECRETS_FILE}" | ||
| echo "✓ Successfully appended skyline secret to ${OUTPUT_FILE}" | ||
| echo "" | ||
| echo "IMPORTANT: Keep ${SKYLINE_SECRETS_FILE} safe!" | ||
| echo " It will be used to preserve skyline secret when regenerating ${OUTPUT_FILE}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.