fix(backend/kubernetes): use default KUBECONFIG resolution #2672
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.
Description
This PR modifies the Kubernetes backend and the CLI to use the K8s SDK's default resolution strategy, allowing them to read the user's K8s configuration from the
KUBECONFIG
environment variable, rather than being hardcoded to only read from$HOME/.kube/config
. This enables compatibility with a wider variety of local K8s configuration strategies by leveraging standard K8s practices.This change was primarily motivated by difficulties using Kurtosis with my own setup, wherein I have some scripting which dynamically constructs a
KUBECONFIG
envvar in order to work with multiple K8s clusters. It should not cause any issues, as the SDK's default resolution strategy ultimately falls back to reading from$HOME/.kube/config
.There is some duplication in this PR as I couldn't figure out how to re-use the
kubernetesConfig
/kubernetesManager
created in the K8s backend in thegateway
module. Happy to take guidance on how to improve this if necessary.I've tested this PR locally and was successfully able to run successfully.
Is this change user facing?
YES
@tedim52 (pls LMK if there's a better person to tag)