Skip to content

Commit d21b4a5

Browse files
authored
Merge branch 'stackhpc/yoga' into os-capacity-more-fixes
2 parents 858694d + 6c14370 commit d21b4a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+558
-63
lines changed

.github/workflows/overcloud-host-image-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder]
4343
permissions: {}
4444
steps:
45-
- uses: actions/checkout@v3
45+
- uses: actions/checkout@v4
4646
with:
4747
path: src/kayobe-config
4848

@@ -67,7 +67,7 @@ jobs:
6767
rm -f /tmp/updated_images.txt
6868
6969
- name: Clone StackHPC Kayobe repository
70-
uses: actions/checkout@v3
70+
uses: actions/checkout@v4
7171
with:
7272
repository: stackhpc/kayobe
7373
ref: refs/heads/stackhpc/${{ steps.openstack_release.outputs.openstack_release }}

.github/workflows/overcloud-host-image-promote.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
3636
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder]
3737
steps:
38-
- uses: actions/checkout@v3
38+
- uses: actions/checkout@v4
3939
with:
4040
path: src/kayobe-config
4141

@@ -46,7 +46,7 @@ jobs:
4646
echo "openstack_release=${BRANCH}" | sed "s|stable/||" >> $GITHUB_OUTPUT
4747
4848
- name: Clone StackHPC Kayobe repository
49-
uses: actions/checkout@v3
49+
uses: actions/checkout@v4
5050
with:
5151
repository: stackhpc/kayobe
5252
ref: refs/heads/stackhpc/${{ steps.openstack_release.outputs.openstack_release }}

.github/workflows/stackhpc-all-in-one.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ on:
3434
vm_interface:
3535
description: Default network interface name
3636
type: string
37-
default: ens3
37+
default: enp3s0
3838
vm_flavor:
3939
description: Flavor for the all-in-one VM
4040
type: string
@@ -77,7 +77,7 @@ jobs:
7777
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
7878
KAYOBE_IMAGE: ${{ inputs.kayobe_image }}
7979
steps:
80-
- uses: actions/checkout@v3
80+
- uses: actions/checkout@v4
8181
with:
8282
submodules: true
8383

.github/workflows/stackhpc-build-kayobe-image.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
name: Build kayobe image
66

77
on:
8+
push:
9+
branches:
10+
# NOTE(upgrade): Reference only the current release branch here.
11+
- stackhpc/yoga
12+
813
workflow_call:
914
inputs:
1015
http_proxy:
@@ -32,7 +37,7 @@ env:
3237
jobs:
3338
build-kayobe-image:
3439
name: Build kayobe image
35-
if: inputs.if
40+
if: inputs.if || github.repository == 'stackhpc/stackhpc-kayobe-config' && github.event_name == 'push'
3641
runs-on: ubuntu-20.04
3742
permissions:
3843
contents: read
@@ -42,7 +47,7 @@ jobs:
4247
steps:
4348
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
4449
- name: Checkout kayobe config
45-
uses: actions/checkout@v3
50+
uses: actions/checkout@v4
4651
with:
4752
submodules: true
4853

.github/workflows/stackhpc-container-image-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
openstack_release: ${{ steps.openstack_release.outputs.openstack_release }}
5454
steps:
5555
- name: Checkout
56-
uses: actions/checkout@v3
56+
uses: actions/checkout@v4
5757

5858
- name: Determine OpenStack release
5959
id: openstack_release
@@ -106,12 +106,12 @@ jobs:
106106
needs:
107107
- generate-tag
108108
steps:
109-
- uses: actions/checkout@v3
109+
- uses: actions/checkout@v4
110110
with:
111111
path: src/kayobe-config
112112

113113
- name: Clone StackHPC Kayobe repository
114-
uses: actions/checkout@v3
114+
uses: actions/checkout@v4
115115
with:
116116
repository: stackhpc/kayobe
117117
ref: refs/heads/stackhpc/${{ needs.generate-tag.outputs.openstack_release }}

.github/workflows/stackhpc-pull-request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
aio: ${{ steps.changes.outputs.aio }}
2323
steps:
2424
- name: GitHub Checkout
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626

2727
- name: Check changed files
2828
uses: dorny/paths-filter@v2
@@ -47,7 +47,7 @@ jobs:
4747
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
4848
steps:
4949
- name: GitHub Checkout 🛎
50-
uses: actions/checkout@v3
50+
uses: actions/checkout@v4
5151
with:
5252
fetch-depth: 0
5353
- name: Setup Python ${{ matrix.python-version }} 🐍

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ etc/kayobe/environments/aufn-ceph/kolla/config/cinder/ceph.conf
5555
etc/kayobe/environments/aufn-ceph/kolla/config/cinder/ceph.client.glance.keyring
5656
etc/kayobe/environments/aufn-ceph/kolla/config/nova/ceph.conf
5757
etc/kayobe/environments/aufn-ceph/kolla/config/nova/ceph.client.glance.keyring
58+
59+
# Tempest logs
60+
tempest-artifacts

doc/source/configuration/ci-cd.rst

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
=====
2+
CI/CD
3+
=====
4+
5+
Concepts
6+
========
7+
8+
The CI/CD system developed for managing Kayobe based OpenStack clouds is composed of three main components; workflows, runners and kayobe automation.
9+
Firstly, the workflows are files which describe a series of tasks to be performed in relation to the deployed cloud.
10+
These workflows are executed on request, on schedule or in response to an event such as a pull request being opened.
11+
The workflows are designed to carry out various day-to-day activites such as; running Tempest tests, configuring running services or displaying the change to configuration files if a pull request is merged.
12+
Secondly, in order for the workflows to run against a cloud we would need private runners present within the cloud positioned in such a way they can reach the internal network and public API.
13+
Deployment of private runners is supported by all major providers with the use of community developed Ansible roles.
14+
Finally, due to the requirement that we support various different platforms tooling in the form of `Kayobe automation <https://github.com/stackhpc/kayobe-automation/>`__ was developed.
15+
This tooling is not tied to any single CI/CD platform as all tasks are a series of shell script and Ansible playbooks which are designed to run in a purpose build kayobe container.
16+
This is complemented by the use of an Ansible collection known as `stackhpc.kayobe_workflows <https://github.com/stackhpc/ansible-collection-kayobe-workflows/>`__ which aims to provide users with a quick and easy way of customising all workflows to fit within a customer's cloud.
17+
18+
Currently we support the creation and deployment of workflows for GitHub with Gitlab support being actively worked upon.
19+
20+
Kayobe Automation
21+
-----------------
22+
23+
`Kayobe automation <https://github.com/stackhpc/kayobe-automation/>`__ is a collection of scripts and tools that automate kayobe operations.
24+
It is deployed and controlled by CI/CD platforms such as GitHub actions and GitLab pipelines.
25+
Kayobe automation provides users with an easy process to perform tasks such as: overcloud service deploy, config-diff, tempest testing, and many more.
26+
With it being integrated into platforms such as GitHub or GitLab it builds a close relationship between the contents of the deployments kayobe configuration and what is currently deployed.
27+
This is because operations such as opening a pull request will trigger a config diff to be generated providing insight on what impact it might have on services or a tempest test that could be scheduled to run daily providing knowledge of faults earlier than before.
28+
29+
Workflows
30+
---------
31+
32+
Kayobe automation has been designed to be independent of any CI/CD platform with all tasks running inside of a purpose built Kayobe container.
33+
However, platform specific workflows need to be deployed to bridge the gap between the contents of Kayobe Automation and these CI/CD platforms.
34+
Workflows are templated for each Kayobe configuration repository, ensuring appropriate workflow input parameters are defined, and any necessary customisations can be applied.
35+
The templating of workflows is offered through the `stackhpc.kayobe_workflows <https://github.com/stackhpc/ansible-collection-kayobe-workflows/>`__ collection which currently supports GitHub workflows.
36+
37+
Runners
38+
-------
39+
40+
Runners are purpose built services tied to a particular service vendor such as GitHub Actions or GitLab CI.
41+
These services will listen for jobs which have been tagged appropriately and dispatched to these specific runners.
42+
The runners will need to be deployed using existing roles and playbooks whereby the binary/package is downloaded and registered using a special token.
43+
In some deployments runner hosts can be shared between environments however this is not always true and dedicated hosts will need to be used for each environment you intend to deploy kayobe automation within.
44+
45+
GitHub Actions
46+
=================
47+
48+
To enable CI/CD where GitHub Actions is used please follow the steps described below starting with the deployment of the runners.
49+
50+
Runner Deployment
51+
-----------------
52+
53+
1. Identify a suitable host for hosting the runners.
54+
GitHub runners need to be deployed on a host which has not had Docker deployed using kolla.
55+
This is because GitHub runners cannot provide `network options when running in a container <https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idcontaineroptions>`__.
56+
57+
Ideally an Infra VM could be used here or failing that the control host.
58+
Wherever it is deployed the host will need access to the :code:`admin_network`, :code:`public_network` and the :code:`pulp registry` on the seed.
59+
60+
2. Edit the environment's :code:`${KAYOBE_CONFIG_PATH}/environments/${KAYOBE_ENVIRONMENT}/inventory/groups` to add the predefined :code:`github-runners` group to :code:`infra-vms`
61+
62+
.. code-block:: ini
63+
64+
[infra-vms:children]
65+
github-runners
66+
67+
3. Edit the environment's :code:`${KAYOBE_CONFIG_PATH}/environments/${KAYOBE_ENVIRONMENT}/inventory/hosts` to define the host(s) that will host the runners.
68+
69+
.. code-block:: ini
70+
71+
[github-runners]
72+
prod-runner-01
73+
74+
4. Provide all the relevant Kayobe :code:`group_vars` for :code:`github-runners` under :code:`${KAYOBE_CONFIG_PATH}/environments/${KAYOBE_ENVIRONMENT}/inventory/group_vars/github-runners`
75+
* `infra-vms` ensuring all required `infra_vm_extra_network_interfaces` are defined
76+
* `network-interfaces`
77+
* `python-interpreter.yml` ensuring that `ansible_python_interpreter: /usr/bin/python3` has been set
78+
79+
5. Edit the ``${KAYOBE_CONFIG_PATH}/inventory/group_vars/github-runners/runners.yml`` file which will contain the variables required to deploy a series of runners.
80+
Below is a core set of variables that will require consideration and modification for successful deployment of the runners.
81+
The number of runners deployed can be configured by removing and extending the dict :code:`github-runners`.
82+
As for how many runners present three is suitable number as this would prevent situations where long running jobs could halt progress other tasks whilst waiting for a free runner.
83+
You might want to increase the number of runners if usage demands it or new workflows make use of multiple parallel jobs.
84+
85+
Note :code:`github_registry` and the elements of the dict control the registry settings for pulling and pushing container images used by the workflows.
86+
In the example below the registry settings have been adapted to demonstrate what a shared registry between environments might look like.
87+
This values maybe suitable for your deployment providing all environments can reach the same registry.
88+
If the all of the environments use their own registry and nothing is shared between them then :code:`github_registry` can omitted from the file and the template will expect environment specific secrets and variables to be added to the repository settings.
89+
This is discussed further in the next section.
90+
91+
.. code-block:: yaml
92+
93+
---
94+
runner_user: VM_USER_NAME_HERE
95+
github_account: ORG_NAME_HERE
96+
github_repo: KAYOBE_CONFIG_REPO_NAME_HERE
97+
access_token: "{{ secrets_github_access_token }}"
98+
99+
default_runner_labels:
100+
- kayobe
101+
- openstack
102+
- "{{ kayobe_environment | default(omit) }}"
103+
104+
github_registry:
105+
url: pulp.example.com
106+
username: admin
107+
password: ${{ secrets.REGISTRY_PASSWORD }}
108+
share: true
109+
110+
github_runners:
111+
runner_01: {}
112+
runner_02: {}
113+
runner_03: {}
114+
115+
6. Obtain a personal access token that would enable the registration of GitHub runners against the `github_account` and `github_repo` defined above.
116+
This token ideally should be `fine-grained personal access token <https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token>`__ which may require the organisation to enable such tokens beforehand.
117+
Steps can be found `here <https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization>`__.
118+
The repository permissions for a fine-grained personal access token should be; :code:`Actions: R/W, Administration: R/W, Metadata: R`
119+
Once the key has been obtained, add it to :code:`secrets.yml` under :code:`secrets_github_access_token`
120+
121+
7. If the host is an actual Infra VM then please refer to upstream `Infrastructure VMs <https://docs.openstack.org/kayobe/latest/configuration/reference/infra-vms.html>`__ documentation for additional configuration and steps.
122+
123+
8. Run :code:`kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/deploy-github-runner.yml`
124+
125+
9. Check runners have registered properly by visiting the repository's :code:`Action` tab -> :code:`Runners` -> :code:`Self-hosted runners`
126+
127+
10. Repeat the above steps for each environment you intend to deploy runners within.
128+
You can share the fine-grained access token between environments.
129+
130+
Workflow Deployment
131+
-------------------
132+
133+
1. Edit :code:`${KAYOBE_CONFIG_PATH}/inventory/group_vars/github-writer/writer.yml` in the base configuration making the appropriate changes to your deployments specific needs. See documentation for `stackhpc.kayobe_workflows.github <https://github.com/stackhpc/ansible-collection-kayobe-workflows/tree/main/roles/github>`__.
134+
135+
2. Run :code:`kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/write-github-workflows.yml`
136+
137+
3. Add all required secrets and variables to repository either via the GitHub UI or GitHub CLI (may require repository owner)
138+
139+
+----------------------------------------------------------------------------------+
140+
| Secrets |
141+
+===================================+==============================================+
142+
| Single Environment | Multiple Environments |
143+
+-----------------------------------+----------------------------------------------+
144+
| KAYOBE_AUTOMATION_SSH_PRIVATE_KEY | <ENV_NAME>_KAYOBE_AUTOMATION_SSH_PRIVATE_KEY |
145+
+-----------------------------------+----------------------------------------------+
146+
| KAYOBE_VAULT_PASSWORD | <ENV_NAME>_KAYOBE_VAULT_PASSWORD |
147+
+-----------------------------------+----------------------------------------------+
148+
| REGISTRY_PASSWORD | <ENV_NAME>_REGISTRY_PASSWORD |
149+
+-----------------------------------+----------------------------------------------+
150+
| TEMPEST_OPENRC | <ENV_NAME>_TEMPEST_OPENRC |
151+
+-----------------------------------+----------------------------------------------+
152+
153+
+-------------------------------------------------------+
154+
| VARIABLES |
155+
+====================+==================================+
156+
| Single Environment | Multiple Environments |
157+
+--------------------+----------------------------------+
158+
| REGISTRY_URL | <ENV_NAME>_REGISTRY_URL |
159+
+--------------------+----------------------------------+
160+
| REGISTRY_USERNAME | <ENV_NAME>_REGISTRY_USERNAME |
161+
+--------------------+----------------------------------+
162+
163+
Note the above tables shows the secrets and variables one may need to add to GitHub for a successful deployment.
164+
When adding secrets and variables make sure to adhere to the naming standards and ensure the :code:`<ENV_NAME>` is replaced with all supported kayobe environments in uppercase.
165+
166+
4. Commit and push all newly generated workflows found under :code:`.github/workflows`
167+
168+
Final Steps
169+
-----------
170+
171+
Some final steps include the following: running config-diff will require that :code:`.automation.conf/config.sh` contains a list :code:`KAYOBE_CONFIG_VAULTED_FILES_PATHS_EXTRA` of all vaulted files contained within the config.
172+
All such files can be found with :code:`grep -r "$ANSIBLE_VAULT;1.1;AES256" .` though make sure NOT to include `kolla/passwords.yml` and `secrets.yml`
173+
Also make sure tempest has been configured appropriately in :code:`.automation.conf/config.sh` to meet the limitations of a given deployment such as not using a too high of :code:`TEMPEST_CONCURRENCY` value and that overrides and load/skips lists are correct.
174+
Finally, once all the workflows and configuration has been pushed and reviewed you can build a kayobe image using the `Build Kayobe Docker Image` workflow. Once it is successfully built and pushed to a container registry, other workflows can be used.
175+
176+
Sometimes the kayobe docker image must be rebuilt the reasons for this include but are not limited to the following;
177+
178+
* Change :code:`$KAYOBE_CONFIG_PATH/ansible/requirements.yml`
179+
* Change to requirements.txt
180+
* Update Kayobe
181+
* Update kolla-ansible
182+
* UID/GID collision when deploying workflows to a new environment
183+
* Prior to deployment of new a OpenStack release

doc/source/configuration/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ the various features provided.
1818
wazuh
1919
vault
2020
magnum-capi
21+
ci-cd
2122
security-hardening

doc/source/operations/rocky-linux-9.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,17 @@ Make the following changes to your Kayobe configuration:
8383
hw_machine_type = x86_64=q35
8484
num_pcie_ports = 16
8585
86-
This change does not need to be applied before migrating to Rocky Linux 9, but it should cause no harm to do so.
87-
Note that this will not affect existing VMs, only newly created VMs.
86+
This change does not need to be applied before migrating to Rocky Linux 9,
87+
but it is likely the best time to do so.
88+
89+
.. warning::
90+
91+
This change will cause the interface names to change on any new VMs
92+
launched with images that do not specify a hw_machine_type already.
93+
Existing VMs will not be affected, but a rebuild will have the names
94+
changed. Customers should be informed of this in case they have any
95+
tooling that relies on interface names within their VMs.
96+
8897

8998
Routing rules
9099
-------------

doc/source/operations/secret-rotation.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,12 @@ Full method
370370
371371
kayobe overcloud service deploy
372372
373-
20. Manually update ``heat_domain_admin_password``
373+
20. Manually update ``heat_domain_admin_password``, using the newly generated
374+
OpenStack Admin credentials.
374375

375-
#. TODO: Instructions
376-
This has not been tested yet
376+
.. code:: bash
377+
378+
openstack user set --domain heat_user_domain --password <password> heat_domain_admin
377379
378380
21. Re-run Tempest to make sure everything has come back
379381

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
- name: Deploy GitHub Runner
3+
hosts: github-runners
4+
become: yes
5+
roles:
6+
- role: geerlingguy.pip
7+
- role: geerlingguy.docker
8+
tasks:
9+
- name: Deploy runners
10+
ansible.builtin.include_role:
11+
role: monolithprojects.github_actions_runner
12+
vars:
13+
runner_name: "{{ ansible_facts.nodename }}-{{ runner.key }}"
14+
runner_dir: "{{ base_runner_dir }}/{{ runner.key }}"
15+
runner_labels: "{{ runner.value.labels | default(default_runner_labels) }}"
16+
runner_state: "{{ runner.value.state | default('started') }}"
17+
with_dict:
18+
"{{ github_runners }}"
19+
loop_control:
20+
loop_var: runner
21+
22+
# FIXME: Sometimes the runner service is not running at the end of the role.
23+
# Start the service manually.
24+
- name: Ensure runner service is running
25+
ansible.builtin.service:
26+
name: actions.runner.{{ github_account }}-{{ github_repo }}.{{ ansible_facts.nodename }}-{{ runner.key }}.service
27+
state: started
28+
enabled: true
29+
become: true
30+
when: runner_state | default('started') == 'started'
31+
with_dict:
32+
"{{ github_runners }}"
33+
loop_control:
34+
loop_var: runner

0 commit comments

Comments
 (0)