Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.

OSAC-23: Rename storage playbooks to match two-stage model - #338

Merged
openshift-merge-bot[bot] merged 7 commits into
osac-project:mainfrom
zszabo-rh:feat/OSAC-1145-split-storage-playbooks
Jun 24, 2026
Merged

openshift-merge-bot[bot] merged 7 commits into
osac-project:mainfrom
zszabo-rh:feat/OSAC-1145-split-storage-playbooks

Conversation

@zszabo-rh

@zszabo-rh zszabo-rh commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Splits the monolithic storage playbooks into four lifecycle actions aligned with the OSAC-23 design (merged) two-stage storage model:

Stage 1 — Backend:

  • osac-create-tenant-storage-backend (was osac-create-org): Provisions VAST backend resources + hub Secret
  • osac-delete-tenant-storage-backend (was osac-delete-org): Removes backend resources + hub Secret

Stage 2 — Cluster Storage:

  • osac-create-tenant-cluster-storage (new): Installs StorageClasses and CSI on target cluster
  • osac-delete-tenant-cluster-storage (new): Removes cluster-side K8s resources only

Key changes:

  • storage_provider dispatcher: 4 actions (setup, ensure_storage_class, teardown_cluster_storage, teardown_backend)
  • vast_storage role: new teardown_backend.yaml and teardown_cluster_storage.yaml task files
  • Config-as-code updated to register 4 AAP job templates (was 2)
  • argument_specs.yaml updated with new action choices and descriptions

Dependencies:

  • Operator PR: osac-operator PR #299 should be merged first
  • Merge order: Operator first, then this PR (per design spec)

Test plan

  • E2E tested on beaker SNO (edge-17) with VAST appliance
  • All 4 playbooks verified: create-backend, create-cluster-storage, delete-cluster-storage, delete-backend
  • Playbook idempotency: all actions handle re-runs gracefully
  • Teardown order: cluster-storage first, then backend (matches design spec)

Assisted-by: Claude Code noreply@anthropic.com

Summary by CodeRabbit

  • New Features
    • Added dedicated tenant storage workflows for backend vs cluster storage, including new controller job templates and new playbooks for create and delete.
  • Refactor
    • Split storage provider teardown into distinct actions (teardown_backend and teardown_cluster_storage) with expanded action validation and best-effort cleanup per provider.
    • Updated VAST teardown to remove only backend-related resources and to produce clearer backend vs cluster cleanup reporting.
  • Tests
    • Updated the storage provider teardown integration test to run both teardown actions separately.

@openshift-ci-robot

openshift-ci-robot commented Jun 10, 2026

Copy link
Copy Markdown

@zszabo-rh: This pull request references OSAC-1145 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Split the combined osac-configure-tenant-storage playbook into four independent lifecycle actions aligned with the two-stage storage model from the OSAC-23 PRD:

  • osac-create-tenant-storage — Stage 1: backend setup (VAST org, VIP pool, credentials, hub Secret)
  • osac-ensure-tenant-storage — Stage 2: cluster-side StorageClass discovery/creation
  • osac-cleanup-tenant-storage — cluster-side resource removal (handles unreachable clusters)
  • osac-delete-tenant-storage — backend teardown (VAST org, views, quotas, hub Secret)

Adds cleanup action to the storage_provider dispatcher and vast_storage role. Config-as-code updated with four job templates.

Breaking change: Must be deployed together with the osac-operator OSAC-23 changes (TenantStorage controller). Deploying AAP changes without operator changes breaks existing tenant storage provisioning.

Depends on

Test plan

  • ansible-lint passes
  • Config-as-code registers all 4 job templates in AAP
  • Stage 1 playbook creates VAST backend resources and hub Secret
  • Stage 2 playbook discovers/creates StorageClasses on target cluster
  • Cleanup playbook removes cluster-side resources
  • Delete playbook tears down VAST backend resources
  • Coordinated deployment with osac-operator validated on dev cluster

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Replaces the monolithic teardown storage provider action with two granular actions: teardown_cluster_storage (removes K8s StorageClasses, VolumeSnapshotClasses, CSI Secret) and teardown_backend (removes VAST VMs and hub Secret). Adds corresponding dispatcher task files, VAST role implementations, new/updated playbooks for both create and delete phases, and four new AAP job templates.

Changes

Tenant Storage Teardown Split and New Create/Delete Playbooks

Layer / File(s) Summary
storage_provider_action contract and dispatch wiring
collections/ansible_collections/osac/service/roles/storage_provider/meta/argument_specs.yaml, collections/ansible_collections/osac/service/roles/storage_provider/tasks/main.yaml, collections/ansible_collections/osac/service/roles/storage_provider/tasks/_dispatch_provider.yaml
Replaces teardown with teardown_cluster_storage and teardown_backend in the allowed-choices enum, validation failure message, and dispatch comment.
New dispatcher task files
collections/ansible_collections/osac/service/roles/storage_provider/tasks/teardown_cluster_storage.yaml, collections/ansible_collections/osac/service/roles/storage_provider/tasks/teardown_backend.yaml
Adds two new task files that loop over _unique_providers, include _dispatch_provider.yaml per provider, and use ignore_errors: true for best-effort cleanup.
VAST teardown_cluster_storage implementation
collections/ansible_collections/osac/templates/roles/vast_storage/tasks/teardown_cluster_storage.yaml
New task file: validates provisioning target and tenant name, deletes tenant-labeled StorageClasses, VolumeSnapshotClasses, and CSI Secret from the target cluster, with rescue handling and a debug summary.
VAST teardown_backend refactor
collections/ansible_collections/osac/templates/roles/vast_storage/tasks/teardown_backend.yaml
Removes K8s cluster-side resource deletion from the backend teardown flow; renames tasks and updates the final summary to report Hub Secret status.
New and updated create-phase playbooks
playbook_osac_create_tenant_storage_backend.yml, playbook_osac_create_tenant_cluster_storage.yml
Adds a new Stage 1 backend setup playbook (storage_provider_action: setup with event validation and STORAGE_TIERS parsing); updates the Stage 2 cluster playbook to use ensure_storage_class with rescue/retry logic.
New and updated delete-phase playbooks
playbook_osac_delete_tenant_cluster_storage.yml, playbook_osac_delete_tenant_storage_backend.yml
Adds a new cluster-storage deletion playbook (teardown_cluster_storage with event validation and STORAGE_TIERS parsing); updates the backend deletion playbook to use teardown_backend instead of teardown.
AAP controller job template registrations
collections/ansible_collections/osac/config_as_code/roles/aap/vars/controller.yml
Replaces the two old create-org/delete-org job templates with four new templates targeting the storage-operations inventory.
Integration test update
tests/integration/targets/storage_provider_teardown/tasks/main.yml
Updates test to replace single teardown call with two sequential role invocations: teardown_cluster_storage followed by teardown_backend.

Sequence Diagram(s)

sequenceDiagram
  participant AAP as AAP Job Template
  participant PB_Backend as create_tenant_storage_backend
  participant PB_Cluster as create_tenant_cluster_storage
  participant SP as storage_provider
  participant VAST as vast_storage role
  participant VMS as VAST VMS API
  participant K8s as Kubernetes API

  rect rgba(100, 149, 237, 0.5)
    note over AAP,K8s: Create Phase
    AAP->>PB_Backend: create-tenant-storage-backend (Stage 1)
    PB_Backend->>PB_Backend: extract tenant metadata
    PB_Backend->>PB_Backend: parse STORAGE_TIERS
    PB_Backend->>SP: storage_provider_action=setup
    SP->>VAST: dispatch to VAST provider
    VAST->>VMS: create VAST VMs + hub Secret
    AAP->>PB_Cluster: create-tenant-cluster-storage (Stage 2)
    PB_Cluster->>SP: storage_provider_action=ensure_storage_class (with rescue/retry)
    SP->>VAST: dispatch to VAST provider
    VAST->>K8s: create StorageClasses + CSI Secret
  end

  rect rgba(205, 92, 92, 0.5)
    note over AAP,K8s: Delete Phase
    AAP->>PB_Cluster: delete-tenant-cluster-storage
    PB_Cluster->>PB_Cluster: extract tenant metadata
    PB_Cluster->>PB_Cluster: parse STORAGE_TIERS
    PB_Cluster->>SP: storage_provider_action=teardown_cluster_storage
    SP->>VAST: dispatch to VAST provider
    VAST->>K8s: delete StorageClasses, VolumeSnapshotClasses, CSI Secret
    AAP->>PB_Backend: delete-tenant-storage-backend
    PB_Backend->>SP: storage_provider_action=teardown_backend
    SP->>VAST: dispatch to VAST provider
    VAST->>VMS: delete VAST VMs + hub Secret
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • osac-project/osac-aap#296: Introduced the original osac.service.storage_provider role dispatch mechanism and teardown action that this PR directly refactors.

Suggested labels

lgtm, approved

Suggested reviewers

  • eranco74
  • larsks
  • akshaynadkarni

Poem

Two jobs become four, the teardown divides,
Cluster-side K8s, backend resides.
teardown retired, two new verbs arise,
ignore_errors: true — no single fault ties.
Stage 1, Stage 2, the pipeline now cleaves,
Clean separation the architect weaves. 🔧


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error Four playbooks log the entire ansible_eda.event.payload via debug statements without no_log protection, exposing blockEncryptionPassphrase (sensitive credential). Add 'no_log: true' to all "Show EDA Event" debug statements in playbook_osac_create_tenant_storage_backend.yml, playbook_osac_delete_tenant_cluster_storage.yml, playbook_osac_create_tenant_cluster_storage.yml, and playbook_osac_delete_te...
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main refactoring effort: renaming storage playbooks to align with the two-stage model (backend/cluster-storage separation).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Hardcoded-Secrets ✅ Passed No hardcoded secrets found. Credentials use environment variables, Kubernetes secrets, and API authentication. admin/admin in integration test is standard development defaults permitted by exception.
No-Weak-Crypto ✅ Passed No weak cryptographic algorithms (MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB), custom crypto implementations, or unsafe secret comparisons detected in PR changes.
No-Injection-Vectors ✅ Passed All dynamic inputs are properly validated: storage_provider_action uses whitelist validation; provider names and tenant_name use DNS label regex validation; STORAGE_TIERS uses from_json with type c...
Container-Privileges ✅ Passed PR contains only Ansible playbooks and roles with no K8s manifests or container definitions; zero privilege-related keywords found in repository scan.
Ai-Attribution ✅ Passed AI tool use disclosed in PR description with proper Red Hat "Assisted-by: Claude Code" trailer in commit; no improper "Co-Authored-By" for AI tool.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zszabo-rh
zszabo-rh force-pushed the feat/OSAC-1145-split-storage-playbooks branch from d4cb6a4 to 1ba5e60 Compare June 11, 2026 08:27
@zszabo-rh zszabo-rh changed the title OSAC-1145: Split AAP storage playbooks into 4 lifecycle actions OSAC-23: Rename storage playbooks to match two-stage model Jun 11, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 11, 2026

Copy link
Copy Markdown

@zszabo-rh: This pull request references OSAC-23 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Rename the four storage playbooks to match the PRD v3 two-stage naming convention (OSAC-23):

Old Name New Name Stage
osac-create-tenant-storage osac-create-tenant-storage-backend Stage 1 — backend setup on VAST
osac-ensure-tenant-storage osac-create-tenant-storage-class Stage 2 — StorageClasses + CSI on target cluster
osac-cleanup-tenant-storage osac-delete-tenant-storage-class Cluster-side resource removal
osac-delete-tenant-storage osac-delete-tenant-storage-backend Backend teardown on VAST

Naming convention: "backend" = work on storage appliance, "class" = work on K8s cluster.

Config-as-code job template definitions updated to match.

Dependencies

Test plan

  • ansible-lint passes
  • Playbook syntax check passes for all 4 renamed playbooks
  • AAP config-as-code creates job templates with new names
  • E2E: Storage Controller triggers correct playbooks by name

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@zszabo-rh
zszabo-rh force-pushed the feat/OSAC-1145-split-storage-playbooks branch from 1ba5e60 to b6873c0 Compare June 11, 2026 08:35
@akshaynadkarni

akshaynadkarni commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Hey @zszabo-rh , noting a naming mismatch between this PR and the PRD/design for when we finalize the coordinated merge.

The backend names are consistent everywhere, but the Stage 2 (cluster-side) names diverge:

The dispatcher action also differs: cleanup here vs teardown_cluster_storage in the design.

Just leaving this here so we have a reference point to align on before merging.

@zszabo-rh
zszabo-rh force-pushed the feat/OSAC-1145-split-storage-playbooks branch from 51f514b to ab06298 Compare June 16, 2026 03:54
@zszabo-rh

Copy link
Copy Markdown
Contributor Author

@akshaynadkarni
Uh, sorry, this PR was stale, I already E2E tested using the proper names!
Force-pushed the branch with the updated names, PR should be in sync with the PRD/design now.

@akshaynadkarni

Copy link
Copy Markdown
Contributor

Nit: the comment on _dispatch_provider.yaml line 8 still lists three actions (setup, ensure_storage_class, teardown). Should include teardown_cluster_storage and teardown_backend too.

@akshaynadkarni

Copy link
Copy Markdown
Contributor

The old teardown action and teardown.yaml are still in the codebase, but nothing calls them anymore. The operator uses teardown_backend and teardown_cluster_storage independently. Can we remove teardown to avoid maintaining duplicate logic across three files?

@zszabo-rh

Copy link
Copy Markdown
Contributor Author

Nit: the comment on _dispatch_provider.yaml line 8 still lists three actions (setup, ensure_storage_class, teardown). Should include teardown_cluster_storage and teardown_backend too.

The old teardown action and teardown.yaml are still in the codebase, but nothing calls them anymore. The operator uses teardown_backend and teardown_cluster_storage independently. Can we remove teardown to avoid maintaining duplicate logic across three files?

Fixed both!

@akshaynadkarni

Copy link
Copy Markdown
Contributor

@coderabbitai resolve

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

Split the combined configure_tenant_storage playbook into four
independent playbooks aligned with the two-stage storage model:

- osac-create-tenant-storage-backend (Stage 1: backend setup on VAST)
- osac-create-tenant-storage-class (Stage 2: StorageClasses + CSI on target)
- osac-delete-tenant-storage-class (cluster-side resource removal)
- osac-delete-tenant-storage-backend (backend teardown on VAST)

Add cleanup action to storage_provider role dispatcher and vast_storage
role for cluster-side resource removal without touching backend.

Update config-as-code with four job template definitions.

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Zoltan Szabo <zszabo@redhat.com>
Add teardown_backend action that removes VAST backend resources
(tenant, views, quotas, manager, local provider) and hub Secret
without touching cluster-side K8s resources (StorageClasses,
VolumeSnapshotClasses, CSI Secret).

The delete-tenant-storage-backend playbook now uses teardown_backend
instead of teardown, ensuring that cluster-side resources are only
removed by the delete-tenant-storage-class playbook (cleanup action).
This separation is required for CaaS where a ClusterOrder deletion
must clean up cluster-side resources without destroying the backend
that other clusters depend on.

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Zoltan Szabo <zszabo@redhat.com>
Rename Stage 2 playbooks from *-storage-class to *-cluster-storage and
the dispatcher action from cleanup to teardown_cluster_storage, per the
approved design spec (PR osac-project#58).

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Zoltan Szabo <zszabo@redhat.com>
- Remove hcp_data_plane from teardown_cluster_storage (not implemented)
- Update _dispatch_provider.yaml comment to list all 5 actions
- Remove old monolithic teardown action — the operator uses
  teardown_backend + teardown_cluster_storage independently

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Zoltan Szabo <zszabo@redhat.com>
@akshaynadkarni

akshaynadkarni commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Nit: the comment on _dispatch_provider.yaml line 8 still lists three actions (setup, ensure_storage_class, teardown). Should include teardown_cluster_storage and teardown_backend too.

The old teardown action and teardown.yaml are still in the codebase, but nothing calls them anymore. The operator uses teardown_backend and teardown_cluster_storage independently. Can we remove teardown to avoid maintaining duplicate logic across three files?

Fixed both!

@zszabo-rh I still see teardown in the argument_specs and main.yaml validation list at HEAD (ab06298). Also, I'm not seeing any changes to _dispatch_provider.yaml. Did you not push your changes to the remote repo?

@zszabo-rh
zszabo-rh force-pushed the feat/OSAC-1145-split-storage-playbooks branch from ab06298 to 4c5ec15 Compare June 23, 2026 16:11

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
playbook_osac_create_tenant_cluster_storage.yml (1)

50-52: 🎯 Functional Correctness | 🔴 Critical

Add osac.service.common kubeconfig bootstrap to storage_provider role before dispatching to provider tasks.

The vast_storage role's kubernetes.core.k8s_info and kubernetes.core.k8s tasks (lines 43, 149, 216, 242, 271, 281 in ensure_storage_class.yaml, and similar in teardown_cluster_storage.yaml and setup.yaml) operate without a kubeconfig: parameter. Without bootstrapping remote_cluster_kubeconfig first, these tasks will execute against the default kubeconfig context (hub cluster), not the target cluster where the StorageClasses should be created.

Follow the established pattern: include osac.service.common with tasks_from: get_remote_cluster_kubeconfig in storage_provider/tasks/main.yaml before any dispatch to provider roles, similar to how ocp_virt_vm and network_policy roles implement it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@playbook_osac_create_tenant_cluster_storage.yml` around lines 50 - 52, The
storage_provider role is being invoked without first bootstrapping the
remote_cluster_kubeconfig, causing the kubernetes.core.k8s_info and
kubernetes.core.k8s tasks in the vast_storage role to execute against the hub
cluster's default kubeconfig context instead of the target cluster. In the
storage_provider/tasks/main.yaml file, add an include_role task for
osac.service.common with tasks_from: get_remote_cluster_kubeconfig before
dispatching to any provider-specific roles, following the established pattern
used in ocp_virt_vm and network_policy roles to ensure the target cluster
context is properly set.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@collections/ansible_collections/osac/service/roles/storage_provider/tasks/_dispatch_provider.yaml`:
- Line 7: Update the comment on the _dispatch_action line in
_dispatch_provider.yaml by removing the obsolete teardown action from the list
of available actions. The comment currently includes teardown as one of the
valid task file options, but since teardown has been replaced with
teardown_cluster_storage and teardown_backend, remove teardown from the
comma-separated list to keep the documentation consistent with the actual
implementation in argument_specs.yaml and main.yaml.

In
`@collections/ansible_collections/osac/service/roles/storage_provider/tasks/teardown_cluster_storage.yaml`:
- Around line 7-14: The task name "Dispatch cleanup to each provider" is too
generic and does not accurately reflect the specific action being performed
which is teardown_cluster_storage. Rename the task from "Dispatch cleanup to
each provider" to "Dispatch teardown_cluster_storage to each provider" to
improve clarity and consistency with the action name, and to distinguish it from
the similar teardown_backend action.

In
`@collections/ansible_collections/osac/templates/roles/vast_storage/tasks/teardown_cluster_storage.yaml`:
- Around line 82-89: The "Report cleanup summary" task is running
unconditionally after the block/rescue structure, causing it to report
"complete" with potentially zero counts even when the cleanup failed due to an
unreachable cluster (triggering the rescue block). To fix this, either move the
"Report cleanup summary" task inside the main block before the rescue clause so
it only runs on successful cleanup, or add a conditional statement (when clause)
to the task that checks if cleanup was successful before reporting the summary.
This will prevent misleading success messages when the cluster is unreachable
and the rescue block executes instead.

In `@playbook_osac_create_tenant_storage_backend.yml`:
- Around line 12-15: The debug task named "Show EDA Event" currently logs the
full ansible_eda.event.payload without redacting sensitive information such as
the passphrase field. Modify this debug task to redact or mask sensitive payload
keys before logging to prevent exposing secrets in AAP logs. Apply a redaction
filter or transformation to the payload variable that removes or masks fields
like passphrase while maintaining the existing traceability pattern and overall
log structure.
- Around line 33-38: Add validation immediately after parsing the STORAGE_TIERS
JSON in the "Parse tier list from env var" task to ensure the parsed result is a
JSON array rather than any other valid JSON type. After the from_json filter
assigns to _storage_tiers, add a condition or assertion that checks if
_storage_tiers is of type list, and if not, fail the playbook with a clear error
message indicating that STORAGE_TIERS must be a JSON array. This prevents
downstream roles from encountering unclear errors when the wrong JSON type is
passed.

In `@playbook_osac_delete_tenant_cluster_storage.yml`:
- Around line 41-45: The task "Skip cleanup when STORAGE_TIERS is not
configured" currently uses ansible.builtin.debug to only log a message when
_storage_tiers_raw has no length, allowing the playbook to continue and silently
skip cleanup. Replace the ansible.builtin.debug module with ansible.builtin.fail
to halt playbook execution when STORAGE_TIERS is not configured, ensuring the
job fails instead of reporting success while leaving tenant artifacts orphaned.
- Around line 26-31: The "Parse tier list from env var" task parses
STORAGE_TIERS JSON into the _storage_tiers variable but does not validate that
the parsed result is actually a list, allowing non-list JSON values to pass
through and cause failures later. After the from_json filter in the set_fact
task that sets _storage_tiers, add an assertion or conditional check to validate
that _storage_tiers is a list type. If the parsed value is not a list, fail the
task with a clear error message indicating that STORAGE_TIERS must be a JSON
array.

---

Outside diff comments:
In `@playbook_osac_create_tenant_cluster_storage.yml`:
- Around line 50-52: The storage_provider role is being invoked without first
bootstrapping the remote_cluster_kubeconfig, causing the
kubernetes.core.k8s_info and kubernetes.core.k8s tasks in the vast_storage role
to execute against the hub cluster's default kubeconfig context instead of the
target cluster. In the storage_provider/tasks/main.yaml file, add an
include_role task for osac.service.common with tasks_from:
get_remote_cluster_kubeconfig before dispatching to any provider-specific roles,
following the established pattern used in ocp_virt_vm and network_policy roles
to ensure the target cluster context is properly set.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 98469350-59e5-4747-8f0e-73229cc2774b

📥 Commits

Reviewing files that changed from the base of the PR and between f130cf4 and 4c5ec15.

📒 Files selected for processing (13)
  • collections/ansible_collections/osac/config_as_code/roles/aap/vars/controller.yml
  • collections/ansible_collections/osac/service/roles/storage_provider/meta/argument_specs.yaml
  • collections/ansible_collections/osac/service/roles/storage_provider/tasks/_dispatch_provider.yaml
  • collections/ansible_collections/osac/service/roles/storage_provider/tasks/main.yaml
  • collections/ansible_collections/osac/service/roles/storage_provider/tasks/teardown.yaml
  • collections/ansible_collections/osac/service/roles/storage_provider/tasks/teardown_backend.yaml
  • collections/ansible_collections/osac/service/roles/storage_provider/tasks/teardown_cluster_storage.yaml
  • collections/ansible_collections/osac/templates/roles/vast_storage/tasks/teardown_backend.yaml
  • collections/ansible_collections/osac/templates/roles/vast_storage/tasks/teardown_cluster_storage.yaml
  • playbook_osac_create_tenant_cluster_storage.yml
  • playbook_osac_create_tenant_storage_backend.yml
  • playbook_osac_delete_tenant_cluster_storage.yml
  • playbook_osac_delete_tenant_storage_backend.yml
💤 Files with no reviewable changes (1)
  • collections/ansible_collections/osac/service/roles/storage_provider/tasks/teardown.yaml

Comment thread playbook_osac_create_tenant_storage_backend.yml
Comment thread playbook_osac_create_tenant_storage_backend.yml
Comment thread playbook_osac_delete_tenant_cluster_storage.yml
Comment thread playbook_osac_delete_tenant_cluster_storage.yml
@akshaynadkarni

Copy link
Copy Markdown
Contributor

Hey @zszabo-rh, two things remaining:

  • CI failure: integration-tests is failing because storage_provider_teardown (lines 227 and 235) still uses storage_provider_action: teardown, which was removed. I didn't know about this! It needs to be updated to use teardown_backend and teardown_cluster_storage.

  • CodeRabbit: There are a few open CodeRabbit comments worth looking at when you get a chance.

- Fix integration test: split teardown into teardown_cluster_storage +
  teardown_backend (old teardown action was removed)
- Remove stale 'teardown' from _dispatch_provider.yaml action list
- Rename 'cleanup' to 'teardown_cluster_storage' in dispatcher and
  vast_storage task names for consistency
- Move summary task inside block so it only reports on success, not
  after rescue fires on unreachable cluster
- Add STORAGE_TIERS JSON array type validation in create-backend and
  delete-cluster-storage playbooks

Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Zoltan Szabo <zszabo@redhat.com>

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
playbook_osac_delete_tenant_cluster_storage.yml (1)

7-8: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

This playbook has the same pre-validation dereference failure path as the create playbook.

Play vars dereference ansible_eda.event.payload.metadata.* before pre_tasks execute, and the when guard omits intermediate checks (event, payload, metadata). A malformed event can crash before the intended fail message.

Suggested fix
   vars:
-    tenant_name: "{{ ansible_eda.event.payload.metadata.name }}"
-    tenant_namespace: "{{ ansible_eda.event.payload.metadata.namespace }}"
     _storage_tiers_raw: "{{ lookup('env', 'STORAGE_TIERS') }}"
@@
     - name: Validate tenant payload is present
       ansible.builtin.fail:
         msg: "tenant must be provided via ansible_eda.event.payload with metadata.name and metadata.namespace set"
       when: >-
         ansible_eda is not defined or
+        ansible_eda.event is not defined or
+        ansible_eda.event.payload is not defined or
+        ansible_eda.event.payload.metadata is not defined or
         ansible_eda.event.payload.metadata.name is not defined or
         ansible_eda.event.payload.metadata.name | length == 0 or
         ansible_eda.event.payload.metadata.namespace is not defined or
         ansible_eda.event.payload.metadata.namespace | length == 0
+
+    - name: Set tenant identifiers from validated payload
+      ansible.builtin.set_fact:
+        tenant_name: "{{ ansible_eda.event.payload.metadata.name }}"
+        tenant_namespace: "{{ ansible_eda.event.payload.metadata.namespace }}"

Also applies to: 16-24

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@playbook_osac_delete_tenant_cluster_storage.yml` around lines 7 - 8, The
playbook is dereferencing nested properties ansible_eda.event.payload.metadata.*
in the vars section (tenant_name and tenant_namespace variables) before the
pre_tasks validation executes. If a malformed event is passed without the
intermediate properties (event, payload, metadata), the dereference will fail
before reaching the intended validation logic. Fix this by adding comprehensive
existence checks in the when condition to verify all intermediate properties
exist before allowing the playbook to proceed, checking for ansible_eda.event,
ansible_eda.event.payload, and ansible_eda.event.payload.metadata in the guard
clause. Apply the same fix to the other variable dereferences mentioned in lines
16-24 that have the same vulnerability.
playbook_osac_create_tenant_storage_backend.yml (1)

7-8: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Play-level payload dereference can fail before your validation task runs.

tenant_name/tenant_namespace are resolved at play-var evaluation time, so missing ansible_eda.event.payload.metadata can abort before Line 16’s guarded failure message. The when clause also needs intermediate-key checks (event, payload, metadata) to avoid undefined-attribute errors.

Suggested fix
   vars:
-    tenant_name: "{{ ansible_eda.event.payload.metadata.name }}"
-    tenant_namespace: "{{ ansible_eda.event.payload.metadata.namespace }}"
     _storage_tiers_raw: "{{ lookup('env', 'STORAGE_TIERS') }}"
@@
     - name: Validate tenant payload is present
       ansible.builtin.fail:
         msg: "tenant must be provided via ansible_eda.event.payload with metadata.name and metadata.namespace set"
       when: >-
         ansible_eda is not defined or
+        ansible_eda.event is not defined or
+        ansible_eda.event.payload is not defined or
+        ansible_eda.event.payload.metadata is not defined or
         ansible_eda.event.payload.metadata.name is not defined or
         ansible_eda.event.payload.metadata.name | length == 0 or
         ansible_eda.event.payload.metadata.namespace is not defined or
         ansible_eda.event.payload.metadata.namespace | length == 0
+
+    - name: Set tenant identifiers from validated payload
+      ansible.builtin.set_fact:
+        tenant_name: "{{ ansible_eda.event.payload.metadata.name }}"
+        tenant_namespace: "{{ ansible_eda.event.payload.metadata.namespace }}"

Also applies to: 16-24

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@playbook_osac_create_tenant_storage_backend.yml` around lines 7 - 8, The
play-level variables tenant_name and tenant_namespace are being dereferenced at
play evaluation time without guarding against missing intermediate keys in
ansible_eda.event.payload.metadata, which causes the playbook to fail before the
validation task at line 16. Add a when clause that checks for the existence of
each intermediate key (event, payload, and metadata) using the defined test
before dereferencing tenant_name and tenant_namespace. Apply the same defensive
checks to the when conditions at lines 16-24 to verify
ansible_eda.event.payload.metadata exists before attempting to access any nested
attributes within it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@playbook_osac_create_tenant_storage_backend.yml`:
- Around line 7-8: The play-level variables tenant_name and tenant_namespace are
being dereferenced at play evaluation time without guarding against missing
intermediate keys in ansible_eda.event.payload.metadata, which causes the
playbook to fail before the validation task at line 16. Add a when clause that
checks for the existence of each intermediate key (event, payload, and metadata)
using the defined test before dereferencing tenant_name and tenant_namespace.
Apply the same defensive checks to the when conditions at lines 16-24 to verify
ansible_eda.event.payload.metadata exists before attempting to access any nested
attributes within it.

In `@playbook_osac_delete_tenant_cluster_storage.yml`:
- Around line 7-8: The playbook is dereferencing nested properties
ansible_eda.event.payload.metadata.* in the vars section (tenant_name and
tenant_namespace variables) before the pre_tasks validation executes. If a
malformed event is passed without the intermediate properties (event, payload,
metadata), the dereference will fail before reaching the intended validation
logic. Fix this by adding comprehensive existence checks in the when condition
to verify all intermediate properties exist before allowing the playbook to
proceed, checking for ansible_eda.event, ansible_eda.event.payload, and
ansible_eda.event.payload.metadata in the guard clause. Apply the same fix to
the other variable dereferences mentioned in lines 16-24 that have the same
vulnerability.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 11b43bcb-7fd2-4d80-9549-118a3574c626

📥 Commits

Reviewing files that changed from the base of the PR and between b2ebc11 and 9e2f157.

📒 Files selected for processing (5)
  • collections/ansible_collections/osac/service/roles/storage_provider/tasks/teardown_cluster_storage.yaml
  • collections/ansible_collections/osac/templates/roles/vast_storage/tasks/teardown_cluster_storage.yaml
  • playbook_osac_create_tenant_storage_backend.yml
  • playbook_osac_delete_tenant_cluster_storage.yml
  • tests/integration/targets/storage_provider_teardown/tasks/main.yml

@akshaynadkarni

Copy link
Copy Markdown
Contributor

/retest

@akshaynadkarni

Copy link
Copy Markdown
Contributor

@coderabbitai resolve

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

@akshaynadkarni

Copy link
Copy Markdown
Contributor

/retest

@akshaynadkarni akshaynadkarni left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes LGTM
Thanks for addressing the comments.

I am trying to run the changes on my beaker, but I am running into issues due to a db migration issue. In the meantime, I have kicked off the E2E suite on the PR. Hoping it goes through 🤞 while I re-attempt to run the suite on my machine.

@openshift-ci

openshift-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akshaynadkarni, zszabo-rh

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

The pull request process is described 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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants