{AKS} az aks create/update: Add --enable-default-domain and --disable-default-domain parameters to manage the default domain feature for web app routing#9578
Conversation
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| aks approuting defaultdomain | sub group aks approuting defaultdomain added |
||
| aks approuting enable | cmd aks approuting enable added parameter enable_default_domain |
||
| aks approuting update | cmd aks approuting update added parameter disable_default_domain |
||
| aks approuting update | cmd aks approuting update added parameter enable_default_domain |
||
| aks create | cmd aks create added parameter enable_default_domain |
|
Hi @OliverMKing, |
|
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>
|
|
Hi @OliverMKing Release SuggestionsModule: aks-preview
Notes
|
d35a8a2 to
34e9a1d
Compare
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
There was a problem hiding this comment.
Pull request overview
This pull request adds support for managing default domains in the AKS Application Routing addon through Azure CLI commands. The feature allows users to enable or disable a default domain for Application Routing, which provides automatic domain assignment to clusters.
Changes:
- Added
az aks approuting defaultdomain showcommand to display the default domain configuration - Added
--enable-default-domainand--disable-default-domainflags toaks create,aks approuting enable, andaks approuting updatecommands - Implemented comprehensive test coverage for the default domain lifecycle
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py | Added two test cases covering default domain enable/disable/show operations and cluster creation with default domain |
| src/aks-preview/azext_aks_preview/managed_cluster_decorator.py | Added getter methods for default domain flags and logic to configure default domain during cluster creation and updates |
| src/aks-preview/azext_aks_preview/custom.py | Added aks_approuting_default_domain_show function and integrated default domain flags into enable/update commands with conflict validation |
| src/aks-preview/azext_aks_preview/commands.py | Registered the new aks approuting defaultdomain show command |
| src/aks-preview/azext_aks_preview/_params.py | Defined parameters for enable_default_domain and disable_default_domain flags across relevant commands |
| src/aks-preview/azext_aks_preview/_help.py | Added help documentation for the new command and parameters |
Comments suppressed due to low confidence (1)
src/aks-preview/azext_aks_preview/custom.py:4137
- While the default domain functionality is tested via the create and update commands, there is no test coverage for enabling default domain using the "aks approuting enable" command with the --enable-default-domain flag. Consider adding a test case to verify this code path works correctly.
def aks_mesh_upgrade_complete(
cmd,
client,
resource_group_name,
name,
yes=False
):
return _aks_mesh_update(
cmd,
client,
resource_group_name,
name,
|
|
||
| def get_nginx(self): | ||
| """Obtain the value of nginx, written to the update decorator context by _aks_approuting_update | ||
|
|
There was a problem hiding this comment.
Trailing whitespace detected after the function definition. Please remove the trailing spaces to maintain code cleanliness.
| ) | ||
| ) | ||
|
|
||
| if "web_application_routing" in addons: | ||
| dns_zone_resource_ids = self.context.get_dns_zone_resource_ids() | ||
| mc.ingress_profile.web_app_routing.dns_zone_resource_ids = dns_zone_resource_ids | ||
|
|
||
| if self.context.get_enable_default_domain() or self.context.get_disable_default_domain(): | ||
| if mc.ingress_profile is None: | ||
| mc.ingress_profile = self.models.ManagedClusterIngressProfile() # pylint: disable=no-member | ||
| if mc.ingress_profile.web_app_routing is None: | ||
| mc.ingress_profile.web_app_routing = ( | ||
| self.models.ManagedClusterIngressProfileWebAppRouting(enabled=True) # pylint: disable=no-member | ||
| ) | ||
|
|
||
| enable = True | ||
| if self.context.get_disable_default_domain(): |
There was a problem hiding this comment.
The logic checking for disable_default_domain is unnecessary in set_up_ingress_web_app_routing since this function is only called during cluster creation, and disable_default_domain is not defined in the create command's argument context (only in update). The condition should be simplified to only check get_enable_default_domain(). This would make the code clearer and more maintainable.
| self.models.ManagedClusterIngressProfileWebAppRouting(enabled=True) # pylint: disable=no-member | ||
| ) | ||
|
|
||
| enable = True |
There was a problem hiding this comment.
Trailing whitespace detected on empty lines. Please remove the trailing spaces to maintain code cleanliness.
| enable = True | |
| enable = True |
| dns_zone_resource_ids = self.context.get_dns_zone_resource_ids() | ||
| mc.ingress_profile.web_app_routing.dns_zone_resource_ids = dns_zone_resource_ids | ||
|
|
||
| if self.context.get_enable_default_domain() or self.context.get_disable_default_domain(): |
There was a problem hiding this comment.
The code implicitly enables App Routing (by creating web_app_routing with enabled=True) when enable_default_domain is specified, even if enable_app_routing is not set. While this is functionally correct (default domain requires App Routing), it creates implicit behavior that may be confusing. Consider adding validation to require --enable-app-routing when --enable-default-domain is used, or document this implicit behavior in the help text. This would make the dependency explicit and avoid user confusion.
| if self.context.get_enable_default_domain() or self.context.get_disable_default_domain(): | |
| if self.context.get_enable_default_domain() or self.context.get_disable_default_domain(): | |
| # Default domain requires App Routing; make this dependency explicit to avoid | |
| # implicitly enabling App Routing when the user has not requested it. | |
| if not (self.context.get_enable_app_routing() or "web_application_routing" in addons): | |
| raise ArgumentUsageError( | |
| "--enable-default-domain/--disable-default-domain requires either " | |
| "--enable-app-routing or --enable-addons web_application_routing." | |
| ) |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
| self.cmd(delete_cmd, checks=[self.is_empty()]) | ||
|
|
||
| @AllowLargeResponse() | ||
| @AKSCustomResourceGroupPreparer( |
There was a problem hiding this comment.
Queued live test to validate the change, test passed!
Please also commit recording files to pass CI check
| arg_type=get_enum_type(app_routing_nginx_configs), | ||
| options_list=["--app-routing-default-nginx-controller", "--ardnc"] | ||
| ) | ||
| c.argument("enable_default_domain", action="store_true", is_preview=True) |
There was a problem hiding this comment.
I'm curious why only this occurrence is marked as is_preview, while the others are not.
There was a problem hiding this comment.
added is_preview to the rest. Good catch!
|
|
||
| return mc | ||
|
|
||
| def set_up_ingress_web_app_routing(self, mc: ManagedCluster) -> ManagedCluster: |
There was a problem hiding this comment.
please also add some unit tests for changes in this file
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Azure.azure-cli-extensions (Integration Tests, Build Tests Python310)
You can resolve the first 2 issues by committing the recording file to your branch, you can find them from pipeline artifact
The 3rd issue is being fixed by #9575 |
f7b84f0 to
98583be
Compare
|
/azp run |
|
Commenter does not have sufficient privileges for PR 9578 in repo Azure/azure-cli-extensions |
az aks create/update: Add --enable-default-domain and --disable-default-domain parameters to manage the default domain feature for web app routing
src/aks-preview/HISTORY.rst
Outdated
| 19.0.0b22 | ||
| +++++++ | ||
| * `az aks create/update`: Automatically enable `--enable-high-log-scale-mode` when `--enable-container-network-logs` is specified. Raises an error if user explicitly disables HLSM while enabling CNL. | ||
| * `az aks create/update`: Add `--enable-default-domain` and `--disable-default-domain` parameters to manage the default domain feature for web app routing. |
There was a problem hiding this comment.
it would be better to create a new version
There was a problem hiding this comment.
Created a new version
|
Should be good to go now :). Just need pipelines run |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
| 19.0.0b23 | ||
| +++++++ | ||
| * `az aks create/update`: Add `--enable-default-domain` and `--disable-default-domain` parameters to manage the default domain feature for web app routing. | ||
|
|
There was a problem hiding this comment.
please pull the latest code from the main branch.
there should a feature in the pending session, please involve the changelog under the upcoming version:
azure-cli-extensions/src/aks-preview/HISTORY.rst
Lines 12 to 14 in 5f8e06e
There was a problem hiding this comment.
updated to that. thank you!
b272b68 to
64ecabb
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |

This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)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.jsonautomatically.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.