Skip to content

Conversation

@hao1939
Copy link
Contributor

@hao1939 hao1939 commented Jun 23, 2025

ManagedSystem Pool Support.
This feature introduces support for ManagedSystem node pools, enabling users to:

  1. Create Kubernetes clusters with a fully managed system node pool: aks create --resource-group={resource_group} --name={name} --enable-managed-system-pool
  2. Create new node pools in ManagedSystem mode: aks nodepool add --resource-group={resource_group} --cluster-name={name} --name={nodepool_name} --mode ManagedSystem
  3. Delete ManagedSystem Pool: aks nodepool delete --resource-group={resource_group} --cluster-name={name} --name={nodepool_name}
  4. Reconcile ManagedSystem Pool: aks nodepool update --resource-group={resource_group} --cluster-name={name} --name={nodepool_name}

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

Related command

az aks create -g MyResourceGroup -n MyManagedCluster --managed-system-pool

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Copilot AI review requested due to automatic review settings June 23, 2025 05:07
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jun 23, 2025

❌Azure CLI Extensions Breaking Change Test
❌aks-preview
rule cmd_name rule_message suggest_message
1010 - ParaPropUpdate aks nodepool add cmd aks nodepool add update parameter spot_max_price: updated property default from nan to nan please change property default from nan to nan for parameter spot_max_price of cmd aks nodepool add
⚠️ 1006 - ParaAdd aks create cmd aks create added parameter enable_managed_system_pool
⚠️ 1010 - ParaPropUpdate aks nodepool add cmd aks nodepool add update parameter mode: updated property choices from ['Gateway', 'System', 'User'] to ['Gateway', 'ManagedSystem', 'System', 'User']
⚠️ 1010 - ParaPropUpdate aks nodepool update cmd aks nodepool update update parameter mode: updated property choices from ['Gateway', 'System', 'User'] to ['Gateway', 'ManagedSystem', 'System', 'User']

@azure-client-tools-bot-prd
Copy link

Hi @hao1939,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@github-actions
Copy link

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@yonzhan
Copy link
Collaborator

yonzhan commented Jun 23, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for a new ManagedSystem node pool mode that resets all properties except name and mode for both create and update operations. It adds the constant, CLI parameter, help text, decorator logic, and tests to cover the add flow.

  • Implemented set_up_managed_system_mode in agentpool_decorator.py with early exit in construct_agentpool_profile_preview.
  • Added ManagedSystem to constants (_consts.py), CLI parameters (_params.py), and help (_help.py).
  • Added unit tests for the add-decorator behavior in test_agentpool_decorator.py.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/aks-preview/.../tests/latest/test_agentpool_decorator.py Added tests for ManagedSystem mode on create and update decorators
src/aks-preview/.../agentpool_decorator.py Implemented set_up_managed_system_mode and early return in preview logic
src/aks-preview/.../_params.py Included ManagedSystem in node_mode_types and related imports
src/aks-preview/.../_help.py Updated help text to explain ManagedSystem behavior
src/aks-preview/.../_consts.py Defined CONST_NODEPOOL_MODE_MANAGEDSYSTEM constant
Comments suppressed due to low confidence (2)

src/aks-preview/azext_aks_preview/tests/latest/test_agentpool_decorator.py:1996

  • In the update-path test you're instantiating AKSPreviewAgentPoolAddDecorator instead of AKSPreviewAgentPoolUpdateDecorator. Swap to the update decorator to correctly cover the update flow.
    def test_update_to_managed_system_mode(self):

src/aks-preview/azext_aks_preview/tests/latest/test_agentpool_decorator.py:1391

  • [nitpick] Consider adding an end-to-end unit test for AKSPreviewAgentPoolUpdateDecorator.construct_agentpool_profile_preview when mode is ManagedSystem to ensure the update path also resets properties correctly.
    def test_construct_agentpool_profile_preview_managed_system(self):

@github-actions
Copy link

github-actions bot commented Jun 23, 2025

Hi @hao1939

Release Suggestions

Module: aks-preview

  • Update VERSION to 18.0.0b19 in src/aks-preview/setup.py

Notes

@yonzhan yonzhan requested a review from zhoxing-ms June 23, 2025 05:48
@yonzhan yonzhan requested a review from yanzhudd June 23, 2025 05:49
@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@FumingZhang
Copy link
Member

seems the live test failed with error

  if self.agentpool_decorator_mode == AgentPoolDecoratorMode.MANAGED_CLUSTER:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

E AttributeError: 'AKSPreviewAgentPoolAddDecoratorCommonTestCase' object has no attribute 'agentpool_decorator_mode'

@hao1939 hao1939 force-pushed the hayua/managedpool branch 6 times, most recently from 2828d7e to 0a1025d Compare June 23, 2025 13:58
@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Member

@FumingZhang FumingZhang left a comment

Choose a reason for hiding this comment

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

Could you please add a scenario test case for this feature? May check existing examples in test_aks_commands.py

@hao1939 hao1939 force-pushed the hayua/managedpool branch 2 times, most recently from 5029a45 to 1e0de7b Compare June 24, 2025 08:43
@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@hao1939
Copy link
Contributor Author

hao1939 commented Jul 9, 2025

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 8891 in repo Azure/azure-cli-extensions

@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

self.__raw_parameters = raw_parameters
super().__init__(cmd, client, raw_parameters, resource_type)

def update_managed_system_pools(self, mc: ManagedCluster) -> ManagedCluster:
Copy link
Member

Choose a reason for hiding this comment

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

there's no corresponding option for command aks update, so this just acts as a guard?

BTW, this made me realize that other client tools probably don’t know that they need to clear other properties when switching nodepool mode to managed system. If the rp validation is strict, this will result in a bad request, resulting in a bad user experience.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mode is not allowed for updating, so we are not worried CX would change the mode.
For ManagedSystem Pool, because we restrict the api to reject any extra field but not ignore, so we need to clear those properties while reconciling.

Comment on lines +1113 to +1119
# Check if mode is ManagedSystem, if yes, reset all properties
agentpool = self.set_up_managed_system_mode(agentpool)

# If mode is ManagedSystem, skip all other property setups
if agentpool.mode == CONST_NODEPOOL_MODE_MANAGEDSYSTEM:
return agentpool

Copy link
Member

Choose a reason for hiding this comment

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

what about putting it to the end of this constructor, then you don't need the check and return early.

Copy link
Contributor Author

@hao1939 hao1939 Jul 9, 2025

Choose a reason for hiding this comment

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

quit early could skip unnecessary code branch

Comment on lines +1357 to +1364
# Check if agentpool is in ManagedSystem mode and handle special case
if agentpool.mode == CONST_NODEPOOL_MODE_MANAGEDSYSTEM:
# Make sure all other attributes are None
for attr in vars(agentpool):
if attr != 'name' and attr != 'mode' and not attr.startswith('_'):
if hasattr(agentpool, attr):
setattr(agentpool, attr, None)
return agentpool
Copy link
Member

Choose a reason for hiding this comment

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

what about wrapping this as a function (maybe add a helper function to do the clean up), and put it to the end of this update function?

@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

FumingZhang
FumingZhang previously approved these changes Jul 10, 2025
@FumingZhang
Copy link
Member

Live test passed!

  • test_aks_create_normal_cluster_then_add_managed_system_pool
  • test_aks_create_with_managed_system_pool_multiple_fails
  • test_aks_update_with_managed_system_pool

@hao1939 hao1939 changed the title Create a nodepool with ManagedSystem mode Support ManagedSystem mode AgentPool Jul 11, 2025
@hao1939 hao1939 changed the title Support ManagedSystem mode AgentPool Support ManagedSystem mode NodePool Jul 11, 2025
@yanzhudd
Copy link
Contributor

Please add some changelog in the HISTORY.rst file. If you want to release a new version, please update the setup.py file as well.

@hao1939
Copy link
Contributor Author

hao1939 commented Jul 14, 2025

Please add some changelog in the HISTORY.rst file. If you want to release a new version, please update the setup.py file as well.

@hao1939 hao1939 closed this Jul 14, 2025
@hao1939 hao1939 reopened this Jul 14, 2025
@hao1939
Copy link
Contributor Author

hao1939 commented Jul 14, 2025

Thanks @yanzhudd! Added, could you help to take a second look?

Comment on lines 14 to 17
18.0.0b18
+++++++
* Add validation error when neither --location or --cluster and --resource-group-name are specified for az extension type list or az extension type version list
* Add support for `ManagedSystem` Agent Pool Mode.
Copy link
Contributor

Choose a reason for hiding this comment

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

please move it to below the Pending part

Suggested change
18.0.0b18
+++++++
* Add validation error when neither --location or --cluster and --resource-group-name are specified for az extension type list or az extension type version list
* Add support for `ManagedSystem` Agent Pool Mode.
* Add support for `ManagedSystem` Agent Pool Mode.
18.0.0b18
+++++++
* Add validation error when neither --location or --cluster and --resource-group-name are specified for az extension type list or az extension type version list

Copy link
Member

Choose a reason for hiding this comment

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

As yan suggested, please move your release note to the pending section if you don't want to release a new version immediately. Otherwise, please add a new section with version number 18.0.0b19 and update setup.py accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, updated.

@hao1939 hao1939 force-pushed the hayua/managedpool branch from e9c30b6 to 908b1d8 Compare July 14, 2025 05:49
@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@yanzhudd yanzhudd merged commit c464eba into Azure:main Jul 14, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants