Skip to content

fix: When constructing a client with a proxy, don't override the global http transport#827

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
joshbranham:stop-modifying-global-http-doer
Nov 11, 2025
Merged

fix: When constructing a client with a proxy, don't override the global http transport#827
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
joshbranham:stop-modifying-global-http-doer

Conversation

@joshbranham
Copy link
Contributor

@joshbranham joshbranham commented Nov 8, 2025

What type of PR is this?

  • fix (Bug Fix)
  • feat (New Feature)
  • docs (Documentation)
  • test (Test Coverage)
  • chore (Clean Up / Maintenance Tasks)
  • other (Anything that doesn't fit the above)

What this PR does / Why we need it?

The current implementation of injecting an http proxy relied on overriding the global default HTTP transport. Instead of modifying global state, we can accomplish this by using the WithHTTPClient() client options func from the backplane-api SDK.

Which Jira/Github issue(s) does this PR fix?

  • Related Issue #
  • Closes #

Special notes for your reviewer

Unit Test Coverage

Guidelines

  • If it's a new sub-command or new function to an existing sub-command, please cover at least 50% of the code
  • If it's a bug fix for an existing sub-command, please cover 70% of the code

Test coverage checks

  • Added unit tests
  • Created jira card to add unit test
  • This PR may not need unit tests

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR
  • Backward compatible

/label tide/merge-method-squash

@joshbranham joshbranham self-assigned this Nov 8, 2025
@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Nov 8, 2025
@openshift-ci openshift-ci bot requested review from a7vicky and smarthall November 8, 2025 19:12
return nil, err
return nil, fmt.Errorf("failed to create http client: %w", err)
}
http.DefaultTransport = &http.Transport{Proxy: http.ProxyURL(proxy)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the global state modification we are removing

@joshbranham joshbranham changed the title When constructing a client with a proxy, don't override the global http transport NO-JIRA: When constructing a client with a proxy, don't override the global http transport Nov 8, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 8, 2025
@openshift-ci-robot
Copy link

@joshbranham: This pull request explicitly references no jira issue.

Details

In response to this:

What type of PR is this?

  • fix (Bug Fix)
  • feat (New Feature)
  • docs (Documentation)
  • test (Test Coverage)
  • chore (Clean Up / Maintenance Tasks)
  • other (Anything that doesn't fit the above)

What this PR does / Why we need it?

The current implementation of injecting an http proxy relied on overriding the global default HTTP transport. Instead of modifying global state, we can accomplish this by using the WithHTTPClient() client options func from the backplane-api SDK.

Which Jira/Github issue(s) does this PR fix?

  • Related Issue #
  • Closes #

Special notes for your reviewer

Unit Test Coverage

Guidelines

  • If it's a new sub-command or new function to an existing sub-command, please cover at least 50% of the code
  • If it's a bug fix for an existing sub-command, please cover 70% of the code

Test coverage checks

  • Added unit tests
  • Created jira card to add unit test
  • This PR may not need unit tests

Pre-checks (if applicable)

  • Ran unit tests locally
  • Validated the changes in a cluster
  • Included documentation changes with PR
  • Backward compatible

/label tide/merge-method-squash

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
Copy link
Contributor

openshift-ci bot commented Nov 8, 2025

@joshbranham: all tests passed!

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.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.07%. Comparing base (8beb0d5) to head (27585cb).

Files with missing lines Patch % Lines
pkg/backplaneapi/clientUtils.go 0.00% 15 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #827      +/-   ##
==========================================
- Coverage   53.15%   53.07%   -0.09%     
==========================================
  Files          86       86              
  Lines        6430     6440      +10     
==========================================
  Hits         3418     3418              
- Misses       2555     2565      +10     
  Partials      457      457              
Files with missing lines Coverage Δ
pkg/backplaneapi/clientUtils.go 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@feichashao feichashao changed the title NO-JIRA: When constructing a client with a proxy, don't override the global http transport fix: When constructing a client with a proxy, don't override the global http transport Nov 11, 2025
@samanthajayasinghe
Copy link
Contributor

/lgtm

@samanthajayasinghe
Copy link
Contributor

/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 11, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 11, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joshbranham, samanthajayasinghe

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 Nov 11, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 4c1748a into openshift:main Nov 11, 2025
7 checks passed
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants