OSAC-3132: migrate networking feedback controllers to Bridge #401
@vladikr: This pull request references OSAC-3132 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
>Migrate four networking feedback controllers to use the feedback.Bridge extracted in PR #387. Each controller is migrated in a separate commit for easy review.>| Commit | Controller | Lines removed |
>|--------|-----------|---------------|
>| 1 | VirtualNetwork | 273 → 120 |
>| 2 | SecurityGroup | 278 → 118 |
>| 3 | NATGateway | 245 → 117 |
>| 4 | ExternalIPPool | 299 → 121 |
>All four follow the exact same pattern as the Subnet migration in #387 — the reconciler struct is thinned to hold only the Bridge and namespace, the constructor wires the Bridge callbacks, andReconciledelegates tobridge.Reconcile. Only the resource-specific sync functions (phase mapping, delete state mapping) remain.
>## Changes per controller
>- Replaced the 6-step hand-writtenReconcilewithbridge.Reconciledelegation
>- Removed
FeedbackReconcilerTask struct, fetch, save, handleUpdate, handleDelete methods>- Kept resource-specific
syncPhase and sync*Delete as standalone functions>- Added nil guard on
GetObject() in Fetch callbacks (consistent with Subnet in #387)>-
SetupWithManager unchanged>## Notable: VirtualNetwork
>VN proto has noDELETING/DELETE_FAILEDstates — deletion mapsFailed→FAILEDand everything else →PENDING. This behavior is preserved exactly from the original.
>## What's next
>Per the migration plan in #387:
>- [x] ~~Subnet~~ (PR #387)
>- [x] VirtualNetwork, SecurityGroup, NATGateway, ExternalIPPool (this PR)
>- [ ] ComputeInstance (gains missing NotFound fix)
>- [ ] ClusterOrder (gains missing NotFound fix)
>- [ ] ExternalIP (uses
IsNotFound)>- [ ] ExternalIPAttachment (uses
PostSaveOnDelete)>## Test plan
>- [x] make lint — 0 issues>- [x]
make test — all pass (controller coverage 72.0%)>- [x] All existing feedback controller tests pass unchanged for each migrated controller
>Jira: https://redhat.atlassian.net/browse/OSAC-3132
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.
</details>
<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- review_stack_entry_start -->

<!-- review_stack_entry_end -->
<!-- This is an auto-generated comment: rate limited by coderabbit.ai -->
[!WARNING]
## Review limit reached
> @vladikr, you've reached your PR review limit, so we couldn't start this review.> Next review available in: 40 minutes
> Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).
> <details>
<summary>How can I continue?</summary>
> After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.> 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.
> </details>
>
<details>
<summary>How do review limits work?</summary>
> 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.
> </details>
> <details>
<summary>Review details</summary>
> <details>
<summary>⚙️ Run configuration</summary>
> Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml
> Review profile: ASSERTIVE
> Plan: Pro Plus
> Run ID: f8e856cc-da44-4aff-98a9-e4a293f3310a> </details>
> <details>
<summary>📥 Commits</summary>
> Reviewing files that changed from the base of the PR and between 39dc67adf02720cb4534de883bc81ca925610915 and 674c2b84de48fd1716f3f0cec50cdbf8f59e9378.
> </details>
> <details>
<summary>📒 Files selected for processing (1)</summary>
> internal/controller/externalippool_feedback_controller.go> </details>
> </details>
<!-- end of auto-generated comment: rate limited by coderabbit.ai -->
<!-- walkthrough_start -->
Walkthrough
Four feedback controllers were refactored to use a shared feedback.Bridge. Constructors configure fulfillment-service callbacks and phase synchronization, while Reconcile delegates to the bridge.
Changes
Feedback bridge reconciliation
|Layer / File(s)|Summary|
|---|---|
|Bridge construction and callback wiring <br> internal/controller/_feedback_controller.go|The four reconcilers now store typed bridges configured with fulfillment-service fetch, save, signal, object initialization, identity metadata, and synchronization callbacks.|
|Delegated reconciliation and phase synchronization <br> internal/controller/*_feedback_controller.go|Reconcile delegates to bridge.Reconcile; update and delete callbacks map CR phases to fulfillment-service states, including deletion failure handling and unknown-phase logging.|
Estimated code review effort: 4 (Complex) | ~45 minutes
Possibly related PRs
feedback.Bridge pattern used by these controller refactors.NotFound handling in the same feedback controllers.Suggested labels: ok-to-test
Suggested reviewers: alosadagrande
<!-- walkthrough_end -->
<!-- pre_merge_checks_walkthrough_start -->
<details>
<summary>🚥 Pre-merge checks | ✅ 11</summary>
<details>
<summary>✅ Passed checks (11 passed)</summary>
| Check name | Status | Explanation |
| :------------------------: | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly matches the main change: migrating networking feedback controllers to the shared Bridge abstraction. |
| 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 | Scanned the four modified controllers; no hardcoded secrets, embedded-credential URLs, private keys, base64 blobs, or credential-named string literals found. |
| No-Weak-Crypto | ✅ Passed | PASS: Reviewed the migrated controllers and shared bridge; no MD5/SHA1/DES/RC4/ECB, custom crypto, or secret-comparison code was added. |
| No-Injection-Vectors | ✅ Passed | PASS: The touched controllers only use typed gRPC builders and bridge delegation; no eval/exec, shell, yaml.load, os.system, pickle, SQL, or unsafe DOM sinks found. |
| Container-Privileges | ✅ Passed | Repo-wide scan found no privileged/hostPID/hostNetwork/hostIPC/SYS_ADMIN/use-as-root settings; manifests only show allowPrivilegeEscalation: false. |
| No-Sensitive-Data-In-Logs | ✅ Passed | Only generic unknown-phase logs appear, and they print a phase enum—not secrets, PII, hostnames, or customer data. |
| Ai-Attribution | ✅ Passed | All four PR commits include Assisted-by: Claude Code trailers, and the PR range has no Co-Authored-By AI attribution. |
</details>
</details>
<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->
<details>
<summary>✨ Finishing Touches</summary>
<details>
<summary>🧪 Generate unit tests (beta)</summary>
</details>
</details>
<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->
---
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.
<details>
<summary>❤️ Share</summary>
</details>
<sub>Comment @coderabbitai help to get the list of available commands.</sub>
<!-- tips_end -->
_📐 Maintainability & Code Quality_ | _🔵 Trivial_ | _💤 Low value_
Use errors.New here for consistency with the sibling controllers.
fmt.Errorf with no format verbs is just errors.New; the other three migrated controllers already use errors.New. Some linters (perfsprint) flag this too.
<details>
<summary>♻️ Suggested tweak</summary>
- if pool == nil {
- return nil, fmt.Errorf("external IP pool not found: response contained nil object")
- }
+ if pool == nil {
+ return nil, errors.New("external IP pool response contained nil object")
+ }
Add the import:
import (
"errors"
"fmt"
)
</details>
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Fetch: func(ctx context.Context, id string) (*privatev1.ExternalIPPool, error) {
response, err := poolClient.Get(ctx, privatev1.ExternalIPPoolsGetRequest_builder{Id: id}.Build())
if err != nil {
return nil, err
}
pool := response.GetObject()
if pool == nil {
return nil, errors.New("external IP pool response contained nil object")
}
if !pool.HasSpec() {
pool.SetSpec(&privatev1.ExternalIPPoolSpec{})
}
if !pool.HasStatus() {
pool.SetStatus(&privatev1.ExternalIPPoolStatus{})
}
return pool, nil
},
</details>
<!-- suggestion_end -->
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/controller/externalippool_feedback_controller.go` around lines 50 -
66, In the Fetch callback, replace the fmt.Errorf call used for the nil pool
response with errors.New, and add the errors import while retaining fmt if used
elsewhere in the file. Keep the existing error message unchanged.
</details>
<!-- fingerprinting:phantom:medusa:komodo -->
<!-- cr-indicator-types:nitpick -->
<!-- cr-comment:v1:3454a6b280786270e38baddb -->
<!-- This is an auto-generated reply by CodeRabbit -->
✅ Addressed in commit 674c2b8
Actionable comments posted: 1
<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>
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/externalippool_feedback_controller.go`:
- Around line 50-66: In the Fetch callback, replace the fmt.Errorf call used for
the nil pool response with errors.New, and add the errors import while retaining
fmt if used elsewhere in the file. Keep the existing error message unchanged.
</details>
<details>
<summary>🪄 Autofix (Beta)</summary>
Fix all unresolved CodeRabbit comments on this PR:
</details>
---
<details>
<summary>ℹ️ Review info</summary>
<details>
<summary>⚙️ Run configuration</summary>
Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 2e08bb6f-ccf4-4e84-820e-6594859fc1bd
</details>
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between 919373435f94b9a8a997baeb3a90e9a06980617f and 39dc67adf02720cb4534de883bc81ca925610915.
</details>
<details>
<summary>📒 Files selected for processing (4)</summary>
internal/controller/externalippool_feedback_controller.go
internal/controller/natgateway_feedback_controller.go
internal/controller/securitygroup_feedback_controller.go
internal/controller/virtualnetwork_feedback_controller.go
</details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
Approved these changes.
done
@vladikr, confirmed — the nil-response error now uses errors.New consistently. Thanks for addressing it.
<!-- <review_comment_addressed> -->
---
<!-- This is an auto-generated comment: tweet message by coderabbit.ai -->
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
<!-- end of auto-generated comment: tweet message by coderabbit.ai -->
<!-- This is an auto-generated reply by CodeRabbit -->
@tzvatot, just a follow-up, migrating the next set of controllers.
I separated each to a separate commit so it will be easier to review.
Clean mechanical migration of four feedback controllers to the shared feedback.Bridge from PR #387. Each controller follows the exact same pattern as the Subnet migration: constructor wires Bridge callbacks, Reconcile becomes a one-liner, and only resource-specific phase mapping remains. Net reduction of 563 lines with all existing tests passing unchanged.
Verified:
errors.New used consistently for nil-object errors/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/osac-project/osac-operator/pull/401#pullrequestreview-4808091989" title="Approved">tzvatot</a>, <a href="https://github.com/osac-project/osac-operator/pull/401#" title="Author self-approved">vladikr</a>
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
</details>
<!-- META={"approvers":[]} -->
tzvatot
vladikr
Summary
Migrate four networking feedback controllers to use the
feedback.Bridgeextracted in PR #387. Each controller is migrated in a separate commit for easy review.| Commit | Controller | Lines removed |
|--------|-----------|---------------|
| 1 | VirtualNetwork | 273 → 120 |
| 2 | SecurityGroup | 278 → 118 |
| 3 | NATGateway | 245 → 117 |
| 4 | ExternalIPPool | 299 → 121 |
All four follow the exact same pattern as the Subnet migration in #387 — the reconciler struct is thinned to hold only the Bridge and namespace, the constructor wires the Bridge callbacks, and
Reconciledelegates tobridge.Reconcile. Only the resource-specific sync functions (phase mapping, delete state mapping) remain.Changes per controller
Reconcilewithbridge.ReconciledelegationFeedbackReconcilerTaskstruct,fetch,save,handleUpdate,handleDeletemethodssyncPhaseandsyncDeleteas standalone functionsGetObject()in Fetch callbacks (consistent with Subnet in #387)SetupWithManagerunchangedNotable: VirtualNetwork
VN proto has no
DELETING/DELETE_FAILEDstates — deletion mapsFailed→FAILEDand everything else →PENDING. This behavior is preserved exactly from the original.What's next
Per the migration plan in #387:
IsNotFound)PostSaveOnDelete)Test plan
make lint— 0 issuesmake test— all pass (controller coverage 72.0%)Jira: https://redhat.atlassian.net/browse/OSAC-3132
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
Refactor
Improved synchronization of external IP pools, NAT gateways, security groups, and virtual networks with the fulfillment service.
Standardized update and deletion handling across supported networking resources.
Improved propagation of resource phases and deletion failures to corresponding remote states.
Preserved existing controller registration and namespace-based event filtering.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->