OSAC-1460: Wire dispatcher into controllers behind feature gate - #126
Conversation
|
@SiddarthR56: This pull request references OSAC-1460 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. 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:
WalkthroughNetworking startup now creates one shared dispatcher resolver. VirtualNetwork, Subnet, and SecurityGroup reconcilers use NetworkClass-based strategy resolution with legacy fallbacks and explicit error handling. Tests cover resolution, fallback, ambiguity, and dynamic strategy changes. ChangesDispatcher strategy resolution
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant Startup
participant Resolver
participant NetworkController
participant NetworkClass
Startup->>Resolver: create shared resolver
Startup->>NetworkController: pass resolver
NetworkController->>NetworkClass: obtain NetworkClass context
NetworkController->>Resolver: resolve implementation strategy
Resolver-->>NetworkController: resolved strategy or fallback/error
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 10 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (10 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: 3
🤖 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-operator/internal/controller/subnet_controller_test.go`:
- Around line 379-386: Replace ignored deferred cleanup in
subnet_controller_test.go at lines 379-386, 418-426, and 457-465 with a shared
DeferCleanup helper that asserts Update and Delete results. For temporary Subnet
resources, clear osacSubnetFinalizer before updating and deleting; use the
checked helper for temporary VirtualNetwork resources, ensuring no cleanup error
returns are ignored.
In `@osac-operator/internal/controller/subnet_controller.go`:
- Around line 195-202: Update the parent VirtualNetwork lookup before
resolveImplementationStrategy to require exactly one matching resource, not
merely a non-empty vnetList. Preserve the existing zero-match handling, and for
multiple matches stop dispatch by returning an explicit ambiguity error or
requeueing instead of selecting vnetList.Items[0].
In `@osac-operator/internal/controller/virtualnetwork_controller.go`:
- Around line 158-165: Update the VirtualNetwork desired-config version
calculation to hash the resolved implementationStrategy together with vnet.Spec,
rather than hashing only the spec; use the corresponding Subnet and
SecurityGroup hashing pattern. Add a regression test covering a strategy change
with unchanged spec that produces a new DesiredConfigVersion and allows
provisioning to proceed.
🪄 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: Pro Plus
Run ID: a7e17f6e-0165-4a30-9d5f-d6a829ea2830
📒 Files selected for processing (12)
osac-operator/cmd/main.goosac-operator/internal/controller/constants_common.goosac-operator/internal/controller/dispatcher_helpers.goosac-operator/internal/controller/dispatcher_resolver_helpers_test.goosac-operator/internal/controller/securitygroup_controller.goosac-operator/internal/controller/securitygroup_controller_test.goosac-operator/internal/controller/subnet_controller.goosac-operator/internal/controller/subnet_controller_test.goosac-operator/internal/controller/virtualnetwork_controller.goosac-operator/internal/controller/virtualnetwork_controller_test.goosac-operator/pkg/dispatcher/resolver.goosac-operator/pkg/dispatcher/resolver_test.go
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
osac-operator/internal/controller/subnet_controller_test.go (1)
500-503: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the fabric-manager resolution error.
This test accepts any reconcile error. An error before dispatcher resolution would pass the test. Assert that
err.Error()containsresolving fabricManager "does-not-exist".Suggested assertion
Expect(err).To(HaveOccurred()) +Expect(err.Error()).To(ContainSubstring(`resolving fabricManager "does-not-exist"`))🤖 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-operator/internal/controller/subnet_controller_test.go` around lines 500 - 503, Strengthen the assertion in the Reconcile test for the missing fabric manager by verifying that err.Error() contains resolving fabricManager "does-not-exist", while retaining the existing error-present check. This ensures the failure comes from fabric-manager resolution rather than an unrelated reconciliation error.
🤖 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.
Nitpick comments:
In `@osac-operator/internal/controller/subnet_controller_test.go`:
- Around line 500-503: Strengthen the assertion in the Reconcile test for the
missing fabric manager by verifying that err.Error() contains resolving
fabricManager "does-not-exist", while retaining the existing error-present
check. This ensures the failure comes from fabric-manager resolution rather than
an unrelated reconciliation error.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b6babd14-7eaa-4c66-95fa-61262e265228
📒 Files selected for processing (12)
osac-operator/cmd/main.goosac-operator/internal/controller/constants_common.goosac-operator/internal/controller/dispatcher_helpers.goosac-operator/internal/controller/dispatcher_resolver_helpers_test.goosac-operator/internal/controller/securitygroup_controller.goosac-operator/internal/controller/securitygroup_controller_test.goosac-operator/internal/controller/subnet_controller.goosac-operator/internal/controller/subnet_controller_test.goosac-operator/internal/controller/virtualnetwork_controller.goosac-operator/internal/controller/virtualnetwork_controller_test.goosac-operator/pkg/dispatcher/resolver.goosac-operator/pkg/dispatcher/resolver_test.go
🚧 Files skipped from review as they are similar to previous changes (10)
- osac-operator/internal/controller/constants_common.go
- osac-operator/cmd/main.go
- osac-operator/pkg/dispatcher/resolver.go
- osac-operator/pkg/dispatcher/resolver_test.go
- osac-operator/internal/controller/subnet_controller.go
- osac-operator/internal/controller/virtualnetwork_controller.go
- osac-operator/internal/controller/securitygroup_controller.go
- osac-operator/internal/controller/securitygroup_controller_test.go
- osac-operator/internal/controller/virtualnetwork_controller_test.go
- osac-operator/internal/controller/dispatcher_helpers.go
|
/retest |
|
Re-triggered failed runs:
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danmanor, SiddarthR56 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 |
|
New changes are detected. LGTM label has been removed. |
|
/retest |
|
Re-triggered failed runs:
|
|
/retest |
|
Re-triggered failed runs:
|
Assisted-by: Cursor/Claude
…anager The dispatcher now eagerly resolves both fabricManager and k8sManager on the default cudn-net NetworkClass, but neither was registered in the operator's Helm defaults, causing VirtualNetwork/Subnet reconciliation to fail with "fabric manager \"cudn_net\" not found" in E2E. - values.yaml: enable networkManagers and register cudn_net as a fabric manager ConfigMap (ipv4/ipv6/dualStack, matching its argument_specs). - cudn_net/meta/osac.yaml: remove the k8s_manager: cudn_localnet claim. cudn_net's Subnet role already creates a self-contained CUDN (isolated Layer2/Primary) with no separate physical fabric to bridge into, so this NetworkClass is fabric-only. A real cudn_localnet k8sManager (LocalNet bridging) is tracked separately under OSAC-1511. Co-authored-by: Cursor <cursoragent@cursor.com>
…rk_policy
The dispatcher resolves SecurityGroup's implementation-strategy to the
cudn-net NetworkClass's fabric manager ("cudn_net"), so
playbook_osac_create_security_group.yml includes
osac.templates.cudn_net with tasks_from: create_security_group. That
task file never existed in cudn_net -- SecurityGroup enforcement
(NetworkPolicy) was extracted into the standalone network_policy role
in OSAC-1156 for reuse across K8s-based NetworkClasses, but cudn_net
was never given a forwarding entrypoint. This was previously masked
because VirtualNetwork/Subnet reconciliation failed earlier (see prior
commit), so the E2E test never reached the SecurityGroup step.
Add tasks/create_security_group.yaml and tasks/delete_security_group.yaml
to cudn_net that delegate to osac.templates.network_policy, plus
matching argument_specs and README documentation.
Co-authored-by: Cursor <cursoragent@cursor.com>
|
New changes are detected. LGTM label has been removed. |
|
🤖 Finished Review · ✅ Success · Started 1:52 PM UTC · Completed 2:09 PM UTC Commit: |
ReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Next steps:
|
…dling - cmd/main.go: split an overly long resolver-construction line to satisfy the golangci-lint line-length (lll) check that was failing pre-commit CI. - dispatcher_helpers.go: fix an orphaned mid-sentence line break in a doc comment (fullsend-ai-review nit). - securitygroup_controller.go: SecurityGroup treated an ambiguous parent VirtualNetwork lookup (multiple resources sharing the same UUID label) the same as "not found", silently falling back to the legacy strategy. Error out instead, matching the Subnet controller's existing guard, since more than one match indicates label data corruption rather than an expected pre-migration state. Adds a regression test mirroring Subnet's. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Siddarth R <sroyapal@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 2:55 PM UTC · Completed 3:13 PM UTC Commit: |
| # osac.openshift.io/network-fabric-manager or osac.openshift.io/network-k8s-manager. | ||
| networkManagers: | ||
| enabled: false | ||
| enabled: true |
There was a problem hiding this comment.
[medium] feature-gate-default-change
The networkManagers.enabled default is changed from false to true, making it active for all deployments on upgrade. The new cudn_net fabric manager entry is also enabled: true, so upgrading creates a new ConfigMap and triggers NetworkClass capability reconciliation. While the downstream impact is limited (read-reconcile loop, no unsafe mutations), changing a Helm default warrants documentation.
Suggested fix: Document in the PR description or release notes that this is an intentional default change, or keep false as the default with environment-specific overrides.
Summary by CodeRabbit
New Features
Bug Fixes