Skip to content

🌱 move BuildHTTPClient from shared httputil to catalogmetadata/client#2782

Merged
openshift-merge-bot[bot] merged 1 commit into
operator-framework:mainfrom
joelanford:move-httpclient-to-catalogclient
Jun 25, 2026
Merged

🌱 move BuildHTTPClient from shared httputil to catalogmetadata/client#2782
openshift-merge-bot[bot] merged 1 commit into
operator-framework:mainfrom
joelanford:move-httpclient-to-catalogclient

Conversation

@joelanford

@joelanford joelanford commented Jun 24, 2026

Copy link
Copy Markdown
Member

Description

Move BuildHTTPClient from internal/shared/util/http into
internal/operator-controller/catalogmetadata/client, since it is only
used by the catalog client. This reduces the surface of the shared
httputil package and co-locates the HTTP client construction with its
sole consumer.

  • Rename the package import from httputil to catalogclient in
    main.go and tests
  • Move httputil.go and httputil_test.go into the client package
  • Update test helpers to use the new import path

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

Copilot AI review requested due to automatic review settings June 24, 2026 23:14
@openshift-ci openshift-ci Bot requested review from oceanc80 and tmshort June 24, 2026 23:14
@netlify

netlify Bot commented Jun 24, 2026

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 51aa279
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6a3d48ada5977400075f4c3e
😎 Deploy Preview https://deploy-preview-2782--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the operator-controller’s catalog metadata HTTP client behavior to better accommodate large catalog responses from catalogd by aligning the client timeout with catalogd’s longer write timeout, and relocates the HTTP client construction helper into the catalog metadata client package where it’s actually used.

Changes:

  • Increase the catalog metadata HTTP client timeout from 10s to 5m.
  • Move BuildHTTPClient into internal/operator-controller/catalogmetadata/client and update call sites accordingly.
  • Update unit tests and imports to reference the new BuildHTTPClient location/package.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/operator-controller/catalogmetadata/client/httputil.go Defines BuildHTTPClient in the catalog metadata client package and sets the timeout to 5 minutes.
internal/operator-controller/catalogmetadata/client/httputil_test.go Updates tests to call BuildHTTPClient from the catalog metadata client package.
internal/operator-controller/catalogmetadata/client/client_test.go Renames import alias/type references to the catalog metadata client package consistently.
cmd/operator-controller/main.go Switches the operator-controller wiring to call catalogclient.BuildHTTPClient instead of the shared util function.
Comments suppressed due to low confidence (1)

internal/operator-controller/catalogmetadata/client/httputil_test.go:119

  • The PR’s main behavioral change is increasing the HTTP client timeout to 5 minutes, but the tests don’t assert the configured timeout. Adding an assertion here would prevent accidental regression back to a shorter timeout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.50%. Comparing base (c2f2d89) to head (51aa279).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2782      +/-   ##
==========================================
+ Coverage   70.40%   70.50%   +0.09%     
==========================================
  Files         143      143              
  Lines       10617    10617              
==========================================
+ Hits         7475     7485      +10     
+ Misses       2580     2573       -7     
+ Partials      562      559       -3     
Flag Coverage Δ
e2e 35.14% <100.00%> (ø)
experimental-e2e 52.48% <100.00%> (+0.08%) ⬆️
unit 59.49% <50.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pedjak pedjak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would focus this PR solely on the timeout increase, and rest of refactoring would push into another PR.

func BuildHTTPClient(cpw *CertPoolWatcher) (*http.Client, error) {
httpClient := &http.Client{Timeout: 10 * time.Second}
func BuildHTTPClient(cpw *httputil.CertPoolWatcher) (*http.Client, error) {
httpClient := &http.Client{Timeout: 5 * time.Minute}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we extract it into a constant?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll split it up.

On the constant, I don't know that we should have one constant shared between the client and server. The server's timeout needs to consider all of its potential client use cases more broadly than just the op-con client. The reason they were different before is that catd needed a longer timeout to accommodate off-cluster clients, which could theoretically be on high-latency/low-bandwidth connections).

We could bump the op-con client timeout to something between 10s and 5m (e.g. like 2m), but that seems arbitrary, and 5m doesn't seem excessively long for op-con anyway. If we bump catalogd up again later (e.g. to 20m), I don't think we'd automatically want to bump op-con client to that as well, would we?

I could extract separate constants for the existing values, but 🤷‍♂️ , maybe not necessary if there's only one place they're used. Not opinionated either way on this.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@joelanford joelanford force-pushed the move-httpclient-to-catalogclient branch from 812a288 to 51aa279 Compare June 25, 2026 15:26
@joelanford joelanford changed the title 🐛 increase catalog HTTP client timeout from 10s to 5m 🌱 move BuildHTTPClient from shared httputil to catalogmetadata/client Jun 25, 2026
@joelanford

Copy link
Copy Markdown
Member Author

Updated this PR to be just the refactoring. I'll make a follow-up for bumping the timeout.

@tmshort

tmshort commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tmshort

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 25, 2026
@grokspawn

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 25, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit f5e0d77 into operator-framework:main Jun 25, 2026
27 checks passed
@joelanford joelanford deleted the move-httpclient-to-catalogclient branch June 25, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants