OCPBUGS-86008: Gate Route watch on management cluster capability#8484
OCPBUGS-86008: Gate Route watch on management cluster capability#8484smrtrfszm wants to merge 1 commit into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Skipping CI for Draft Pull Request. |
|
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe operator now performs a one-time management-cluster discovery at startup to detect capabilities and stores them in HostedClusterConfigOperatorConfig.ManagementClusterCapabilities. The resources controller's Setup consults that capability checker and registers a watch for OpenShift Route resources only when the Route capability is detected; startup returns an error if discovery or capability detection fails. Sequence Diagram(s)sequenceDiagram
participant Cmd
participant DiscoveryClient
participant ManagementClusterAPI
participant CapabilitiesDetector
participant ResourcesController
participant RouteAPI
Cmd->>DiscoveryClient: create discovery client from kubeconfig
DiscoveryClient->>ManagementClusterAPI: query API resources
ManagementClusterAPI-->>DiscoveryClient: API resource list
DiscoveryClient->>CapabilitiesDetector: provide resource list
CapabilitiesDetector-->>ResourcesController: capabilities (Route present / absent)
alt Route capability present
ResourcesController->>RouteAPI: register watch for Route resources
RouteAPI-->>ResourcesController: watch started
else Route capability absent
ResourcesController-->>ResourcesController: skip Route watch
end
🚥 Pre-merge checks | ✅ 11 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: smrtrfszm The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
daa5044 to
94461ec
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8484 +/- ##
==========================================
- Coverage 40.40% 40.40% -0.01%
==========================================
Files 755 755
Lines 93235 93249 +14
==========================================
Hits 37675 37675
- Misses 52858 52872 +14
Partials 2702 2702
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
94461ec to
f54aa29
Compare
|
@smrtrfszm: This pull request references Jira Issue OCPBUGS-86008, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. 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. |
|
@smrtrfszm: This pull request references Jira Issue OCPBUGS-86008, which is valid. 3 validation(s) were run on this bug
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. |
f54aa29 to
07098a5
Compare
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
`@control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources.go`:
- Around line 313-318: The reconcile logic still performs a Get on routev1.Route
even when the management cluster lacks the Route API; update the code to gate
that Route-dependent logic by checking
opts.ManagementClusterCapabilities.Has(capabilities.CapabilityRoute) before
attempting any route operations. Add the capability check either at the caller
that invokes reconcileMetricsForwarder or at the start of
reconcileMetricsForwarder itself so that when CapabilityRoute is false it
returns early (or skips the Route.Get/Route-specific flows) and does not attempt
to interact with routev1.Route.
🪄 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 YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 1d5b9f2e-167f-44f7-93d1-a03784aaf380
📒 Files selected for processing (3)
control-plane-operator/hostedclusterconfigoperator/cmd.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/resources/resources.gocontrol-plane-operator/hostedclusterconfigoperator/operator/config.go
|
/lgtm |
|
Scheduling tests matching the |
The hosted-cluster-config-operator unconditionally watches route.openshift.io/v1 Routes against the management cluster to react to hostname changes on the metrics-proxy Route. On management clusters that do not expose the Routes API (e.g. non-OpenShift management clusters) this watch fails during controller setup and prevents HCCO from starting. Detect the management cluster Route capability using the existing capabilities.DetectManagementClusterCapabilities helper and only register the watch when route.openshift.io is registered. This mirrors the pattern already used in other parts of the code.
07098a5 to
1f4af14
Compare
|
/lgtm |
|
Scheduling tests matching the |
|
/retest |
AI Test Failure AnalysisJob: Generated by hypershift-analyze-e2e-failure post-step using Claude claude-opus-4-6 |
|
/retest |
1 similar comment
|
/retest |
|
@smrtrfszm: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
/verified by @smrtrfszm Before this change on a vanilla kubernetes, HCCO was in a crash loop with error message: After this change on a vanilla kubernetes, HCCO is 1/1 ready: |
|
@smrtrfszm: This PR has been marked as verified by 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. |
|
I now have all the information needed for a complete analysis. Here is the report: Test Failure Analysis CompleteJob Information
Test Failure AnalysisErrorSummaryBoth Codecov checks fail because the PR introduces 38 new executable lines across two files — Root CauseThe PR adds two blocks of untested executable code:
The The Recommendations
Evidence
|
What this PR does / why we need it:
The hosted-cluster-config-operator unconditionally watches route.openshift.io/v1 Routes against the management cluster to react to hostname changes on the metrics-proxy Route. On management clusters that do not expose the Routes API (e.g. non-OpenShift management clusters) this watch fails during controller setup and prevents HCCO from starting.
Detect the management cluster Route capability using the existing
capabilities.DetectManagementClusterCapabilitieshelper and only register the watch when route.openshift.io is registered. This mirrors the pattern already used in other parts of the code.Which issue(s) this PR fixes:
Fixes #OCPBUGS-86008
Special notes for your reviewer:
Checklist:
Summary by CodeRabbit