Skip to content

Commit c354701

Browse files
MaxBed4dcityofships
authored andcommitted
Add DiB variables to allow platform architecture choice #1497
1 parent 443214e commit c354701

File tree

8 files changed

+89
-32
lines changed

8 files changed

+89
-32
lines changed

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

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ on:
1818
options:
1919
- SMS Lab
2020
- Leafcloud
21+
cpu-platform-architecture:
22+
description: Select the image's build architecture
23+
type: choice
24+
default: x86_64
25+
options:
26+
- x86_64
27+
- aarch64
2128
secrets:
2229
KAYOBE_VAULT_PASSWORD:
2330
required: true
@@ -32,6 +39,9 @@ env:
3239
ANSIBLE_FORCE_COLOR: True
3340
KAYOBE_ENVIRONMENT: ci-builder
3441
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
42+
overcloud_dib_architecture: ${{ inputs.cpu-platform-architecture == 'x86_64' && 'amd64' || 'arm64' }}
43+
stackhpc_cpu_arch_override: ${{ inputs.cpu-platform-architecture == 'aarch64' && 'arm64' || 'x86_64' }}
44+
pulp_artifact_type: ${{ inputs.cpu-platform-architecture == 'x86_64' && 'kayobe-images' || 'kayobe-images/aarch64' }}
3545
jobs:
3646
runner-selection:
3747
uses: ./.github/workflows/runner-selector.yml
@@ -212,7 +222,7 @@ jobs:
212222
source venvs/kayobe/bin/activate &&
213223
source src/kayobe-config/kayobe-env --environment ci-builder &&
214224
kayobe seed host command run \
215-
--command "sudo apt update && sudo apt -y install gcc git libffi-dev python3-dev python-is-python3 python3-venv containerd docker.io docker-buildx" --show-output
225+
--command "sudo apt update && sudo apt -y install gcc git libffi-dev python3-dev python-is-python3 python3-venv containerd docker.io docker-buildx qemu-user-static" --show-output
216226
env:
217227
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
218228

@@ -233,7 +243,8 @@ jobs:
233243
kayobe overcloud host image build --force-rebuild \
234244
-e os_distribution="rocky" \
235245
-e os_release="9" \
236-
-e stackhpc_overcloud_dib_name=overcloud-rocky-9
246+
-e stackhpc_overcloud_dib_name=overcloud-rocky-9 \
247+
-e overcloud_dib_architecture=${{ inputs.cpu-platform-architecture == 'x86_64' && 'amd64' || 'aarch64' }}
237248
env:
238249
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
239250
if: inputs.rocky9
@@ -256,7 +267,7 @@ jobs:
256267
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
257268
-e artifact_path=/opt/kayobe/images/overcloud-rocky-9 \
258269
-e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
259-
-e artifact_type="kayobe-images" \
270+
-e artifact_type=${{ env.pulp_artifact_type }} \
260271
-e file_regex="*.qcow2" \
261272
-e os_distribution="rocky" \
262273
-e os_release="9"
@@ -271,7 +282,8 @@ jobs:
271282
kayobe playbook run \
272283
src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \
273284
-e local_image_path="/opt/kayobe/images/overcloud-rocky-9/overcloud-rocky-9.qcow2" \
274-
-e image_name=overcloud-rocky-9-${{ steps.host_image_tag.outputs.host_image_tag }}
285+
-e image_name=overcloud-rocky-9-${{ steps.host_image_tag.outputs.host_image_tag }} \
286+
-e cpu_platform=${{ env.overcloud_dib_architecture }}
275287
env:
276288
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }}
277289
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
@@ -285,7 +297,8 @@ jobs:
285297
kayobe playbook run \
286298
src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \
287299
-e local_image_path="/opt/kayobe/images/overcloud-rocky-9/overcloud-rocky-9.qcow2" \
288-
-e image_name=overcloud-rocky-9-${{ steps.host_image_tag.outputs.host_image_tag }}
300+
-e image_name=overcloud-rocky-9-${{ steps.host_image_tag.outputs.host_image_tag }} \
301+
-e cpu_platform=${{ env.overcloud_dib_architecture }}
289302
env:
290303
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML_OTHER_CLOUD }}
291304
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID_OTHER_CLOUD }}
@@ -301,7 +314,8 @@ jobs:
301314
kayobe overcloud host image build --force-rebuild \
302315
-e os_distribution="ubuntu" \
303316
-e os_release="noble" \
304-
-e stackhpc_overcloud_dib_name=overcloud-ubuntu-noble
317+
-e stackhpc_overcloud_dib_name=overcloud-ubuntu-noble \
318+
-e overcloud_dib_architecture=${{ inputs.cpu-platform-architecture == 'x86_64' && 'amd64' || 'aarch64' }}
305319
env:
306320
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
307321
if: inputs.ubuntu-noble
@@ -324,7 +338,7 @@ jobs:
324338
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
325339
-e artifact_path=/opt/kayobe/images/overcloud-ubuntu-noble \
326340
-e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
327-
-e artifact_type="kayobe-images" \
341+
-e artifact_type=${{ env.pulp_artifact_type }} \
328342
-e file_regex="*.qcow2" \
329343
-e os_distribution="ubuntu" \
330344
-e os_release="noble"
@@ -339,7 +353,8 @@ jobs:
339353
kayobe playbook run \
340354
src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \
341355
-e local_image_path="/opt/kayobe/images/overcloud-ubuntu-noble/overcloud-ubuntu-noble.qcow2" \
342-
-e image_name=overcloud-ubuntu-noble-${{ steps.host_image_tag.outputs.host_image_tag }}
356+
-e image_name=overcloud-ubuntu-noble-${{ steps.host_image_tag.outputs.host_image_tag }} \
357+
-e cpu_platform=${{ env.overcloud_dib_architecture }}
343358
env:
344359
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }}
345360
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
@@ -353,7 +368,8 @@ jobs:
353368
kayobe playbook run \
354369
src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \
355370
-e local_image_path="/opt/kayobe/images/overcloud-ubuntu-noble/overcloud-ubuntu-noble.qcow2" \
356-
-e image_name=overcloud-ubuntu-noble-${{ steps.host_image_tag.outputs.host_image_tag }}
371+
-e image_name=overcloud-ubuntu-noble-${{ steps.host_image_tag.outputs.host_image_tag }} \
372+
-e cpu_platform=${{ env.overcloud_dib_architecture }}
357373
env:
358374
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML_OTHER_CLOUD }}
359375
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID_OTHER_CLOUD }}

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,17 @@ on:
1515
description: Tag to promote
1616
type: string
1717
required: true
18+
cpu-platform-architecture:
19+
description: What is the tagged image's architecture
20+
type: choice
21+
required: true
22+
default: x86_64
23+
options:
24+
- x86_64
25+
- aarch64
1826
env:
1927
ANSIBLE_FORCE_COLOR: True
28+
pulp_artifact_type: ${{ inputs.cpu-platform-architecture == 'x86_64' && 'kayobe-images' || 'kayobe-images/aarch64' }}
2029
jobs:
2130
overcloud-host-image-promote:
2231
name: Promote overcloud host image
@@ -77,7 +86,7 @@ jobs:
7786
source src/kayobe-config/kayobe-env --environment ci-builder &&
7887
kayobe playbook run \
7988
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-promote.yml \
80-
-e artifact_type="kayobe-images" \
89+
-e artifact_type=${{ env.pulp_artifact_type }} \
8190
-e os_distribution='rocky' \
8291
-e os_release='9'
8392
env:
@@ -91,7 +100,7 @@ jobs:
91100
source src/kayobe-config/kayobe-env --environment ci-builder &&
92101
kayobe playbook run \
93102
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-promote.yml \
94-
-e artifact_type="kayobe-images" \
103+
-e artifact_type=${{ env.pulp_artifact_type }} \
95104
-e os_distribution='ubuntu' \
96105
-e os_release='noble'
97106
env:

etc/kayobe/ansible/openstack-host-image-upload.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
hosts: seed
77
vars:
88
local_image_path: /opt/kayobe/images/overcloud-{{ os_distribution }}-{{ os_release }}/overcloud-{{ os_distribution }}-{{ os_release }}.qcow2
9-
image_name: overcloud-{{ os_distribution }}-{{ os_release }}
9+
image_name: overcloud-{{ os_distribution }}-{{ os_release }}{{ '-arm64' if cpu_platform == 'arm64' else '' }}
1010
tasks:
1111
- name: Upload image to Glance
1212
block:
@@ -42,6 +42,8 @@
4242
disk_format: qcow2
4343
state: present
4444
filename: "{{ local_image_path }}"
45+
properties:
46+
hw_architecture: "{{ 'aarch64' if cpu_platform == 'arm64' else 'x86_64' }}"
4547

4648
always:
4749
- name: Remove clouds.yaml

etc/kayobe/kolla.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,16 @@ kolla_ansible_source_version: "{{ stackhpc_kolla_ansible_source_version }}"
6262
###############################################################################
6363
# Kolla configuration.
6464

65+
6566
# Kolla base container image architecture. Options are "x86_64", "aarch64".
6667
# Default is "{{ ansible_facts.architecture }}"
6768
# NOTE(bbezak): evaluating this var locally for non facts gathering playbooks
68-
kolla_base_arch: "{{ 'aarch64' if lookup('pipe','uname -m') in ['aarch64','arm64'] else 'x86_64' }}"
69+
kolla_base_arch: >-
70+
{{
71+
'aarch64' if (stackhpc_cpu_arch_override is defined and stackhpc_cpu_arch_override | length > 0 and stackhpc_cpu_arch_override == 'arm64')
72+
else (stackhpc_cpu_arch_override if (stackhpc_cpu_arch_override is defined and stackhpc_cpu_arch_override | length > 0)
73+
else ('aarch64' if lookup('pipe','uname -m') in ['aarch64','arm64'] else 'x86_64'))
74+
}}
6975
7076
# Kolla base container image distribution. Options are "centos", "debian",
7177
# "rocky", "ubuntu". Default is {{ os_distribution }}.

etc/kayobe/overcloud-dib.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ overcloud_dib_host_packages_extra:
6666
# elements. See stackhpc.openstack.os_images role for usage. Default is empty.
6767
overcloud_dib_git_elements_extra: "{{ stackhpc_dib_image_elements_repos }}"
6868

69+
# Selects the architecture of the overcloud host image being built.
70+
overcloud_dib_architecture: "{{ 'amd64' if stackhpc_cpu_arch == 'x86_64' else 'arm64' }}"
71+
6972
# List of git repositories containing Diskimage Builder (DIB) elements. See
7073
# stackhpc.openstack.os_images role for usage. Default is a combination of
7174
# overcloud_dib_git_elements_default and overcloud_dib_git_elements_extra.

etc/kayobe/stackhpc-overcloud-dib.yml

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ stackhpc_overcloud_dib_host_image:
1515
elements: "{{ stackhpc_overcloud_dib_elements }}"
1616
env: "{{ stackhpc_overcloud_dib_env_vars }}"
1717
packages: "{{ stackhpc_overcloud_dib_packages }}"
18+
architecture: "{{ overcloud_dib_architecture }}"
1819

1920
# StackHPC overcloud DIB image name.
2021
stackhpc_overcloud_dib_name: "deployment_image"
@@ -55,6 +56,7 @@ stackhpc_overcloud_dib_env_vars_default:
5556
YUM: dnf
5657
# Workaround for stack user home ownership bug
5758
DIB_IMAGE_CACHE: "/tmp/yum"
59+
DIB_CONTAINERFILE_BUILDOPTS: "--platform linux/{{ overcloud_dib_architecture }}"
5860

5961
stackhpc_overcloud_dib_env_vars_ark:
6062
DIB_CONTAINERFILE_BUILDOPTS: >-
@@ -63,25 +65,34 @@ stackhpc_overcloud_dib_env_vars_ark:
6365
DIB_DISTRIBUTION_MIRROR: "{{ stackhpc_repo_ubuntu_noble_url if os_distribution == 'ubuntu' else '' }}"
6466

6567
# StackHPC overcloud DIB image packages.
66-
stackhpc_overcloud_dib_packages:
67-
- "ethtool"
68-
- "git"
69-
- "less"
70-
- "logrotate"
71-
- "net-tools"
72-
- "nvme-cli"
73-
- "pciutils"
74-
- "python3"
75-
- "smartmontools"
76-
- "vim"
77-
- "{% if os_distribution == 'ubuntu' %}netbase{% endif %}"
78-
- "{% if os_distribution == 'ubuntu' %}iputils-ping{% endif %}"
79-
- "{% if os_distribution == 'ubuntu' %}curl{% endif %}"
80-
- "{% if os_distribution == 'ubuntu' %}apt-utils{% endif %}"
81-
- "{% if os_distribution == 'rocky' %}NetworkManager-config-server{% endif %}"
82-
- "{% if os_distribution == 'rocky' %}linux-firmware{% endif %}"
83-
- "{% if os_distribution == 'rocky' %}cloud-utils-growpart{% endif %}"
84-
- "{% if os_distribution == 'ubuntu' %}cloud-guest-utils{% endif %}"
68+
stackhpc_overcloud_dib_packages_common:
69+
- ethtool
70+
- git
71+
- less
72+
- logrotate
73+
- net-tools
74+
- nvme-cli
75+
- pciutils
76+
- python3
77+
- smartmontools
78+
- vim
79+
80+
stackhpc_overcloud_dib_packages_ubuntu:
81+
- netbase
82+
- iputils-ping
83+
- curl
84+
- apt-utils
85+
- cloud-guest-utils
86+
87+
stackhpc_overcloud_dib_packages_rocky:
88+
- NetworkManager-config-server
89+
- linux-firmware
90+
- cloud-utils-growpart
91+
92+
stackhpc_overcloud_dib_packages: >-
93+
{{ stackhpc_overcloud_dib_packages_common +
94+
(stackhpc_overcloud_dib_packages_ubuntu if os_distribution == 'ubuntu' else []) +
95+
(stackhpc_overcloud_dib_packages_rocky if os_distribution == 'rocky' else []) }}
8596
8697
# StackHPC overcloud DIB image block device configuration.
8798
# This image layout conforms to the CIS partition benchmarks.

etc/kayobe/stackhpc-overcloud-host-images.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ stackhpc_build_overcloud_image_from_pulp_package_mirrors: false
1111
# The overcloud host image source, defined by os_distribution, os_release,
1212
# and the current stable version.
1313
stackhpc_overcloud_host_image_url: "{{ stackhpc_release_pulp_content_url_with_auth }}/kayobe-images/\
14+
{{ 'aarch64/' if stackhpc_cpu_arch == 'arm64' else '' }}\
1415
{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}/\
1516
{{ stackhpc_overcloud_host_image_version }}/\
1617
overcloud-{{ os_distribution }}-{{ os_release }}.qcow2"

etc/kayobe/stackhpc.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ stackhpc_include_os_minor_version_in_repo_url: false
2727

2828
stackhpc_rocky_9_url_version: "{{ '9.' + stackhpc_pulp_repo_rocky_9_minor_version | string if stackhpc_include_os_minor_version_in_repo_url | bool else '9' }}"
2929

30+
# Pick build architecture for kolla and disk image builder
31+
# Choose between x86_64 or arm64. Leaving unset will default
32+
# to the local architecture.
33+
stackhpc_cpu_arch_override: ""
34+
35+
# If the override variable hasnt been set above then both kolla_base_arch and
36+
# stackhpc_cpu_arch will default to the local architecture.
37+
stackhpc_cpu_arch: "{{ 'arm64' if kolla_base_arch == 'aarch64' else kolla_base_arch }}"
38+
3039
###############################################################################
3140
# Debs
3241
# Ubuntu noble

0 commit comments

Comments
 (0)