OSAC-3712: fix LVMS namespace resolution and tenant_name for hub storage - #198
Conversation
The LVMS storage role used a 2-tier namespace fallback (env var → hardcoded "osac-system"), missing the service account namespace file that the pod already mounts. In CI (deployed to osac-e2e-ci), the env var is unset so the role targeted osac-system — which doesn't exist — causing all backend provisioning jobs to fail with a 404. This cascaded: no backends → no StorageTiers → empty storage_tier_definitions → cluster storage jobs fail → ClusterStorageReady never becomes True → all VMaaS tests fail. Fix: add the SA namespace file lookup as middle tier, matching the vast_storage role's existing 3-tier resolution chain. Additionally, tenant_name in the cluster storage playbooks unconditionally read the osac.openshift.io/tenant annotation, but Tenant CRs don't carry that annotation — it only exists on ClusterOrders. For Tenant objects the name is simply metadata.name. Add a kind-based conditional matching the pattern already used for tenant_namespace. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: omer-vishlitzky <omer.vishlitzky@gmail.com>
|
@omer-vishlitzky: This pull request references OSAC-3712 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 bug to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
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. |
|
Warning Review limit reached
Next review available in: 35 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository: osac-project/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
WalkthroughChangesStorage routing updates
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@osac-aap/playbook_osac_create_tenant_cluster_storage.yml`:
- Around line 17-22: Validate the resource kind before deriving tenant_name in
both osac-aap/playbook_osac_create_tenant_cluster_storage.yml:17-22 and
osac-aap/playbook_osac_delete_tenant_cluster_storage.yml:16-21: accept only
Tenant and ClusterOrder, and reject any other kind. For ClusterOrder, require a
non-empty osac.openshift.io/tenant annotation before accessing it; retain
metadata.name as the Tenant source and apply identical validation before
creation and teardown.
🪄 Autofix
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: CHILL
Plan: Pro Plus
Run ID: 12fb3703-f19b-4410-859e-252f459d3aec
📒 Files selected for processing (3)
osac-aap/collections/ansible_collections/osac/templates/roles/lvms_storage/defaults/main.yamlosac-aap/playbook_osac_create_tenant_cluster_storage.ymlosac-aap/playbook_osac_delete_tenant_cluster_storage.yml
| tenant_name: >- | ||
| {%- if osac_job_vars.resource.kind == 'ClusterOrder' -%} | ||
| {{ osac_job_vars.resource.metadata.annotations['osac.openshift.io/tenant'] }} | ||
| {%- else -%} | ||
| {{ osac_job_vars.resource.metadata.name }} | ||
| {%- endif -%} |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Validate the resource kind and ClusterOrder annotation before deriving tenant_name.
Both playbooks treat every kind other than ClusterOrder as Tenant, and both index a possibly absent annotation. This can target the wrong tenant or fail before the storage role runs.
osac-aap/playbook_osac_create_tenant_cluster_storage.yml#L17-L22: accept onlyTenantandClusterOrder, and require a non-emptyosac.openshift.io/tenantannotation forClusterOrder.osac-aap/playbook_osac_delete_tenant_cluster_storage.yml#L16-L21: apply the same validation before teardown.
📍 Affects 2 files
osac-aap/playbook_osac_create_tenant_cluster_storage.yml#L17-L22(this comment)osac-aap/playbook_osac_delete_tenant_cluster_storage.yml#L16-L21
🤖 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 `@osac-aap/playbook_osac_create_tenant_cluster_storage.yml` around lines 17 -
22, Validate the resource kind before deriving tenant_name in both
osac-aap/playbook_osac_create_tenant_cluster_storage.yml:17-22 and
osac-aap/playbook_osac_delete_tenant_cluster_storage.yml:16-21: accept only
Tenant and ClusterOrder, and reject any other kind. For ClusterOrder, require a
non-empty osac.openshift.io/tenant annotation before accessing it; retain
metadata.name as the Tenant source and apply identical validation before
creation and teardown.
9a8e30e to
a9812e2
Compare
a9812e2 to
630c485
Compare
…solution Both lvms_storage and vast_storage roles had a hardcoded "osac-system" last-resort fallback for namespace resolution. This silently targeted the wrong namespace when both the env var and SA namespace file were unavailable, instead of failing loudly. The SA namespace file is always available in-cluster (mounted via downward API in the storage-operations-ig pod spec). Remove the fallback from both roles and use errors='strict' on the file lookup so misconfiguration produces an immediate, clear error. Also make tenant_name and tenant_namespace dispatches explicit — use elif Tenant instead of else, so unknown resource kinds produce an empty value caught by downstream validation rather than silently taking the Tenant path. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: omer-vishlitzky <omer.vishlitzky@gmail.com>
630c485 to
3f8ba69
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: omer-vishlitzky, zszabo-rh The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
21fa42e
into
osac-project:main
Summary
osac-systemosac-systemhardcoded fallback from bothlvms_storageandvast_storageroles — missing namespace propagates as empty string and fails at the k8s API call rather than silently targeting the wrong namespacetenant_nameandtenant_namespacein cluster storage playbooks: use explicitelif Tenantdispatch instead ofelsefallback, so unknown resource kinds produce an empty value caught by downstream validationRoot Cause
The LVMS role had a 2-tier namespace fallback (env var →
osac-system) that skipped the SA namespace file the pod already mounts. In CI (deployed toosac-e2e-ci), backend jobs targetedosac-system(404), cascading: no backends → no StorageTiers → emptystorage_tier_definitions→ClusterStorageReadystaysFalse→ all VMaaS tests fail.Separately,
tenant_namereadosac.openshift.io/tenantannotation unconditionally, but Tenant CRs don't carry it — only ClusterOrders do. And all kind-dispatch vars usedelsefallbacks that would silently accept unknown resource kinds.Design decisions
No
osac-systemfallback. The SA namespace file is always available in-cluster (mounted via downward API in the storage-operations-ig pod spec). If both the env var and the file are unavailable, that's a deployment bug that should fail — not silently target a hardcoded namespace. The file lookup useserrors='ignore'(noterrors='strict') because integration tests run outside a pod on GH Actions runners where the SA file doesn't exist; those tests setOSAC_STORAGE_CONFIG_NAMESPACEexplicitly viaenvironment:on each task.Explicit kind dispatch.
tenant_nameandtenant_namespaceuseelif Tenantinstead ofelse, so an unexpected resource kind produces an empty value caught by downstream validation rather than silently taking the Tenant path.Test plan
e2e-vmaas-full-install) passes with this changeosac-e2e-ciin CI)ClusterStorageReadycondition becomesTrueJira: OSAC-3712
🤖 Generated with Claude Code