Skip to content

feat: added archive and delete functionality of plans - #89

Closed
sabre1041 wants to merge 1 commit into
redhat-cop:v2from
sabre1041:mtv-plans-archive-delete
Closed

sabre1041 wants to merge 1 commit into
redhat-cop:v2from
sabre1041:mtv-plans-archive-delete

Conversation

@sabre1041

Copy link
Copy Markdown
Contributor

Description

Added support for archiving and deleting Plans. Support for selecting by plan names and/or labels

Archiving Plans

mtv_plans_action: archive
mtv_plans_plan_labels:
 - infra.openshift-virtualization-migration/plan-name=test-plan
mtv_plans_plan_namespace: mtv-user2

Deleting Plans

mtv_plans_action: delete
mtv_plans_plan_labels:
 - infra.openshift-virtualization-migration/plan-name=test-plan
mtv_plans_plan_namespace: mtv-user2

Type of Change

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation changes
  • style: Formatting, missing semi colons, etc; no code change
  • refactor: Refactoring production code
  • test: Adding missing tests, refactoring tests; no production code change
  • chore: Updating configs, etc; no production code change

@sabre1041
sabre1041 deployed to external-ci September 9, 2026 18:32 — with GitHub Actions Active
@sabre1041
sabre1041 force-pushed the mtv-plans-archive-delete branch from 5fb3eb3 to 55ee66b Compare September 9, 2026 18:40
@sabre1041
sabre1041 deployed to external-ci September 9, 2026 18:41 — with GitHub Actions Active
@sabre1041
sabre1041 deployed to external-ci September 9, 2026 18:55 — with GitHub Actions Active
@tech2734

Copy link
Copy Markdown

Review Feedback

Nice work on the archive/delete functionality — clean implementation overall. A few items:

1. PR title typo

"archieve" → "archive"

2. defaults/main.yml — description missing delete from choices

The docsible description says:

# description: Action to take. Choices include: create, archive. Defaults to create.

But argument_specs.yml correctly lists all three (create, archive, delete). The description should include delete.

3. verify_archived.yml — Archived condition check may be too loose

__mtv_plans_all_archived: >-
  {{
    __mtv_plans_verify_results |
    ansible.builtin.json_query('[?status.conditions[?type==`Archived`]]') |
    length == __mtv_plans_verify_results | length
  }}

This checks for the existence of a condition with type: Archived, but does not verify that status is True. If Forklift ever sets the condition to status: False during a transition, this would incorrectly report success. Consider:

ansible.builtin.json_query('[?status.conditions[?type==`Archived` && status==`True`]]')

4. No validation that mtv_plans_plan_namespace is provided for archive/delete

Both archive.yml and delete.yml validate that at least one of plan_name or plan_labels is provided, but do not check for plan_namespace. Since Plans are namespaced resources, an empty namespace when querying by name could return nothing or fail. When querying by labels without a namespace, k8s_info queries across all namespaces — which may be intentional but could also be a safety concern. Worth adding a namespace assertion, or at least documenting the cross-namespace behavior.

5. Inconsistent verification pattern

create.yml uses the standard Ansible until/retries/delay loop for verifying plans are ready, but verify_archived.yml and verify_deleted.yml use recursive include_tasks with a manual counter and pause. Both work, but it is an inconsistency within the same role. The recursive approach is harder to debug (stack depth, variable scoping) compared to until.

@sabre1041 sabre1041 changed the title feat: added archieve and delete functionality of plans feat: added archive and delete functionality of plans Sep 15, 2026
@sabre1041
sabre1041 force-pushed the mtv-plans-archive-delete branch from 55ee66b to 53c035a Compare September 15, 2026 15:23
@sabre1041
sabre1041 force-pushed the mtv-plans-archive-delete branch from 53c035a to 551d2e4 Compare September 15, 2026 15:36
@sabre1041
sabre1041 force-pushed the mtv-plans-archive-delete branch from 551d2e4 to 6cca33f Compare September 15, 2026 15:42
@sabre1041

Copy link
Copy Markdown
Contributor Author

@tech2734 Updated based on your feedback. Should be good for another review

@tech2734 tech2734 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All feedback addressed — condition checks now verify status==True, description includes all three choices, and the verification pattern is now consistent across create/archive/delete with the new verify_ready.yml. Nice refactor. LGTM.

@sabre1041
sabre1041 force-pushed the mtv-plans-archive-delete branch from 6cca33f to f400275 Compare September 17, 2026 19:10
Signed-off-by: Andrew Block <andy.block@gmail.com>
@sabre1041
sabre1041 force-pushed the mtv-plans-archive-delete branch from f400275 to e3fe8b2 Compare September 17, 2026 19:25
@sabre1041

Copy link
Copy Markdown
Contributor Author

closing due to ci failure

@sabre1041 sabre1041 closed this Sep 17, 2026
sabre1041 added a commit that referenced this pull request Sep 17, 2026
)

Signed-off-by: Andrew Block <andy.block@gmail.com>

This branch was successfully deployed

1 active deployment
external-ci — e3fe8b2f Deployed Sep 17, 2026 by sabre1041 via external-approval #637
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.

2 participants