Skip to content

Commit 5d2b917

Browse files
committed
Make build arch definition flexible
1 parent 2ac0387 commit 5d2b917

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

etc/kayobe/kolla.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ kolla_ansible_source_version: "{{ stackhpc_kolla_ansible_source_version }}"
6262
###############################################################################
6363
# Kolla configuration.
6464

65+
66+
# Kolla base container image architecture. Options are "x86_64", "aarch64".
67+
# Default is "{{ ansible_facts.architecture }}"
68+
# NOTE(bbezak): evaluating this var locally for non facts gathering playbooks
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+
}}
75+
6576
# Kolla base container image distribution. Options are "centos", "debian",
6677
# "rocky", "ubuntu". Default is {{ os_distribution }}.
6778
#kolla_base_distro:
@@ -430,11 +441,6 @@ kolla_build_customizations: "{{ kolla_build_customizations_common | combine(koll
430441
# Dict mapping Kolla Dockerfile ARG names to their values.
431442
kolla_build_args: {}
432443

433-
###############################################################################
434-
# Kolla platform architecture configuration.
435-
436-
kolla_base_arch: "{{ 'aarch64' if stackhpc_cpu_arch == 'arm64' else stackhpc_cpu_arch }}"
437-
438444
###############################################################################
439445
# Kolla-ansible inventory configuration.
440446

etc/kayobe/stackhpc.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@ stackhpc_include_os_minor_version_in_repo_url: false
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

3030
# Pick build architecture for kolla and disk image builder
31-
# Choose between x86_64 or arm64
32-
stackhpc_cpu_arch: 'x86_64'
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 }}"
3338

3439
###############################################################################
3540
# Debs

0 commit comments

Comments
 (0)