Skip to content

Commit 5114b09

Browse files
authored
Merge pull request #1287 from stackhpc/2024.1-2023.1-merge
2024.1: 2023.1 merge
2 parents c28bb98 + 06d6ca3 commit 5114b09

19 files changed

+280
-22
lines changed

.github/path-filters.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is a list of path filters for the PR workflow in .github/workflows/stackhpc-pull-request.yml.
2-
aio:
2+
aio: &aio
33
- '.automation'
44
- '.automation.conf/config.sh'
55
- '.automation.conf/tempest/load-lists/default'
@@ -20,6 +20,11 @@ aio:
2020
- 'kayobe-env'
2121
- 'requirements.txt'
2222
- 'terraform/aio/**'
23-
check-tags:
23+
check-tags: &check-tags
2424
- '.github/workflows/stackhpc-check-tags.yml'
2525
- 'etc/kayobe/kolla-image-tags.yml'
26+
- 'etc/kayobe/pulp.yml'
27+
- 'tools/kolla-images.py'
28+
build-kayobe-image:
29+
- *aio
30+
- *check-tags

.github/workflows/multinode-inputs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class Scenario:
3333
UBUNTU_JAMMY = OSRelease("ubuntu", "jammy", "ubuntu")
3434
# NOTE(upgrade): Add supported releases here.
3535
OPENSTACK_RELEASES = [
36-
OpenStackRelease("2023.1", "zed", [ROCKY_9, UBUNTU_JAMMY])
36+
OpenStackRelease("2024.1", "2023.1", [ROCKY_9, UBUNTU_JAMMY]),
37+
OpenStackRelease("2023.1", "zed", [ROCKY_9, UBUNTU_JAMMY]),
3738
]
3839
NEUTRON_PLUGINS = ["ovs", "ovn"]
3940

.github/workflows/stackhpc-check-tags.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ jobs:
4646
run: |
4747
docker image pull $KAYOBE_IMAGE
4848
49+
- name: Check kolla-images.py image map and tag hierarchy
50+
run: |
51+
docker run -t --rm \
52+
-v $(pwd):/stack/kayobe-automation-env/src/kayobe-config \
53+
-e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY \
54+
$KAYOBE_IMAGE \
55+
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh \
56+
'$KAYOBE_CONFIG_PATH/ansible/check-kolla-images-py.yml'
57+
4958
- name: Check container image tags
5059
run: |
5160
docker run -t --rm \

.github/workflows/stackhpc-multinode-periodic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
name: Multinode periodic
3636
needs:
3737
- generate-inputs
38-
uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@1.0.1
38+
uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@1.1.0
3939
with:
4040
multinode_name: mn-prdc-${{ github.run_id }}
4141
os_distribution: ${{ needs.generate-inputs.outputs.os_distribution }}

.github/workflows/stackhpc-multinode.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ name: Multinode
5252
jobs:
5353
multinode:
5454
name: Multinode
55-
uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@1.0.1
55+
uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@1.1.0
5656
with:
5757
multinode_name: ${{ inputs.multinode_name }}
5858
os_distribution: ${{ inputs.os_distribution }}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
2121
outputs:
2222
aio: ${{ steps.changes.outputs.aio }}
23+
build-kayobe-image: ${{ steps.changes.outputs.build-kayobe-image }}
2324
check-tags: ${{ steps.changes.outputs.check-tags }}
2425
steps:
2526
- name: GitHub Checkout
@@ -74,7 +75,7 @@ jobs:
7475
- check-changes
7576
uses: ./.github/workflows/stackhpc-build-kayobe-image.yml
7677
with:
77-
if: ${{ needs.check-changes.outputs.aio == 'true' }}
78+
if: ${{ needs.check-changes.outputs.build-kayobe-image == 'true' }}
7879
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
7980

8081
check-tags:
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
- name: Check kolla-images.py image map and tag hierarchy
3+
hosts: localhost
4+
gather_facts: false
5+
tasks:
6+
- name: Create a temporary directory
7+
ansible.builtin.tempfile:
8+
state: directory
9+
suffix: kolla-ansible
10+
register: tempdir_result
11+
12+
- name: Clone Kolla Ansible repository
13+
ansible.builtin.git:
14+
repo: "{{ stackhpc_kolla_ansible_source_url }}"
15+
version: "{{ stackhpc_kolla_ansible_source_version }}"
16+
dest: "{{ tempdir_result.path }}"
17+
18+
- name: Check image mapping
19+
ansible.builtin.command:
20+
cmd: >-
21+
{{ kayobe_config_path }}/../../tools/kolla-images.py
22+
check-image-map
23+
--kolla-ansible-path {{ tempdir_result.path }}
24+
25+
- name: Check tag hierarchy
26+
ansible.builtin.command:
27+
cmd: >-
28+
{{ kayobe_config_path }}/../../tools/kolla-images.py
29+
check-hierarchy
30+
--kolla-ansible-path {{ tempdir_result.path }}
31+
32+
- name: Remove temporary directory
33+
ansible.builtin.file:
34+
path: "{{ tempdir_result.path }}"
35+
state: absent

etc/kayobe/ansible/check-tags.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- name: Check whether tags exist in Pulp container registry
66
hosts: localhost
7+
gather_facts: false
78
tasks:
89
- name: Query images and tags
910
command:

etc/kayobe/ansible/fix-hostname.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,10 @@
2121
cmd: hostnamectl set-hostname "{{ inventory_hostname }}"
2222
when: current_hostname.stdout != inventory_hostname
2323
become: true
24+
25+
- name: Reboot hosts
26+
import_playbook: "{{ playbook_dir | realpath }}/reboot.yml"
27+
vars:
28+
reboot_hosts: fix-hostname
29+
reboot_with_bootstrap_user: true
30+
when: current_hostname.stdout != inventory_hostname

etc/kayobe/ansible/growroot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
vars:
7676
pv: "{{ pvs.stdout | from_json }}"
7777
disk_tmp: "{{ pv.report[0].pv[0].pv_name[:-1] }}"
78-
disk: "{{ disk_tmp[:-1] if disk_tmp[-1] == 'p' and disk_tmp[:9] == '/dev/nvme' else disk_tmp }}"
78+
disk: "{{ disk_tmp[:-1] if pv.report[0].pv[0].pv_name | regex_search('[a-z0-9]+[0-9]+p[0-9]+') else disk_tmp }}"
7979
part_num: "{{ pv.report[0].pv[0].pv_name[-1] }}"
8080
become: true
8181
failed_when: "growpart.rc != 0 and 'NOCHANGE' not in growpart.stdout"

etc/kayobe/ansible/reboot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Reboot the host
3-
hosts: seed-hypervisor:seed:overcloud:infra-vms
3+
hosts: "{{ reboot_hosts | default('seed-hypervisor:seed:overcloud:infra-vms') }}"
44
serial: "{{ lookup('env', 'ANSIBLE_SERIAL') | default(1, true) }}"
55
gather_facts: false
66
vars:

etc/kayobe/ansible/vault-generate-backend-tls.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- name: Generate backend API certificates
1919
hosts: controllers:network
2020
vars:
21-
vault_api_addr: "https://{{ internal_net_name | net_ip }}:8200"
21+
vault_api_addr: "https://{{ internal_net_name | net_ip(groups['controllers'][0]) }}:8200"
2222
vault_intermediate_ca_name: "OS-TLS-INT"
2323
tasks:
2424
- name: Set a fact about the virtualenv on the remote system
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../ansible/fix-hostname.yml

etc/kayobe/environments/ci-multinode/inventory/groups

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
controllers
66

77
[fix-hostname:children]
8-
storage
8+
overcloud

etc/kayobe/kolla/inventory/group_vars/prometheus-blackbox-exporter

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
# prometheus_blackbox_exporter_endpoints_kayobe is another set of default
77
# endpoints that are templated by Kayobe rather than Kolla Ansible. See
88
# kolla/globals.yml for more details.
9-
prometheus_blackbox_exporter_endpoints: >-
10-
{{ (prometheus_blackbox_exporter_endpoints_kayobe | default([]) +
11-
prometheus_blackbox_exporter_endpoints_default) |
12-
selectattr('enabled', 'true') |
13-
map(attribute='endpoints') | flatten |
14-
union(prometheus_blackbox_exporter_endpoints_custom) |
15-
unique | select | list }}
9+
prometheus_blackbox_exporter_endpoints: |
10+
{% set endpoints = [] %}
11+
{% for dict_item in (prometheus_blackbox_exporter_endpoints_kayobe | default([]) + prometheus_blackbox_exporter_endpoints_default) %}
12+
{% if dict_item.enabled | bool %}
13+
{% for endpoint in dict_item.endpoints %}
14+
{% set _ = endpoints.append(endpoint) %}
15+
{% endfor %}
16+
{% endif %}
17+
{% endfor %}
18+
{{ (endpoints + prometheus_blackbox_exporter_endpoints_custom) | unique | select | list }}
1619

1720
# A list of custom prometheus Blackbox exporter endpoints. Each element should
1821
# have the following format:
@@ -125,7 +128,7 @@ prometheus_blackbox_exporter_endpoints_default:
125128
- endpoints:
126129
- "prometheus_alertmanager:http_2xx_alertmanager:{{ prometheus_alertmanager_public_endpoint if enable_prometheus_alertmanager_external else prometheus_alertmanager_internal_endpoint }}"
127130
enabled: "{{ enable_prometheus_alertmanager | bool }}"
128-
- endpoints: "{% set rabbitmq_endpoints = [] %}{% for host in groups.get('rabbitmq', []) %}{{ rabbitmq_endpoints.append('rabbitmq_' + host.replace('-', '') + (':tls_connect:' if rabbitmq_enable_tls else ':tcp_connect:') + ('api' | kolla_address(host) | put_address_in_context('url')) + ':' + hostvars[host]['rabbitmq_port'] ) }}{% endfor %}{{ rabbitmq_endpoints }}"
131+
- endpoints: "{% set rabbitmq_endpoints = [] %}{% for host in groups.get('rabbitmq', []) %}{{ rabbitmq_endpoints.append('rabbitmq_' + host.replace('-', '') + (':tls_connect:' if rabbitmq_enable_tls | bool else ':tcp_connect:') + ('api' | kolla_address(host) | put_address_in_context('url')) + ':' + hostvars[host]['rabbitmq_port'] ) }}{% endfor %}{{ rabbitmq_endpoints }}"
129132
enabled: "{{ enable_rabbitmq | bool }}"
130133
- endpoints: "{% set redis_endpoints = [] %}{% for host in groups.get('redis', []) %}{{ redis_endpoints.append('redis_' + host.replace('-', '') + ':tcp_connect:' + ('api' | kolla_address(host) | put_address_in_context('url')) + ':' + hostvars[host]['redis_port']) }}{% endfor %}{{ redis_endpoints }}"
131134
enabled: "{{ enable_redis | bool }}"
@@ -146,7 +149,7 @@ heat_cfn_internal_base_endpoint: "{{ heat_cfn_internal_fqdn | kolla_url(internal
146149
heat_cfn_public_base_endpoint: "{{ heat_cfn_external_fqdn | kolla_url(public_protocol, heat_api_cfn_public_port) }}"
147150
heat_internal_base_endpoint: "{{ heat_internal_fqdn | kolla_url(internal_protocol, heat_api_port) }}"
148151
heat_public_base_endpoint: "{{ heat_external_fqdn | kolla_url(public_protocol, heat_api_public_port) }}"
149-
horizon_public_endpoint: "{{ horizon_external_fqdn | kolla_url(public_protocol, horizon_listen_port) }}"
152+
horizon_public_endpoint: "{{ horizon_external_fqdn | kolla_url(public_protocol, horizon_tls_port if kolla_enable_tls_external | bool else horizon_port) }}"
150153
ironic_inspector_internal_endpoint: "{{ ironic_inspector_internal_fqdn | kolla_url(internal_protocol, ironic_inspector_port) }}"
151154
ironic_inspector_public_endpoint: "{{ ironic_inspector_external_fqdn | kolla_url(public_protocol, ironic_inspector_public_port) }}"
152155
magnum_internal_base_endpoint: "{{ magnum_internal_fqdn | kolla_url(internal_protocol, magnum_api_port) }}"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
security:
3+
- |
4+
Fixes `CVE-2024-44082
5+
<https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-44082>`_ with updated
6+
container images for Ironic services. Note that Ironic Python Agent images
7+
also need to be updated to fully fix this vulnerability. If this is not
8+
possible, a new configuration option
9+
``[conductor]conductor_always_validates_images`` is available. See the
10+
`OSSA-2024-003 description
11+
<https://security.openstack.org/ossa/OSSA-2024-003.html>`_ for more
12+
details.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes a regression when using ``growroot.yml`` and software raid where the
5+
playbook would fail to identify the correct disk.

tools/kolla-images.py

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,20 @@
3939

4040
# Maps a Kolla image to a list of containers that use the image.
4141
IMAGE_TO_CONTAINERS_EXCEPTIONS: Dict[str, List[str]] = {
42+
"dnsmasq": [
43+
"ironic_dnsmasq",
44+
],
4245
"haproxy": [
4346
"glance_tls_proxy",
47+
"haproxy",
4448
"neutron_tls_proxy",
4549
],
46-
"neutron-eswitchd": [
50+
"mariadb-server": [
51+
"mariadb",
52+
"mariabackup",
53+
],
54+
"neutron-mlnx-agent": [
55+
"neutron_eswitchd",
4756
"neutron_mlnx_agent",
4857
],
4958
"neutron-metadata-agent": [
@@ -54,6 +63,15 @@
5463
"nova_super_conductor",
5564
"nova_conductor",
5665
],
66+
"openvswitch-db-server": [
67+
"openvswitch_db",
68+
],
69+
"ovn-nb-db-server": [
70+
"ovn_nb_db",
71+
],
72+
"ovn-sb-db-server": [
73+
"ovn_sb_db",
74+
],
5775
"prometheus-v2-server": [
5876
"prometheus_server",
5977
],
@@ -91,6 +109,9 @@ def parse_args() -> argparse.Namespace:
91109
parser.add_argument("--base-distros", default=",".join(SUPPORTED_BASE_DISTROS), choices=SUPPORTED_BASE_DISTROS)
92110
subparsers = parser.add_subparsers(dest="command", required=True)
93111

112+
subparser = subparsers.add_parser("check-image-map", help="Check image mapping against kolla-ansible")
113+
subparser.add_argument("--kolla-ansible-path", required=True, help="Path to kolla-ansible repostory checked out to correct branch")
114+
94115
subparser = subparsers.add_parser("check-hierarchy", help="Check tag variable hierarchy against kolla-ansible")
95116
subparser.add_argument("--kolla-ansible-path", required=True, help="Path to kolla-ansible repostory checked out to correct branch")
96117

@@ -109,7 +130,7 @@ def parse_args() -> argparse.Namespace:
109130
return parser.parse_args()
110131

111132

112-
def get_abs_path(relative_path: str) -> str:
133+
def get_abs_path(relative_path: str) -> pathlib.Path:
113134
"""Return the absolute path of a file in SKC."""
114135
script_path = pathlib.Path(inspect.getfile(inspect.currentframe()))
115136
return script_path.parent.parent / relative_path
@@ -272,6 +293,45 @@ def check_tags(base_distros: List[str], kolla_image_tags: KollaImageTags, regist
272293
sys.exit(1)
273294

274295

296+
def check_image_map(kolla_ansible_path: str):
297+
"""Check the image mapping against Kolla Ansible variables.
298+
299+
The *_image variables in Kolla Ansible define the mapping between
300+
containers and images. Ensure that the mapping defined in this script
301+
matches the one in Kolla Ansible.
302+
"""
303+
supported_images = read_images("etc/kayobe/pulp.yml")
304+
assert supported_images
305+
# Build a map from container to image name.
306+
cmd = """git grep -h '^[a-z0-9_]*_image:' ansible/roles/*/defaults/main.yml"""
307+
image_map_str = subprocess.check_output(cmd, shell=True, cwd=os.path.realpath(kolla_ansible_path))
308+
image_map = yaml.safe_load(image_map_str)
309+
image_var_re = re.compile(r"^([a-z0-9_]+)_image$")
310+
image_map = {
311+
image_var_re.match(image_var).group(1): image.split("/")[-1]
312+
for image_var, image in image_map.items()
313+
}
314+
# Filter out unsupported images.
315+
image_map = {
316+
container: image
317+
for container, image in image_map.items()
318+
if image in supported_images
319+
}
320+
assert image_map
321+
errors = []
322+
# Check that our mapping is correct.
323+
for container, image in image_map.items():
324+
containers = get_containers(image)
325+
if container not in containers:
326+
errors.append((container, image))
327+
if errors:
328+
print("Errors:")
329+
for tag_var, image in errors:
330+
print(f"Expected {tag_var} container to use {image} image")
331+
if errors:
332+
sys.exit(1)
333+
334+
275335
def check_hierarchy(kolla_ansible_path: str):
276336
"""Check the tag variable hierarchy against Kolla Ansible variables."""
277337
cmd = """git grep -h '^[a-z0-9_]*_tag:' ansible/roles/*/defaults/main.yml"""
@@ -347,7 +407,9 @@ def main():
347407

348408
validate(kolla_image_tags)
349409

350-
if args.command == "check-hierarchy":
410+
if args.command == "check-image-map":
411+
check_image_map(args.kolla_ansible_path)
412+
elif args.command == "check-hierarchy":
351413
check_hierarchy(args.kolla_ansible_path)
352414
elif args.command == "check-tags":
353415
check_tags(base_distros, kolla_image_tags, args.registry, args.namespace)

0 commit comments

Comments
 (0)