Skip to content

Commit 61ab48a

Browse files
author
scrungus
committed
Merge tag '0.8.2' into upgrade/0.8.2
2 parents fd560c0 + c52c393 commit 61ab48a

File tree

8 files changed

+212
-13
lines changed

8 files changed

+212
-13
lines changed

.github/actions/test/action.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,10 @@ runs:
3333
- name: Run test suite
3434
shell: bash
3535
run: |
36-
set -eo pipefail
36+
set -e
3737
source ./ci.env
3838
source ./bin/activate "$AZIMUTH_CONFIG_ENVIRONMENT" "$AZIMUTH_ENVIRONMENT"
39-
test_directory="$(ansible -m debug -a "var=$VAR_NAME" all | jq -r ".plays[0].tasks[0].hosts.localhost.$VAR_NAME")"
40-
robot --loglevel debug --consolecolors on "$test_directory"
41-
env:
42-
ANSIBLE_LOAD_CALLBACK_PLUGINS: "true"
43-
ANSIBLE_STDOUT_CALLBACK: json
44-
MOZ_HEADLESS: "1"
45-
VAR_NAME: generate_tests_suite_directory
39+
./bin/run-tests
4640
4741
- name: Upload test report artifacts
4842
uses: actions/upload-artifact@v3
@@ -54,6 +48,15 @@ runs:
5448
report.html
5549
if: ${{ always() }}
5650

51+
- name: Clean up test platforms
52+
shell: bash
53+
run: |
54+
set -e
55+
source ./ci.env
56+
source ./bin/activate "$AZIMUTH_CONFIG_ENVIRONMENT" "$AZIMUTH_ENVIRONMENT"
57+
./bin/run-tests --include delete
58+
if: ${{ cancelled() }}
59+
5760
- name: Create debug bundle
5861
shell: bash
5962
run: |

.gitlab-ci-magnum.yml.sample

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
3+
default:
4+
image: ubuntu:jammy
5+
6+
variables:
7+
# Because we are installing git-crypt as part of the job, we cannot reuse old
8+
# checkouts where git-crypt is already initialised as this results in an error
9+
GIT_STRATEGY: clone
10+
# Use the pipeline credentials for Terraform
11+
# This assumes that we are using GitLab-managed Terraform state (recommended when available)
12+
TF_HTTP_USERNAME: gitlab-ci-token
13+
TF_HTTP_PASSWORD: $CI_JOB_TOKEN
14+
15+
stages:
16+
# This stage owns the scheduled job that checks for upstream changes
17+
- scheduled
18+
# This stage owns the deploy job for the staging environment
19+
- staging
20+
# This stage owns the deploy job for the production environment
21+
- production
22+
23+
#####
24+
# This job checks to see if there is a new release that needs to be merged
25+
#
26+
# If there is, it will create a new branch containing the changes and a corresponding merge request
27+
#
28+
# It runs as a scheduled job, for which a suitable schedule must be defined, e.g. daily or weekly
29+
#
30+
# This job writes back to the repository and to the merge requests API
31+
# To do this, it needs more power than is granted to the CI token
32+
# So CI variables must be set that contain an access token and the corresponding username
33+
# This can be a Project Access Token (paid feature, recommended if available) or a Personal Access Token (not ideal)
34+
#####
35+
check_for_release:
36+
stage: scheduled
37+
rules:
38+
- if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "main"
39+
variables:
40+
GIT_STRATEGY: none
41+
before_script:
42+
- apt update -y
43+
- apt install -y curl git jq
44+
script:
45+
# Configure git to use the available credentials
46+
- git config --global credential.helper store
47+
# Do our own clone to make sure we don't get unrelated history errors from detached heads
48+
- git clone https://${GITLAB_PAT_USERNAME}:${GITLAB_PAT_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git ${CI_PROJECT_NAME}
49+
- cd ${CI_PROJECT_NAME}
50+
# Tell git who we are for commits
51+
- git config user.email "${CI_PROJECT_PATH_SLUG}-ci@${CI_SERVER_HOST}"
52+
- git config user.name "${CI_PROJECT_NAME} CI"
53+
# Create the merge branch
54+
- ./bin/create-merge-branch
55+
# Create a merge request for the branch
56+
- |
57+
if [ -f ".mergeenv" ]; then
58+
source ".mergeenv"
59+
BODY="{
60+
\"id\": ${CI_PROJECT_ID},
61+
\"title\": \"Upgrade config to upstream version ${RELEASE_TAG}\",
62+
\"source_branch\": \"${BRANCH_NAME}\",
63+
\"target_branch\": \"main\",
64+
\"remove_source_branch\": true,
65+
\"assignee_id\": \"${GITLAB_USER_ID}\"
66+
}"
67+
curl -kfsSL -X POST \
68+
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/merge_requests" \
69+
--header "Authorization: Bearer ${GITLAB_PAT_TOKEN}" \
70+
--header "Content-Type: application/json" \
71+
--data "${BODY}"
72+
fi
73+
74+
#####
75+
# This job deploys a staging/test version of the Magnum CAPI management cluster
76+
#
77+
# It runs automatically for every commit to main that changes one of the files
78+
# that affects the environment.
79+
80+
# NOTE: If the target site doesn't have a separate staging cloud with it's own Magnum
81+
# deployment then it may still be worth including a management cluster staging env in
82+
# this config repo which is a stripped down (1 master, 1 worker) version of the prod
83+
# env. Although this will not allow for testing the interaction between Magnum and the
84+
# CAPI management cluster, it will at least validate the deployment config before a
85+
# production rollout is performed.
86+
#####
87+
deploy_staging:
88+
stage: staging
89+
rules:
90+
# Prevent the job from running on any branch that is not main
91+
- if: $CI_COMMIT_BRANCH != "main"
92+
when: never
93+
# Allow deployments to be manually triggered on main even when there are no changed files
94+
- if: $CI_PIPELINE_SOURCE == "web"
95+
# Run for commits to main that change particular files
96+
- if: $CI_PIPELINE_SOURCE == "push"
97+
changes:
98+
# Files that affect the staging environment
99+
- env
100+
- env.secret
101+
- requirements.yml
102+
- environments/base/**/*
103+
- environments/ha/**/*
104+
- environments/capi-mgmt/**/*
105+
# TODO: Change these to actual site environment names
106+
- environments/site-base/**/*
107+
- environments/site-staging/**/*
108+
environment:
109+
# TODO: Change this to site staging environment name
110+
name: site-staging
111+
variables:
112+
ANSIBLE_FORCE_COLOR: "true"
113+
before_script:
114+
- source ./bin/ci-setup
115+
script:
116+
- ansible-playbook stackhpc.azimuth_ops.provision_capi_mgmt
117+
118+
#####
119+
# This job deploys the Magnum CAPI management cluster to the production environment
120+
#
121+
# It runs for every commit to main that changes one of the files that affects
122+
# the environment, but only if the staging deployment succeeded
123+
#
124+
# It also includes a manual gate that can be used as a confirmation that the
125+
# relevant testing has taken place on staging
126+
#####
127+
deploy_production:
128+
stage: production
129+
rules:
130+
# Prevent the job from running on any branch that is not main
131+
- if: $CI_COMMIT_BRANCH != "main"
132+
when: never
133+
# Allow deployments to be manually triggered on main even when there are no changed files
134+
- if: $CI_PIPELINE_SOURCE == "web"
135+
when: manual
136+
# Run for commits to main that change particular files
137+
- if: $CI_PIPELINE_SOURCE == "push"
138+
changes:
139+
- env
140+
- env.secret
141+
- requirements.yml
142+
- environments/base/**/*
143+
- environments/ha/**/*
144+
- environments/capi-mgmt/**/*
145+
# TODO: Change these to actual site environment names
146+
- environments/site-base/**/*
147+
- environments/site-staging/**/*
148+
when: manual
149+
environment:
150+
# TODO: Change this to site prod environment name
151+
name: site-prod
152+
variables:
153+
ANSIBLE_FORCE_COLOR: "true"
154+
before_script:
155+
- source ./bin/ci-setup
156+
script:
157+
- ansible-playbook stackhpc.azimuth_ops.provision_capi_mgmt

bin/tilt-images-apply

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ helm_get_values_proc = exec_cmd(
6868
os.environ["TILT_RELEASE_NAME"],
6969
"--namespace",
7070
os.environ["TILT_RELEASE_NAMESPACE"],
71+
"--output",
72+
"json",
7173
],
7274
stdout = subprocess.PIPE
7375
)
74-
current_values = yaml.safe_load(helm_get_values_proc.stdout)
75-
current_values.pop("USER-SUPPLIED VALUES")
76+
current_values = json.loads(helm_get_values_proc.stdout) or {}
77+
current_values.pop("USER-SUPPLIED VALUES", None)
7678

7779

7880
# Build and run the Helm upgrade command

docs/configuration/08-zenith.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ zenith_registrar_subdomain_token_signing_key: "<some secret key>"
1717
1818
!!! tip
1919
20-
This key should be a long, random string - at least 32 bytes (256 bits) is recommended.
20+
This key must be a long, random string - at least 32 bytes (256 bits) is required.
2121
A suitable key can be generated using `openssl rand -hex 32`.
2222

2323
!!! danger

docs/configuration/16-local-customisations.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,15 @@ compiled CSS file. For example, the following configuration tells Azimuth to use
3737
[Zephyr theme from Bootswatch](https://bootswatch.com/zephyr/):
3838
3939
```yaml title="environments/my-site/inventory/group_vars/all/variables.yml"
40-
azimuth_theme_bootstrap_css_url: https://docs.example.org/azimuth
40+
azimuth_theme_bootstrap_css_url: https://bootswatch.com/5/zephyr/bootstrap.css
4141
```
42+
!!! tip
43+
44+
In order for the theming changes to take effect you may need to do a hard refresh of
45+
the page due to the aggressive nature of CSS caching.
46+
47+
Mac: <kbd>⇧ Shift</kbd> + <kbd>⌘ Command</kbd> + <kbd>R</kbd>
48+
Windows: <kbd> ctrl</kbd> + <kbd>⇧ Shift</kbd> + <kbd>R</kbd> / <kbd> ctrl</kbd> + <kbd> F5</kbd>
4249
4350
### Injecting custom CSS
4451

docs/debugging/kubernetes.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,31 @@ kubectl -n capo-system logs deploy/capo-controller-manager
167167
kubectl -n capi-addon-system logs deploy/cluster-api-addon-provider
168168
```
169169

170+
## Accessing tenant clusters
171+
172+
The kubeconfigs for all tenant clusters are stored as secrets. First, you need
173+
to find the name and namespace of the cluster you want to debug. This can be
174+
seen from the list of clusters:
175+
176+
```command title="On the K3s node, targetting the HA cluster if deployed"
177+
$ kubectl get cluster -A
178+
```
179+
180+
Then, you can retrieve and decode the kubeconfig with the following:
181+
182+
```command title="On the K3s node, targetting the HA cluster if deployed"
183+
$ kubectl -n <namespace> get secret <clustername>-kubeconfig -o json | \
184+
jq -r '.data.value' | \
185+
base64 -d \
186+
> kubeconfig-tenant.yaml
187+
```
188+
189+
This can now be used by exporting the path to this file:
190+
191+
```command title="On the K3s node, targetting the HA cluster if deployed"
192+
$ export KUBECONFIG=kubeconfig-tenant.yaml
193+
```
194+
170195
## Zenith service issues
171196

172197
Zenith services are enabled on Kubernetes clusters using the

environments/example/inventory/group_vars/all/secrets.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# It should be encrypted if stored in version control
55
# https://stackhpc.github.io/azimuth-config/repository/secrets/
66
#####
7+
# Unless explicitly mentioned otherwise, a long, random string - at least 32 bytes (256 bits) is recommended.
8+
# A suitable key can be generated using the following command.
9+
# openssl rand -hex 32
710

811
# https://stackhpc.github.io/azimuth-config/configuration/05-secret-key/
912
# The secret key for signing Azimuth cookies
@@ -15,12 +18,14 @@ keycloak_admin_password: "<secure password>"
1518

1619
# https://stackhpc.github.io/azimuth-config/configuration/08-zenith/
1720
# The secret key for signing Zenith registrar tokens
21+
# This MUST be a minimum of 32 characters
1822
zenith_registrar_subdomain_token_signing_key: "<secure secret key>"
1923

2024
# https://stackhpc.github.io/azimuth-config/configuration/10-kubernetes-clusters/#harbor-registry
2125
# The password for the Harbor admin account
2226
harbor_admin_password: "<secure password>"
2327
# The secret key for Harbor
28+
# This MUST be exactly 16 alphanumeric characters
2429
harbor_secret_key: "<secure secret key>"
2530

2631
# https://stackhpc.github.io/azimuth-config/configuration/14-monitoring/#accessing-web-interfaces

requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
collections:
44
- name: https://github.com/stackhpc/ansible-collection-azimuth-ops.git
55
type: git
6-
version: 0.7.2
6+
version: 0.8.2
77
# For local development
88
# - type: dir
99
# source: ../ansible-collection-azimuth-ops

0 commit comments

Comments
 (0)