Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AKS] az aks get-credentials: Fix the command error when KUBECONFIG is empty #23000

Merged
merged 2 commits into from
Jun 24, 2022

Conversation

FumingZhang
Copy link
Member

@FumingZhang FumingZhang commented Jun 24, 2022

Related command

az aks get-credentials

Description

When KUBECONFIG is empty, keep using the default storage path (~/.kube/config) and output warning-level logs; otherwise, use the path in KUBECONFIG to replace the default storage path and output info-level logs. Thanks to @fseldow for reporting this bug.

Screenshot 2022-06-24 104625
Screenshot 2022-06-24 104852

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

@ghost ghost requested review from zhoxing-ms and wangzelin007 June 24, 2022 02:54
@ghost ghost assigned zhoxing-ms Jun 24, 2022
@ghost ghost added this to the Jun 2022 (2022-07-05) milestone Jun 24, 2022
@ghost ghost added the Auto-Assign Auto assign by bot label Jun 24, 2022
@ghost ghost requested a review from yonzhan June 24, 2022 02:54
@ghost ghost added the AKS az aks/acs/openshift label Jun 24, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 24, 2022

AKS

@FumingZhang FumingZhang marked this pull request as ready for review June 24, 2022 05:12
logger.info("The default path '%s' is replaced by '%s' defined in KUBECONFIG.", path, kubeconfig_path)
path = kubeconfig_path
else:
logger.warning("Invalid path '%s' defined in KUBECONFIG.", kubeconfig_path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why just print the warning log instead of raising an exception?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I think there are some usage scenarios where the user has multiple kubeconfig files, then sets the environment variable KUBECONFIG to point to a specific kubeconfig file to perform some operatations, and sometimes leaves KUBECONFIG empty to operate with the kubeconfig located in the default path (~/.kube/config).

I hope this change is that when the user sets KUBECONFIG to be empty, the kubeconfig of the cluster can also be successfully downloaded to the default location.

More discussions are welcome:)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense!

@zhoxing-ms zhoxing-ms merged commit 535a83e into Azure:dev Jun 24, 2022
@FumingZhang FumingZhang deleted the fuming/fix-get-cred-0624 branch July 12, 2022 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AKS az aks/acs/openshift Auto-Assign Auto assign by bot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants