Remove overwriting the default HTTP transport - #1112
Conversation
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
✅ Deploy Preview for kpt-porch ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR removes global mutation of http.DefaultTransport (previously used for OpenTelemetry wrapping) and introduces a dedicated pkg/httpclient helper for constructing registry-focused HTTP transports/clients. It also refactors TLS handling for private registry pulls and removes tag-resolution logic from the pod evaluator path.
Changes:
- Added
pkg/httpclientwith a snapshot-based base*http.Transportand helpers to create registry transports/clients with optional TLS config. - Removed OpenTelemetry wrapping of
http.DefaultTransportin telemetry setup to avoid breaking downstream clients (e.g., regclient). - Refactored private-registry TLS CA discovery/transport creation in
podmanagerand removed pod-evaluator tag resolution + related tests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/httpclient/registry.go | New shared HTTP transport/client helpers for registry outbound calls without mutating global defaults. |
| pkg/httpclient/registry_test.go | Adds unit tests for the new httpclient helpers. |
| internal/telemetry/otel.go | Removes global HTTP default transport/client wrapping during OTel setup. |
| go.mod | Reclassifies sigs.k8s.io/cli-utils as indirect after refactor. |
| func/internal/podmanager.go | Uses new registry transport helper and factors CA path discovery into a helper. |
| func/internal/podmanager_unit_test.go | Removes tests tied to the deleted in-file transport constructor. |
| func/internal/podevaluator.go | Refactors construction wiring and removes tag resolution prior to evaluation. |
| func/internal/podevaluator_unit_test.go | Updates evaluator unit tests to match removed tag-resolver wiring. |
| func/internal/podevaluator_tag_resolution_test.go | Deletes tag resolution unit tests (tag resolution no longer done here). |
| func/internal/executableevaluator_test.go | Minor test constant addition for shared test image name. |
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Assisted-by: Cursor:composer-2.5 Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
|
| return nil, err | ||
| } | ||
|
|
||
| http.DefaultTransport = otelhttp.NewTransport(http.DefaultTransport) |
There was a problem hiding this comment.
My problem with this one is that it will disable monitoring http metrics for the following paths:
external -> porch server
porch-server -> kube-apiserver
porch-server -> git
function-runner -> oci
function-runner -> kube-apiserver
There was a problem hiding this comment.
We can add these individually, probably
How can an external service call porch server directly btw? Shouldn't it just be through the kube apiserver?
There was a problem hiding this comment.
I will add these individual wrappers after #1111 is merged and this is rebased.



Remove overwriting the default HTTP transport
Description
Related Issue(s)
Type of Change
Checklist
Additional Notes (Optional)
AI Disclosure
If so, please describe how: