aksd: fix: Respect KUBECONFIG env var when writing to kubeconfig#276
aksd: fix: Respect KUBECONFIG env var when writing to kubeconfig#276tejhan wants to merge 1 commit intoAzure:headlamp-downstreamfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the AKS Desktop application was ignoring the $KUBECONFIG environment variable when registering AKS clusters. Previously, the kubeconfig path was hardcoded to ~/.kube/config, which caused cluster configurations to be written to the default location even when users had $KUBECONFIG set to a different path. This resulted in silent failures during project creation when the cluster config was written to the wrong location.
Changes:
- Modified
registerAKSClusterfunction to respect the$KUBECONFIGenvironment variable when determining where to write kubeconfig files - Uses the first path from
$KUBECONFIG(for colon/semicolon-separated paths), falling back to~/.kube/configwhen unset
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8ff8fc1 to
e105839
Compare
is this a bug? feel free to open an issue for this if so |
Yes, my wording could have been better here- but this is indeed a bug, & that message describes the behavior one would notice without the fix in this PR. (If it hypothetically didn't work). I've just opened an issue with some details to track this. #294 |
illume
left a comment
There was a problem hiding this comment.
Thanks for this.
Can you please update the commit message to something like this?
aksd: app: aks-cluster: Respect KUBECONFIG env var when writing to kubeconfig
With the signed-off-by removed, because we're using CLA in this repo.
I linked the issue to the PR.
def6222 to
3ed87fa
Compare
e105839 to
e860d59
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e860d59 to
e6744f4
Compare
Description
When registering an AKS cluster or trying to merge one into the kubeconfig via the project creation screen, the kubeconfig path was hardcoded to
~/.kube/config, ignoring the$KUBECONFIGenvironment variable. Meaning that a user with $KUBECONFIG set would have their cluster config written to the default location instead. This would happen silently & it's propagation would result in inability to create project or properly merge clusters via AKSD.This change reads
$KUBECONFIGand if it's set, uses the first path in the list (matching kubectl behavior for colon/semicolon-separated paths), falling back to~/.kube/configonly when the variable is unset.Fixes #294
Type of Change
How to test:
Results should be successful merge & next button is properly enabled.
(If this were to fail, a successful merge message would still appear but the next button would still be disabled due to merge at wrong location.)