Skip to content

[adoption_osp_deploy] Allow overriding scenario stack CLI args#3750

Draft
imatza-rh wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
shiftstack:adoption-osp-deploy-stack-args-override
Draft

[adoption_osp_deploy] Allow overriding scenario stack CLI args#3750
imatza-rh wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
shiftstack:adoption-osp-deploy-stack-args-override

Conversation

@imatza-rh
Copy link

@imatza-rh imatza-rh commented Mar 7, 2026

Summary

  • Add cifmw_adoption_osp_deploy_stack_args_remove and cifmw_adoption_osp_deploy_stack_args_add variables to the adoption_osp_deploy role
  • These allow callers to modify the TripleO overcloud deploy CLI arguments inherited from the DPA scenario file

Problem

TripleO CLI arguments like --libvirt-type generate internal heat environments that are applied after all user-provided -e files. This means cifmw_adoption_osp_deploy_overcloud_extra_args (which creates internal-configuration.yaml as the last -e file) cannot override them.

For shiftstack adoption jobs, we need --libvirt-type kvm instead of --libvirt-type qemu (nested virt requires KVM), but the existing override mechanism has no effect.

Solution

Use Ansible's reject('in', ...) filter to remove unwanted args (preserving order) and append replacements:

# In Zuul job vars:
cifmw_adoption_osp_deploy_stack_args_remove:
  - '--libvirt-type qemu'
cifmw_adoption_osp_deploy_stack_args_add:
  - '--libvirt-type kvm'

The defaults are empty lists, so this is fully backwards compatible — existing jobs produce byte-identical output.

Note: An earlier implementation used difference(), but Ansible's difference filter uses sets internally and scrambles arg order. The reject('in', ...) filter preserves the original ordering from the DPA scenario file.

Changes

File Change
defaults/main.yml New defaults: _stack_args_remove: [], _stack_args_add: []
tasks/deploy_overcloud.yml Core logic: reject('in', remove) | list + add | join(' ')
tasks/validate_scenario.yml Input validation: both vars must be lists (not string/mapping)
molecule/default/converge.yml 6 test scenarios exercising the Jinja2 expression
molecule/default/verify.yml Assertions: content, order preservation, no-op, append position
README.md Documents both new parameters

Test plan

  • Molecule tests pass (6 scenarios: default, remove, add, replace, multi-remove, no-op)
  • ci-framework-jobs MR !2964 consumes this via Depends-On
  • Verify shiftstack adoption deploy-osp produces --libvirt-type kvm in the overcloud deploy command
  • All 8 existing adoption jobs unaffected (defaults produce identical output)

Assisted-By: Claude Code

@imatza-rh imatza-rh marked this pull request as draft March 7, 2026 10:11
@imatza-rh imatza-rh changed the base branch from main to stable March 7, 2026 15:36
@imatza-rh imatza-rh force-pushed the adoption-osp-deploy-stack-args-override branch 4 times, most recently from 52c3b81 to d625233 Compare March 17, 2026 19:08
@imatza-rh imatza-rh force-pushed the adoption-osp-deploy-stack-args-override branch from d625233 to 9f49310 Compare March 19, 2026 13:35
Add cifmw_adoption_osp_deploy_stack_args_remove and
cifmw_adoption_osp_deploy_stack_args_add variables to allow
callers to modify the TripleO overcloud deploy CLI arguments
from the DPA scenario.

TripleO CLI arguments like --libvirt-type generate internal
heat environments applied after all user-provided -e files,
so they cannot be overridden via the existing
cifmw_adoption_osp_deploy_overcloud_extra_args mechanism.
The new variables use Ansible's reject filter to remove
unwanted args (preserving order) and append replacements.

Also adds:
- Input validation for the new variables in validate_scenario
- Molecule test coverage for the args override logic
- README documentation for both new parameters

Assisted-By: Claude Code
Signed-off-by: Itay Matza <imatza@redhat.com>
@imatza-rh imatza-rh changed the base branch from stable to main March 23, 2026 13:30
@imatza-rh imatza-rh force-pushed the adoption-osp-deploy-stack-args-override branch from 9f49310 to a2572f2 Compare March 23, 2026 13:30
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 23, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign sathlan for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant