fix: config_context and proxy_url ignored when config_path is not set - #1781
Open
litzius wants to merge 1 commit into
Open
fix: config_context and proxy_url ignored when config_path is not set#1781litzius wants to merge 1 commit into
litzius wants to merge 1 commit into
Conversation
…nfig_path config_context, config_context_auth_info, and config_context_cluster were only applied when config_path was also set. Move these overrides outside the configPaths block so they work with the default kubeconfig location. proxy_url was set on ClusterDefaults (lowest priority, overridden by the kubeconfig file's cluster entry) instead of ClusterInfo (highest priority, consistent with host, tls_server_name, and other explicit overrides).
There was a problem hiding this comment.
Pull request overview
Fixes NewKubeConfig so kubernetes provider settings are consistently applied even when config_path is not explicitly set, and ensures proxy_url has the intended merge priority.
Changes:
- Apply
config_context,config_context_auth_info, andconfig_context_clusteroverrides regardless of whetherconfig_path(s)are provided. - Move
proxy_urloverride tooverrides.ClusterInfo.ProxyURL(highest priority in client-go merge order), instead ofClusterDefaults.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the library.
Changes to Security Controls
No changes to security controls.
Description
Two bugs in
NewKubeConfig(helm/kubeconfig.go) causekubernetesprovider block settings to be silently ignored:1.
config_context,config_context_auth_info,config_context_clusteronly applied whenconfig_pathis also set.These three overrides were inside the
if len(configPaths) > 0block, so settingconfig_contextwithout an explicitconfig_pathhad no effect — the provider used whatever context was active in the default kubeconfig, ignoring the provider configuration entirely.2.
proxy_urlstored onClusterDefaultsinstead ofClusterInfo.In client-go's merge order,
ClusterDefaultshas the lowest priority and can be overridden by the kubeconfig file's cluster entry. All other explicit provider overrides (host,tls_server_name,insecure,cluster_ca_certificate) correctly useClusterInfo, which has highest priority.proxy_urlwas the only field that was inconsistent.Fix: move the three context overrides outside the
configPathsblock so they are always applied, and changeproxy_urlto useoverrides.ClusterInfo.ProxyURL.Minimal reproduction:
Acceptance tests
No acceptance test added — verifying proxy and context behaviour requires a live cluster reachable through a proxy, which is not available in the standard CI environment. Both fixes are targeted single-field changes with a clear root cause traced through the client-go merge logic.
Release Note
References
No existing issue. Observed on v3.1.1 with
TF_LOG=DEBUG.Community Note