-
Notifications
You must be signed in to change notification settings - Fork 110
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
Add role to deploy 17.1 env for adoption #2297
Conversation
Thanks for the PR! ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would need some more flexibility, but it could match the need with some tweaks/iterations.
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/3e0801ce95b34d3184964958b146d59f ✔️ openstack-k8s-operators-content-provider SUCCESS in 10h 11m 04s |
6908cc9
to
d5f18ed
Compare
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/f96d929a98b34e69a20a3813f6e9f506 ✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 14m 09s |
ae14a9b
to
cd97aff
Compare
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/179a53575c8e437a909be2c41711f18c ✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 33m 15s |
cd97aff
to
be4fffd
Compare
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/100b262aeb704c85b86c6589151688bf ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 46m 28s |
be4fffd
to
87dd378
Compare
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/11d5100f2b374d3d875c5cd958cdfef7 ✔️ openstack-k8s-operators-content-provider SUCCESS in 34m 34s |
87dd378
to
7413ab1
Compare
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/c8f71eecadfe40639c4e22942a5fb6c5 ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 43m 57s |
7413ab1
to
ee6fda9
Compare
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/c22a1ed7df85440d83b1bb6fc81d2aa0 ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 40m 24s |
ee6fda9
to
bfc7d98
Compare
bfc7d98
to
ae7d460
Compare
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/2c06710e48894922925227767bc3a40b ✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 02m 30s |
ae7d460
to
1b62440
Compare
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/782d8ffaf82c413cab42bc91c2a5128d ✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 50m 00s |
e99f3b5
to
74423c1
Compare
8bfd74d
to
d8d0f19
Compare
@lewisdenny thanks for the extensive review, I've updated the PR with some changes, please take a look when you have some time |
d8d0f19
to
e94bf89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did my best to review this one (not finished yet), but with this size is almost impossible to do a proper review.
Most of my comments are cosmetic ones, but I'm writing down them mainly because I'm sure that no one will have time to fix them when this PR is merged.
loop_var: "_inventory_file" | ||
|
||
- name: Gather ansible_user_id from controller for hooks | ||
ansible.builtin.setup: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This task name Gather ansible_user_id from controller for hooks
is misleading. The ansible.builtin.setup
will target the playbook target, as it's not delegated, meaning it will collect the facts you ask to collect from localhost
only. If you want to collect the facts from the controller you need to delegate the task to that host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed the task name, it was doing the right thing, but the description was wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am late to the party, albeit my question is likely related to the ci framework design, not this implementation that follows it. Why do we need to make ansible parsing other ansible/t-h-t objects from yaml files, instead of using direct inputs?
deploy-osp-adoption.yml
Outdated
cifmw_adoption_osp_deploy_scenario: | ||
{{ cifmw_adoption_osp_deploy_scenario | to_nice_yaml(indent=2) | indent(width=2) }} | ||
_vm_groups: | ||
{{ _vm_groups | to_nice_yaml(indent=2) | indent(width=2) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You won't need to deal with indentation if the file is written the proper way:
- name: Save variables for use with hooks
vars:
__content:
cifmw_adoption_osp_deploy_ntp_server: "{{ cifmw_adoption_osp_deploy_ntp_server }}"
cifmw_adoption_source_scenario_path: "{{ cifmw_adoption_source_scenario_path }}"
cifmw_adoption_osp_deploy_scenario: "{{ cifmw_adoption_osp_deploy_scenario }}"
_vm_groups: "{{ _vm_groups }}"
ansible.builtin.copy:
dest: "{{ cifmw_basedir }}/artifacts/parameters/adoption_osp.yml"
content: "{{ __content | to_nice_yaml }}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, that is a great improvement!
_stack.network_data_file | ||
] | path_join | ||
}} | ||
_network_data_file_dest: "{{ ansible_user_dir }}/network_data_{{ _overcloud_name }}.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the previous line we use path_join
. I'd prefer to be consistent, especially in code that belongs to the same PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks
deploy-osp-adoption.yml
Outdated
_path_inventories: "{{ ansible_user_dir }}/ci-framework-data/reproducer-inventory" | ||
ansible.builtin.slurp: | ||
path: "{{ _path_inventories }}/{{ _group_name }}-group.yml" | ||
register: _files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meaningless variable name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, I made the name more explicit
deploy-osp-adoption.yml
Outdated
vars: | ||
_content: "{{ _inventory_file.content | b64decode | from_yaml }}" | ||
_group_name: "{{ _inventory_file.source | basename | regex_replace('-group.yml', '') }}" | ||
_nodes: "{{ _content[_group_name~'s']['hosts'].keys() }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the groups will be always named _group_name + 's' looks fragile. One small change in the reproducer inventory dump and we will miss that adoption is making this assumption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, that is error-prone and turns out the assumption is not needed, I've changed the code to simply read the group name from the file
block: | ||
- name: Copy ceph osd file | ||
delegate_to: "osp-undercloud-0" | ||
ansible.builtin.copy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File manipulations without explicitly setting the mode
will cause linter issues. iirc it's one of the rules we disabled, so no problem for now, but at some point someone will need to touch this freshly added code to make it complaint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, I haven't thought about this, I think I added the mode
to all the tasks now
_config_download: > | ||
{{ | ||
_original_config_download['content'] | | ||
b64decode | from_yaml | ||
}} | ||
_new_config_download_fields: {} | ||
_ctlplane_net: "{{ cifmw_networking_env_definition.networks.ctlplane }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the *download*
vars are not used till the very end of the block in one single task. Care to move them to there? I was searching where are they used all over the file...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, moved them all to the end
- name: Gather overcloud tripleo nodes | ||
when: group.key is in _hostname_map_translation | ||
ansible.builtin.set_fact: | ||
_tripleo_nodes: >- | ||
{{ | ||
_tripleo_nodes | default([]) + | ||
group.value | ||
}} | ||
loop: "{{ _vm_groups | dict2items }}" | ||
loop_control: | ||
loop_var: group | ||
label: "{{ group.key }}" | ||
|
||
- name: Generate Hostnamemap field | ||
when: group.key is in _hostname_map_translation | ||
vars: | ||
_tripleo_name: "{{ _hostname_map_translation[group.key] }}" | ||
_group_nodes: >- | ||
{%- set hosts = {} -%} | ||
{%- for node in group.value -%} | ||
{%- set key = _tripleo_name ~ '-' ~ loop.index0 | string -%} | ||
{%- set _ = hosts.update({key: node}) -%} | ||
{%- endfor -%} | ||
{{ hosts }} | ||
ansible.builtin.set_fact: | ||
_hostname_map: >- | ||
{{ | ||
_hostname_map | default({}) | | ||
combine(_group_nodes) | ||
}} | ||
loop: "{{ _vm_groups | dict2items }}" | ||
loop_control: | ||
loop_var: group | ||
label: "{{ group.key }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both loops can be perfectly joined and the second one doesn't depend in the computation done in the first one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, thanks, I've merged them
args: | ||
apply: | ||
delegate_to: "osp-undercloud-0" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost all the following tasks are delegated. Why not use a block to improve readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks!
There are already detailed reviews so i just did a higher level "let me grasp what's going on" review. I just wondered whether we'll want to support deployment without Thank you very much for the work on this. LGTM 👍 |
I will take another pass after @pablintino review is addressed |
Add the following improvements from reviews: - Allow network_data.yaml to be a template - Build inventory for ceph migration in tripleo-ansible-inventory - Generate adoption_vars to use with the adoption_tests - Allow users to pass an overcloud_deploy command - Support deploying multiple stacks - Support not passing cifmw_target_host - Add validation to scenario input - Add role var for the 17.1 scenario
e94bf89
to
8ea4cc9
Compare
@pablintino thanks for the review, I think I've addressed all your comments @lewisdenny I've updated the PR with the changes after testing locally, ptal when you have some time |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pablintino The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
Add a new role that will deploy a tripleo environment that will serve as
source for adoption. This role is expected to cosume the infra created
by [1], and a 17.1 scenario definition from the data-plane-adoption
repo, introduced by [2].
It also introduce a small fix to the deploy-ocp.yml so the resulting ocp
cluster is ready (the nodes needed to be uncordoned).
[1] #2285
[2] openstack-k8s-operators/data-plane-adoption#597