refactor(cli): decouple EnvSettings from pkg/kube to avoid import cycles#31970
Open
isumitsolanki wants to merge 2 commits intohelm:mainfrom
Open
refactor(cli): decouple EnvSettings from pkg/kube to avoid import cycles#31970isumitsolanki wants to merge 2 commits intohelm:mainfrom
isumitsolanki wants to merge 2 commits intohelm:mainfrom
Conversation
Move the retrying round tripper used by EnvSettings into pkg/cli so pkg/cli no longer imports pkg/kube. This preserves retry behavior while breaking the import edge that triggers cycles for Helm library consumers (such as the kustomize integration described in helm#31965). Signed-off-by: Sumit Solanki <sumit.solanki@ibm.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors pkg/cli.EnvSettings to remove its dependency on pkg/kube, preventing import cycles for Helm-as-a-library consumers while preserving the existing retry behavior for transient Kubernetes API server errors.
Changes:
- Add a
pkg/cli-local retryinghttp.RoundTripperimplementation. - Update
EnvSettingsREST config wrapping to use the newpkg/cliround-tripper and drop thepkg/kubeimport.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/cli/environment.go | Removes pkg/kube dependency by switching the REST config wrapper to a pkg/cli-local round-tripper. |
| pkg/cli/roundtripper.go | Introduces the retrying round-tripper implementation previously sourced from pkg/kube. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Move the retrying HTTP round-tripper used by EnvSettings into pkg/cli so pkg/cli no longer imports pkg/kube, avoiding import cycles for Helm library consumers while preserving retry behavior for transient API server errors. Add pkg/cli/roundtripper_test.go with parity coverage for the moved logic. Signed-off-by: Sumit Solanki <sumit.solanki@ibm.com> Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #31965
What this PR does / why we need it:
This PR decouples pkg/cli from pkg/kube in the EnvSettings code path to prevent import cycles for Helm library consumers.
Today, pkg/cli/environment.go imports pkg/kube only to use RetryingRoundTripper. That import pulls in a larger dependency chain and can create cycles for consumers (for example, the kustomize integration described in #31965) when importing Helm packages that depend on pkg/cli.
To fix this, the retrying round-tripper logic used by EnvSettings is moved into pkg/cli, and the pkg/cli -> pkg/kube import edge is removed. Behavior is preserved; this is a dependency-graph refactor, not a functional change.
Special notes for your reviewer:
Scope is intentionally minimal and focused on import decoupling.
Retry behavior for transient Kubernetes API server errors remains the same.
No public API signatures were changed.
Files changed:
pkg/cli/environment.go
pkg/cli/roundtripper.go
If applicable:
docs neededlabel should be applied if so)