Skip to content

OCPBUGS-81741: Watch Network and Infrastructure in proxyconfig controller#2968

Open
jluhrsen wants to merge 1 commit into
openshift:masterfrom
jluhrsen:OCPBUGS-81741-master
Open

OCPBUGS-81741: Watch Network and Infrastructure in proxyconfig controller#2968
jluhrsen wants to merge 1 commit into
openshift:masterfrom
jluhrsen:OCPBUGS-81741-master

Conversation

@jluhrsen
Copy link
Copy Markdown
Contributor

@jluhrsen jluhrsen commented Apr 22, 2026

The proxyconfig controller reads Network.Status.ClusterNetwork and Infrastructure.Status to compute Proxy.Status.NoProxy, but only watched Proxy and ConfigMaps. Network or Infrastructure changes would not trigger reconciliation, leaving proxy status stale.

Add watches for Network and Infrastructure resources to ensure reconciliation occurs when these resources change.

Also add Proxy status subresource support to fake client and unit tests covering reconciliation logic.

Co-authored-by: Claude Code <noreply@anthropic.com)

Summary by CodeRabbit

  • Tests

    • Added comprehensive unit tests for proxy configuration reconciliation, validating status updates when network and infrastructure resources change and handling missing resources.
  • Improvements

    • Controller now watches Network and Infrastructure resources and updates proxy status when those resources change.
  • Chores

    • Test harness updated to include proxy status handling for more accurate status-related tests.

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Apr 22, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@jluhrsen: This pull request references Jira Issue OCPBUGS-81741, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

The proxyconfig controller reads Network.Status.ClusterNetwork and Infrastructure.Status to compute Proxy.Status.NoProxy, but only watched Proxy and ConfigMaps. Network or Infrastructure changes would not trigger reconciliation, leaving proxy status stale.

Add watches for Network and Infrastructure resources to ensure reconciliation occurs when these resources change.

Also add Proxy status subresource support to fake client and unit tests covering reconciliation logic.

Co-authored-by: Claude Code <noreply@anthropic.com)

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-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Apr 22, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ebe9f39e-88a5-4976-bc69-605872604d8e

📥 Commits

Reviewing files that changed from the base of the PR and between 16d068b and 74e43ba.

📒 Files selected for processing (3)
  • pkg/client/fake/fake_client.go
  • pkg/controller/proxyconfig/controller.go
  • pkg/controller/proxyconfig/controller_test.go

Walkthrough

Adds Proxy to the fake client's status subresources, registers watches for configv1.Network and configv1.Infrastructure in the proxycontroller, and adds unit tests that verify Proxy.Status.NoProxy updates from Network and Infrastructure changes and error handling when resources are missing.

Changes

Proxy status and watches

Layer / File(s) Summary
Fake client: include Proxy in status subresources
pkg/client/fake/fake_client.go
NewFakeClient constructs a configv1.Proxy and passes it to the fake client builder's WithStatusSubresource, enabling Proxy status handling in tests.
Controller: watch Network and Infrastructure
pkg/controller/proxyconfig/controller.go
add(mgr, r) registers watches for configv1.Network and configv1.Infrastructure using handler.EnqueueRequestForObject{}, returning watch setup errors from add.
Tests: init and reconciliation scenarios
pkg/controller/proxyconfig/controller_test.go
Adds tests that register configv1 types, seed a fake client, and verify ReconcileProxyConfig.Reconcile updates Proxy.Status.NoProxy for Network CIDR changes and Infrastructure APIServerInternalURL hostname changes; also tests empty Proxy spec and missing-resource error cases.

Sequence Diagram(s)

sequenceDiagram
  participant Network as Network (configv1)
  participant Infrastructure as Infrastructure (configv1)
  participant Controller as Controller
  participant Reconciler as Reconciler
  participant Proxy as Proxy (configv1)

  Note over Network,Infrastructure: Resource change events
  Network->>Controller: change event (ClusterNetwork)
  Infrastructure->>Controller: change event (APIServerInternalURL)

  Controller->>Reconciler: Enqueue reconcile request
  Reconciler->>Network: Read ClusterNetwork CIDRs
  Reconciler->>Infrastructure: Read APIServerInternalURL
  Reconciler->>Proxy: Update Status.NoProxy (CIDRs + hostname)
  Proxy->>Reconciler: Status updated
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Test Structure And Quality ❓ Inconclusive Custom check requires Ginkgo patterns (BeforeEach, It blocks, Eventually), but these are standard Go tests. Codebase uses only standard Go testing (28 testing.T tests, zero Ginkgo). Clarify if Ginkgo requirements apply to standard Go tests or provide appropriate testing.T guidelines for this codebase's testing framework.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly reflects the main change: adding watches for Network and Infrastructure resources to the proxyconfig controller, which aligns with all file changes.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
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.
Stable And Deterministic Test Names ✅ Passed PR contains no Ginkgo tests. The new tests in controller_test.go use standard Go testing package with stable, deterministic function names. Ginkgo check is not applicable.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests were added. The PR adds only standard Go unit tests (TestReconcile*) which use the testing package, not Ginkgo patterns.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests were added. The new test file contains only standard Go unit tests using the testing package with fake clients, not cluster-dependent e2e tests.
Topology-Aware Scheduling Compatibility ✅ Passed PR only modifies controller wiring and test infrastructure, introducing no deployment manifests, pod specs, affinity rules, nodeSelectors, tolerations, or topology assumptions.
Ote Binary Stdout Contract ✅ Passed No stdout violations in process-level code. No fmt.Print, klog, or os.Stdout found. The init() function only registers types.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds only unit tests using Go's standard testing.T framework, not Ginkgo e2e tests. The custom check applies only to Ginkgo e2e tests (It(), Describe(), etc.), making it not applicable here.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="Running error: context loading failed: failed to load packages: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: inconsistent vendoring in :\n\tgithub.com/Masterminds/semver@v1.5.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/Masterminds/sprig/v3@v3.2.3: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/containernetworking/cni@v0.8.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/ghodss/yaml@v1.0.1-0.20190212211648-25d852aebe32: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/go-bindata/go-bindata@v3.1.2+incompatible: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/onsi/gomega@v1.39.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/ope

... [truncated 17357 characters] ...

red in go.mod, but not marked as explicit in vendor/modules.txt\n\tk8s.io/gengo/v2@v2.0.0-20251215205346-5ee0d033ba5b: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tk8s.io/kms@v0.35.2: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tk8s.io/kube-aggregator@v0.35.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tsigs.k8s.io/randfill@v1.0.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tsigs.k8s.io/structured-merge-diff/v6@v6.3.2: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\n\tTo ignore the vendor directory, use -mod=readonly or -mod=mod.\n\tTo sync the vendor directory, run:\n\t\tgo mod vendor\n"


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

@openshift-ci openshift-ci Bot requested review from mattedallo and tssurya April 22, 2026 02:41
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 22, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jluhrsen
Once this PR has been reviewed and has the lgtm label, please assign jcaamano for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/controller/proxyconfig/controller_test.go (1)

220-228: Also assert that the old API hostname is removed.

Right now this test only proves the new hostname was added. It would still pass if reconciliation appended the new host without dropping the stale one.

Suggested assertion
 	if !strings.Contains(proxy.Status.NoProxy, updatedAPIServer) {
 		t.Errorf("Expected proxy.Status.NoProxy to contain updated API server %s, got: %s",
 			updatedAPIServer, proxy.Status.NoProxy)
 	}
+	if strings.Contains(proxy.Status.NoProxy, initialAPIServer) {
+		t.Errorf("proxy.Status.NoProxy still contains old API server %s, got: %s",
+			initialAPIServer, proxy.Status.NoProxy)
+	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/controller/proxyconfig/controller_test.go` around lines 220 - 228, The
test currently only asserts that proxy.Status.NoProxy contains updatedAPIServer;
also assert that the previous API hostname is removed by checking that
strings.Contains(proxy.Status.NoProxy, oldAPIServer) is false (use whatever
variable name holds the pre-update hostname in this test), i.e., add an
assertion after fetching proxy that proxy.Status.NoProxy does NOT contain the
old API hostname to ensure reconciliation replaced rather than appended the
host.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/controller/proxyconfig/controller_test.go`:
- Around line 220-228: The test currently only asserts that proxy.Status.NoProxy
contains updatedAPIServer; also assert that the previous API hostname is removed
by checking that strings.Contains(proxy.Status.NoProxy, oldAPIServer) is false
(use whatever variable name holds the pre-update hostname in this test), i.e.,
add an assertion after fetching proxy that proxy.Status.NoProxy does NOT contain
the old API hostname to ensure reconciliation replaced rather than appended the
host.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 41e9f990-8f6b-40f0-b896-52eb993948a5

📥 Commits

Reviewing files that changed from the base of the PR and between bdbba59 and 16d068b.

📒 Files selected for processing (3)
  • pkg/client/fake/fake_client.go
  • pkg/controller/proxyconfig/controller.go
  • pkg/controller/proxyconfig/controller_test.go

@jluhrsen
Copy link
Copy Markdown
Contributor Author

/retest

@jluhrsen
Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label May 20, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@jluhrsen: This pull request references Jira Issue OCPBUGS-81741, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label May 20, 2026
The proxyconfig controller reads Network.Status.ClusterNetwork and
Infrastructure.Status to compute Proxy.Status.NoProxy, but only watched
Proxy and ConfigMaps. Network or Infrastructure changes would not
trigger reconciliation, leaving proxy status stale.

Add watches for Network and Infrastructure resources to ensure
reconciliation occurs when these resources change.

Also add Proxy status subresource support to fake client and unit tests
covering reconciliation logic.

Signed-off-by: Jamo Luhrsen <jluhrsen@gmail.com>
Co-authored-by: Claude Code <noreply@anthropic.com)
@jluhrsen jluhrsen force-pushed the OCPBUGS-81741-master branch from 16d068b to 74e43ba Compare May 20, 2026 22:46
@jluhrsen
Copy link
Copy Markdown
Contributor Author

@danwinship @tssurya @kyrtapz @pliurh looking for someone to check on this. it's been sitting idle on my open bug list for a while now. haven't really followed up to find a reviewer yet.

I've verified the fix manually and passed this through coderabbit review (locally). should be good for a human to look now.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 21, 2026

@jluhrsen: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-upgrade 74e43ba link true /test e2e-aws-ovn-upgrade
ci/prow/security 74e43ba link false /test security
ci/prow/e2e-azure-ovn-upgrade 74e43ba link true /test e2e-azure-ovn-upgrade
ci/prow/4.22-upgrade-from-stable-4.21-e2e-azure-ovn-upgrade 74e43ba link false /test 4.22-upgrade-from-stable-4.21-e2e-azure-ovn-upgrade
ci/prow/e2e-aws-ovn-fdp-qe 74e43ba link true /test e2e-aws-ovn-fdp-qe

Full PR test history. Your PR dashboard.

Details

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants