OSAC-1992: wire Tier API into storage controller for validation and AAP extra_vars - #375
Conversation
|
@wgordon17: This pull request references OSAC-1992 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 story 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. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe storage controller optionally resolves Tier and Backend data through fulfillment gRPC clients, injects the results into provisioning and deprovisioning contexts, reports missing or ambiguous StorageClasses, and serializes the data into AAP event extra variables. ChangesStorage tier propagation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant main
participant StorageReconciler
participant StorageTiersLister
participant StorageBackendsGetter
participant AAPProvider
main->>StorageReconciler: Configure Tier and Backend clients
StorageReconciler->>StorageTiersLister: List storage tiers
StorageReconciler->>StorageBackendsGetter: Get backend connections
StorageReconciler->>AAPProvider: Trigger provisioning with context data
AAPProvider->>AAPProvider: Build storage extra variables
Possibly related PRs
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 |
2823292 to
65657cc
Compare
59e92f2 to
a16cd21
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@internal/controller/storage_controller.go`:
- Around line 236-246: The resolve-and-inject logic is duplicated between
handleUpdate and handleDelete. Extract it into a Controller helper named
withResolvedStorageContext(ctx) returning (context.Context, error), move the
TiersClient check, tier resolution, error propagation, and provisioning context
injection there, then replace both call sites with the helper so delete-path
leniency remains centralized.
- Around line 648-658: The tier-resolution failure in the reconcile flow should
be best-effort during deletion. Update the block calling resolveTierDefinitions
to detect the delete path, log the error, retain empty tierDefinitions and
backendConnections, and continue so storageFinalizer removal proceeds; preserve
the existing error return for non-delete reconciles.
🪄 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: c0a83f2f-92bd-4389-bd64-d5bf915682fb
📒 Files selected for processing (10)
cmd/main.gointernal/controller/storage_controller.gointernal/controller/storage_controller_test.gointernal/controller/storage_tier_definitions.gointernal/controller/storage_tier_resolution.gointernal/controller/tenant_names.gopkg/provisioning/aap_provider.gopkg/provisioning/aap_provider_test.gopkg/provisioning/extra_vars_context.gopkg/provisioning/extra_vars_context_test.go
Signed-off-by: Will Gordon <wgordon@redhat.com> Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Will Gordon <wgordon@redhat.com> Assisted-by: Claude Code <noreply@anthropic.com>
…ate and delete Signed-off-by: Will Gordon <wgordon@redhat.com> Assisted-by: Claude Code <noreply@anthropic.com>
…SAC-1957 Signed-off-by: Will Gordon <wgordon@redhat.com> Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Will Gordon <wgordon@redhat.com> Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Will Gordon <wgordon@redhat.com> Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Will Gordon <wgordon@redhat.com> Assisted-by: Claude Code <noreply@anthropic.com>
Rename StorageTiersClient to StorageTiersLister to match the
Get/Getter, List/Lister naming convention already used by
StorageBackendsGetter. Rename storage_tier_catalog.go to
storage_tier_definitions.go to match the package's
{concern}_{noun}.go convention and name it after what it returns
(provisioning.TierDefinition). Expand appendMissingTierWarnings's
doc comment to state explicitly that defined tiers come from the
Tier API (source of truth) while resolved/ambiguousTiers come from
pre-existing StorageClass label resolution (observed cluster state),
and that this function's purpose is to catch the gap between them.
Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Will Gordon <wgordon@redhat.com>
tierDefinitionsToExtraVars sent tier.QuotaGiB unconverted under the "quota" key, but osac-aap's vast_storage role passes it straight through as VAST's hard_limit, which the vendored vastdata.vms collection's own integration test fixtures confirm is bytes (e.g. 10737418240 == 10 GiB, expressed in bytes). A 500 GiB tier would have produced a 500-byte VAST quota. Renamed the key to quota_bytes (rather than reusing "quota") since the pre-existing static STORAGE_TIERS path already documents its own "quota" field as bytes — keeping the new gRPC-sourced field name unambiguous about units. The still-pending follow-on osac-aap PR that wires up storage_tier_definitions must read quota_bytes. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Will Gordon <wgordon@redhat.com>
A resolveTierDefinitions failure (Tier API List error or a non-NotFound Backend Get error) previously aborted the whole reconcile via a hard error return in both handleUpdate and handleDelete. For handleUpdate this blocked Stage 1/2 StorageClass logic that has no dependency on the Tier API; for handleDelete it blocked CaaS cleanup, deprovisioning, and finalizer removal, leaving a Tenant stuck in Terminating until the fulfillment service recovered. Extracted the duplicated resolve-and- inject block from both paths into resolveAndInjectTierContext, which now treats any resolution failure the same as a nil TiersClient: log and proceed with no tier data, since downstream consumers already handle that safely. Fixed a case-sensitivity bug in missingTierNames: StorageClass tier labels are lowercased by groupByTier, but TierDefinition.Name comes straight from the Tier API with no normalization, so a tier named with any uppercase character would be spuriously reported as missing even when a matching StorageClass exists. Lowercase only at the comparison site, not in TierDefinition.Name itself, to avoid changing the tier name value passed downstream to AAP. Changed TierDefinition.QosLimits from *TierQosLimits to a value type — tierDefinitionsToExtraVars dereferenced it unconditionally, and the pointer served no purpose since the sole producer always sets it. Reworded two doc comments that named specific downstream callers by function name (handleBackendProvisioning, handleCaaSUpdate, etc.), which was already covered by the same helper extraction. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Will Gordon <wgordon@redhat.com>
Guard resolveAndInjectTierContext on both TiersClient and BackendsGetter being non-nil, not just TiersClient. The two fields are always set together in cmd/main.go today, but nothing enforced that pairing at the call site — a reconciler constructed with TiersClient set and BackendsGetter left nil would panic on the first tier with a backend association, since resolveTierDefinitions calls backendsGetter.Get unconditionally. Added a regression test. Replaced a comment reference to "the PR description" (inaccessible after merge) with the tracking Jira story/AC for the required osac-aap follow-on change. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Will Gordon <wgordon@redhat.com>
Signed-off-by: Will Gordon <wgordon@redhat.com>
- Log a warning when TiersClient and BackendsGetter are half-wired (one set, one nil) instead of silently skipping tier resolution - Log when the tier list hits the unpaginated fetch limit - Replace resolveTenantSpecificStorageClasses's two adjacent []string returns with a named tenantSpecificStorageClasses struct Signed-off-by: Will Gordon <wgordon@redhat.com>
…r ComputeInstance JIT provisioning Signed-off-by: Will Gordon <wgordon@redhat.com> Assisted-by: Claude Code <noreply@anthropic.com>
StorageReconciler.resolveAndInjectTierContext was a thin wrapper around the free function in storage_tier_definitions.go, hardcoding the "tenant" log tag. ComputeInstanceReconciler calls the free function directly instead. Remove the wrapper and call the free function directly from both StorageReconciler call sites for consistency. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Will Gordon <wgordon@redhat.com>
The Stage 1 tier-injection test constructed a StorageReconciler with a mock AAP provider but no BackendsClient, so PR osac-project#354's new handleBackendReadiness gate (osac-1957) saw no backend registered and never called handleBackendProvisioning — the code path this test exists to cover. Set BackendsClient to a registered backend so the test reaches Stage 1's provisioning call as originally intended. Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Will Gordon <wgordon@redhat.com>
883931b to
d9c7cf3
Compare
Assisted-by: Claude Code <noreply@anthropic.com> Signed-off-by: Will Gordon <wgordon@redhat.com>
akshaynadkarni
left a comment
There was a problem hiding this comment.
Thanks for addressing the comment. Loved ❤️ the Backends cache. It will speed up processing 👍 .
Changes LGTM.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: akshaynadkarni, wgordon17 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 |
98869d6
into
osac-project:main
Summary
Summary by CodeRabbit