Conversation
️✔️AzureCLI-FullTest
|
|
Hi @xmzhao0822, |
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull request overview
Fixes az aks namespace update so it no longer derives location by reading the parent managed cluster (which can require extra RBAC), and instead reuses the existing managed namespace’s location, aligning behavior with least-privilege namespace-scoped roles.
Changes:
- Update path now sets
namespace_config.locationfrom the existing managed namespace object instead of callingmanaged_clusters.get(...). - Add a unit test ensuring update reuses the existing namespace location and does not call the container service client.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/acs/managednamespace.py |
Uses existedNamespace.location during update to avoid parent-cluster read dependency. |
src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managednamespace.py |
Adds test coverage validating location propagation and no cluster lookup on update. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
az aks namespace update: Fix the location logic for managed namespace update operation
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
az aks namespace update: Fix the location logic for managed namespace update operationaz aks namespace update: Fix the location logic for managed namespace update operation
Related command
az aks namespace update -g charlilirg --cluster-name charliliaks -n ns1 --annotations a=d --subscription c582d154-33c4-47e4-a3c2-0632d20b12ebDescription
The
az aks namespace updatecommand currently fails for users who have Azure RBAC for Containers permissions on a specific namespace but lack Reader permissions on the parent Managed Cluster resource.This occurs because the CLI calls get_cluster_location, which internally executes managed_clusters.get(). This call requires cluster-level permissions that a Namespace-scoped admin does not (and should not) have.
The Fix
I modified the update logic to stop "reaching up" to the cluster object for metadata. Instead of calling the Container Service client to get the cluster location, the command now uses the location property already available in the existedNamespace object. By pulling the location from the existedNamespace object, you eliminate the need for the containerservice_client to look at the parent cluster.
Testing Guide
az aks namespace update -g charlilirg --cluster-name charliliaks -n ns1 --annotations a=k --subscription c582d154-33c4-47e4-a3c2-0632d20b12ebHistory 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 featureThis 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.