[AKS] az aks update: Add --enable-high-log-scale-mode flag and fix monitoring addon key casing#33039
[AKS] az aks update: Add --enable-high-log-scale-mode flag and fix monitoring addon key casing#33039carlotaarvela wants to merge 16 commits intoAzure:devfrom
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @carlotaarvela, |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
❌AzureCLI-BreakingChangeTest
Please submit your Breaking Change Pre-announcement ASAP if you haven't already. Please note:
|
|
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>
|
e74f904 to
e5ce693
Compare
src/azure-cli/azure/cli/command_modules/acs/addonconfiguration.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR extends the AKS command module to support High Log Scale Mode (HLSM) configuration during az aks update, hardens monitoring addon handling against API key casing differences (omsagent vs omsAgent), and adds retry/backoff for default Log Analytics workspace provisioning conflicts.
Changes:
- Add
--enable-high-log-scale-mode(three-state) toaz aks update, including validation and post-processing to update DCR/DCRA stream configuration when HLSM/CNL changes. - Normalize monitoring addon lookups by introducing
CONST_MONITORING_ADDON_NAME_CAMELCASEandget_monitoring_addon_key()and applying it across update/enable/disable flows. - Add exponential backoff + jitter retry for Log Analytics workspace creation on 409 conflicts /
ResourceExistsError, with accompanying unit tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py | Adds addon-key normalization and HLSM/CNL post-processing triggers in update/create decorator flows. |
| src/azure-cli/azure/cli/command_modules/acs/custom.py | Uses addon-key helper for monitoring enable/disable checks; preserves CNL config during monitoring addon disable/reenable cycles. |
| src/azure-cli/azure/cli/command_modules/acs/addonconfiguration.py | Adds retry w/ backoff+jitter for default workspace creation conflicts. |
| src/azure-cli/azure/cli/command_modules/acs/_helpers.py | Introduces get_monitoring_addon_key() helper to handle omsagent/omsAgent. |
| src/azure-cli/azure/cli/command_modules/acs/_consts.py | Adds CONST_MONITORING_ADDON_NAME_CAMELCASE = "omsAgent". |
| src/azure-cli/azure/cli/command_modules/acs/_params.py | Registers enable_high_log_scale_mode as a three-state flag. |
| src/azure-cli/azure/cli/command_modules/acs/_help.py | Documents --enable-high-log-scale-mode under aks update. |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managed_cluster_decorator.py | Adds coverage for camelCase monitoring key resolution and HLSM/CNL postprocessing behavior. |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_custom.py | Adds unit coverage for CNL config preservation, workspace retry behavior, and monitoring-enabled helper. |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_helpers.py | Adds tests for get_monitoring_addon_key(). |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py | Extends scenario test flow to cover CNL disable/enable and HLSM enable via aks update. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/azure-cli/azure/cli/command_modules/acs/addonconfiguration.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/acs/addonconfiguration.py
Outdated
Show resolved
Hide resolved
FumingZhang
left a comment
There was a problem hiding this comment.
The code related to the monitoring addon in the aks create/update path has become increasingly difficult to understand. Please create a task to refactor this section soon, before making ANY further changes to it.
src/azure-cli/azure/cli/command_modules/acs/linter_exclusions.yml
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py
Outdated
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py
Outdated
Show resolved
Hide resolved
|
Queued live test to validate the change.
Queued live test on all existing cases related to monitoring addon
|
df53908 to
55f9660
Compare
src/azure-cli/azure/cli/command_modules/acs/addonconfiguration.py
Outdated
Show resolved
Hide resolved
|
@carlotaarvela - could we pls keep this pr sinple to only have relevant changes and remove unnecessary refactoring and changes? |
src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py
Show resolved
Hide resolved
src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py
Outdated
Show resolved
Hide resolved
f053e1e to
74e964a
Compare
…-high-log-scale-mode
74e964a to
b299c57
Compare
|
Live tests are passing |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Related command
az aks update,az aks enable-addons,az aks disable-addonsDescription
This PR introduces the
--enable-high-log-scale-modeparameter toaz aks updateand fixes a bug where the monitoring addon key returned by the API asomsAgent(camelCase) was not recognized, causing failures in addon enable/disable/update workflows.Changes
1. New
--enable-high-log-scale-modeflag (az aks update)--enable-high-log-scale-modethat enables or disables High Log Scale Mode (HLSM) for Container Logs.--enable-container-network-logsis specified.useAADAuth=true).enableRetinaNetworkFlags(CNL) config when re-enabling the monitoring addon.2. Fix monitoring addon key casing (
omsagentvsomsAgent)omsagent(lowercase) oromsAgent(camelCase). Previously, the CLI only checked foromsagent, causingKeyErroror silent failures when the API returnedomsAgent.CONST_MONITORING_ADDON_NAME_CAMELCASEand a helper functionget_monitoring_addon_key()that checks both variants and returns whichever key is present in the addon profiles.custom.py,managed_cluster_decorator.py, andaddonconfiguration.pyto use this helper.3. Retry logic for Log Analytics workspace creation
ResourceExistsErrorduring Log Analytics workspace provisioning inensure_default_log_analytics_workspace_for_monitoring.Testing Guide
Enable HLSM on an existing cluster with monitoring addon:
Enable HLSM together with container network logs:
Disable HLSM (requires CNL to be disabled first):
az aks update -g myRG -n myCluster --enable-high-log-scale-mode falseHistory Notes
[AKS]
az aks update: Add--enable-high-log-scale-modeflag to enable/disable High Log Scale Mode for Container Logs[AKS] Fix monitoring addon key lookup to handle both
omsagentandomsAgentAPI response variants[AKS] Add retry with exponential backoff for Log Analytics workspace creation conflicts
This 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.