Repository navigation
[AKS] Fix #34091: az aks get-credentials: Fix kubelogin conversion for explicit kubeconfig paths - #34099
Conversation
…sion for explicit kubeconfig paths AI-generated by X Engineering Agent via Azure AI Foundry. Foundry-Job: 5cea4d61c0405a0d3cad2061ebf19ec75d5984a5d77936de831da998855811b1
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical and moderate issues remain in kubelogin execution and explicit-path recovery guidance.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes az aks get-credentials kubelogin conversion for explicit kubeconfig paths.
Changes:
- Passes the selected kubeconfig path to kubelogin.
- Adds regression coverage for path, environment, merge, and failure scenarios.
- Preserves nonfatal conversion failures.
File summaries
| File | Summary |
|---|---|
src/azure-cli/azure/cli/command_modules/acs/custom.py |
Updates kubelogin invocation; unresolved executable-path security and explicit-path recovery issues remain. |
src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py |
Adds focused regression tests for credential conversion scenarios. |
Review details
Suppressed comments (1)
src/azure-cli/azure/cli/command_modules/acs/custom.py:1956
- For an explicit
--filepath, the fallback hint below still tells users to run conversion without--kubeconfig; with noKUBECONFIGset, kubelogin will operate on~/.kube/configinstead of the file just merged, so the devicecode kubeconfig remains unconverted. Include the effectivepathin this recovery command (and quote it for paths containing spaces).
["kubelogin", "convert-kubeconfig", "-l", "azurecli", "--kubeconfig", path],
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| subprocess.run( | ||
| ["kubelogin", "convert-kubeconfig", "-l", "azurecli"], | ||
| cwd=os.path.dirname(path), | ||
| ["kubelogin", "convert-kubeconfig", "-l", "azurecli", "--kubeconfig", path], |
There was a problem hiding this comment.
Aditya Pujara (@a0x1ab) This is a valid Windows executable-search issue and is worth addressing in this PR. The local which() helper searches PATH, but its result is discarded; launching the bare kubelogin name lets Windows CreateProcess search the caller’s current directory before PATH, so it may execute a different kubelogin.exe than the one that was checked. Please retain the resolved value and invoke os.path.abspath(kubelogin_path), matching the existing kubectl hardening in this module. This is compatible with the #34091 fix: keep cwd unset and continue passing --kubeconfig, path.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
🔔 Routing this PR to @Azure/act-observability-squad. |
|
🔔 Routing this PR to @Azure/act-observability-squad. |
|
Please fix CI issues |
…4d61c040 Resolved import-only conflicts in: - src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py
Live test results —
|
There was a problem hiding this comment.
I'd like to apply the feedback from FumingZhang at #34099 (comment), but this PR's branch now has commits I did not publish (current head 9b47a45bd266). My fix would build on top of them and include those changes.
Do I have your permission to go ahead? A maintainer can approve this exact head by replying:
@Azure/x-engineering-agent approve 9b47a45bd266
If the branch changes again before approval, I will ask again for the new head.
Posted by x-engineering-agent (Reviewer)
🤖 PR Validation — ️✔️ All clear
Related command
az aks get-credentialsDescription
Fixes #34091.
Implemented by X Engineering Agent using Azure AI Foundry. This is an AI-generated change, published by the configured operator.
Testing Guide
az aks get-credentials.src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py.History Notes
[AKS]
az aks get-credentials: Fix kubelogin conversion for explicit kubeconfig pathsThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.