Skip to content

Override kolla_base_distro_version #923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 6, 2024

Conversation

MoteHue
Copy link
Contributor

@MoteHue MoteHue commented Feb 8, 2024

When running the kayobe-automation CI on a Zed/Antelope cloud running Ubuntu host images, these variable overrides cause the kolla tags to template incorrectly. For example, a Jammy host gets kolla_base_distro_and_version = rocky-jammy.

Given we will not be performing any host OS migrations on Zed (or Antelope), we can remove these overrides and use the default values based on os_distribution.

Bug explanation:

These variables end up with the following values, meaning the CI picks up rocky but keeps jammy.

kolla_base_distro: '{{ ansible_facts.distribution | lower }}'
kolla_base_distro_and_version: '{{ kolla_base_distro }}-{{ kolla_base_distro_version}}'
kolla_base_distro_version: jammy

This is because the variables are first templated under the Kayobe group_vars based on os_distribution, so the version maps to jammy. kayobe/ansible/inventory/group/vars/all/kolla

kolla_base_distro: "{{ os_distribution }}"

kolla_base_distro_version_default_map: {
  "centos": "stream9",
  "debian": "bullseye",
  "rocky": "9",
  "ubuntu": "jammy",
}

kolla_base_distro_version: "{{ kolla_base_distro_version_default_map[kolla_base_distro] }}"

Then, the base distro and the final variable are overwritten in kolla globals kayobe-config/etc/kayobe/kolla/globals.yml

kolla_base_distro: "{% raw %}{{ ansible_facts.distribution | lower }}{% endraw %}"

kolla_base_distro_and_version: "{% raw %}{{ kolla_base_distro }}-{{ kolla_base_distro_version }}{% endraw %}"

@MoteHue MoteHue requested a review from a team as a code owner February 8, 2024 15:56
@MoteHue MoteHue requested a review from jackhodgkiss February 8, 2024 15:56
jackhodgkiss
jackhodgkiss previously approved these changes Feb 8, 2024
Copy link
Contributor

@jackhodgkiss jackhodgkiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Alex-Welsh
Copy link
Member

I think this brings up a wider question of perhaps supporting Jammy-based automation images. I can imagine this won't be the last time we see a conflict like this. I know it's yet another thing to support but it's a question of what will be more effort. Either that or whack-a-bug with distro conflicts.

@MoteHue
Copy link
Contributor Author

MoteHue commented Feb 13, 2024

I think this brings up a wider question of perhaps supporting Jammy-based automation images. I can imagine this won't be the last time we see a conflict like this. I know it's yet another thing to support but it's a question of what will be more effort. Either that or whack-a-bug with distro conflicts.

Imo supporting Ubuntu in kayobe-automation is the correct long-term fix for this issue. However, as you say the work to do this isn't small, so I'd proposed this PR here so that the immediate upgrade cycle of Z+A can continue without every Ubuntu customer needing to be fixed.

I need to look the new kolla tags stuff first, but the comment for kolla_base_distro suggests it only needs to be set for the RL9 migrations. Perhaps rather than removal, just setting it to os_distribution would be a sufficient fix.

@MoteHue
Copy link
Contributor Author

MoteHue commented Feb 26, 2024

So for more context, this error was hit when running a kolla config-diff using a Kayobe image built with a RL9 kayobe-automation but an Ubuntu Jammy target system.

TASK [common : Ensuring config directories exist]
...
{{ common_tag }}: {{ openstack_tag }}: {{ kolla_image_tags['openstack'][kolla_base_distro_and_version] }}: 'dict object' has no attribute 'rocky-jammy'. 'dict object' has no attribute 'rocky-jammy'.

@markgoddard
Copy link
Contributor

Discussed with @MoteHue IRL. I think this is caused by Kayobe's globals.yml template (ansible/roles/kolla-ansible/templates/kolla/globals.yml) setting kolla_base_distro_version based on Kayobe's variable of the same name, which references os_version. We can avoid this by explicitly using facts for the version in SKC's globals.yml template:

kolla_base_distro_version: "{{ ansible_facts.distribution_major_version }}"

While this will lead to localhost seeing kolla_base_distro_and_version as rocky-9, IIUC this will never be referenced during deployment, and is only required to successfully template out localhost's hostvars.

@MoteHue
Copy link
Contributor Author

MoteHue commented Feb 27, 2024

Discussed with @MoteHue IRL. I think this is caused by Kayobe's globals.yml template (ansible/roles/kolla-ansible/templates/kolla/globals.yml) setting kolla_base_distro_version based on Kayobe's variable of the same name, which references os_version. We can avoid this by explicitly using facts for the version in SKC's globals.yml template:

kolla_base_distro_version: "{{ ansible_facts.distribution_major_version }}"

While this will lead to localhost seeing kolla_base_distro_and_version as rocky-9, IIUC this will never be referenced during deployment, and is only required to successfully template out localhost's hostvars.

I've tested this solution in Bristol CI, it works.

@MoteHue MoteHue force-pushed the fix-ubuntu-cloud-ci-zed branch from bfa520a to 2bd9093 Compare February 28, 2024 09:24
When running the kayobe-automation CI on a Zed/Antelope cloud running
Ubuntu host images, the kolla tags to
templated incorrectly. For example, a Jammy host gets
``kolla_base_distro_and_version = rocky-jammy``.

This is caused by Kayobe's ``globals.yml`` template
(``ansible/roles/kolla-ansible/templates/kolla/globals.yml``) setting
``kolla_base_distro_version`` based on Kayobe's variable of the sam
 name, which references ``os_version``. We can avoid this by explicitly
 using facts for the version in SKC's ``globals.yml`` template.
@MoteHue MoteHue force-pushed the fix-ubuntu-cloud-ci-zed branch from 2bd9093 to e4f7036 Compare February 28, 2024 09:25
@MoteHue MoteHue changed the title Remove the override to kolla_base_distro & version Override kolla_base_distro_version Feb 28, 2024
markgoddard
markgoddard previously approved these changes Feb 29, 2024
@markgoddard markgoddard merged commit aaecbcb into stackhpc/zed Mar 6, 2024
@markgoddard markgoddard deleted the fix-ubuntu-cloud-ci-zed branch March 6, 2024 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants