Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bb08ffa
Fix update enable cnl hlsm
carlotaarvela Mar 10, 2026
84e15f0
Fix tests + lint
carlotaarvela Mar 11, 2026
1fbc41a
Add unit tests
carlotaarvela Mar 12, 2026
0a0e8a9
More tests
carlotaarvela Mar 12, 2026
a85f832
Update history
carlotaarvela Mar 12, 2026
2c4a427
Fix addon and msi auth bug
carlotaarvela Mar 13, 2026
f555d8a
Lint
carlotaarvela Mar 13, 2026
e4d9f8a
Fix update validation + tests
carlotaarvela Mar 16, 2026
204c5fc
Fix disable cnls
carlotaarvela Mar 16, 2026
07f2032
Fix unit tests
carlotaarvela Mar 16, 2026
048a474
PR comment - refactoring
carlotaarvela Mar 18, 2026
e9fb313
Refactor
carlotaarvela Mar 18, 2026
c94063b
Add unit and integration tests
carlotaarvela Mar 18, 2026
eb77588
Fix integration tests
carlotaarvela Mar 19, 2026
b24fa11
Fix tests + lint
carlotaarvela Mar 19, 2026
e166156
Fix linting
carlotaarvela Mar 19, 2026
48e6583
Fix history
carlotaarvela Mar 20, 2026
d96fa95
PR comments + tests
carlotaarvela Mar 23, 2026
ad55d79
Fix tests
carlotaarvela Mar 23, 2026
94b2162
Fix live test
carlotaarvela Mar 23, 2026
4071c6d
Fix live test
carlotaarvela Mar 24, 2026
c3fe5ad
Fix tests
carlotaarvela Mar 24, 2026
0266093
PR comments
carlotaarvela Mar 27, 2026
890b1f3
Fix history
carlotaarvela Mar 27, 2026
2faa27c
Lint + fix unit test
carlotaarvela Mar 27, 2026
92b857f
Fix missing CONST_MONITORING_ADDON_NAME_CAMELCASE import
carlotaarvela Mar 30, 2026
9b24712
Fix tests + update history
carlotaarvela Mar 31, 2026
bd80f27
PR comments
carlotaarvela Apr 1, 2026
2f63b91
Fix lint
carlotaarvela Apr 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ Pending
+++++++
* `az aks create/update`: Add `--outbound-type managedNATGatewayV2` support using Azure NAT Gateway Standard V2 SKU with IPv6, user-provided IPs, and IP prefixes.
* Fix monitoring addon key casing compatibility with azure-cli/acs
* `az aks create/update`: Fix DCR not being created or updated when `--enable-container-network-logs`, `--enable-retina-flow-logs`, or `--enable-high-log-scale-mode` flags are used, ensuring the Data Collection Rule streams (e.g. `Microsoft-ContainerLogV2-HighScale`) are kept in sync.
* `az aks update`: Add validation for `--enable-high-log-scale-mode` on the update path requiring the monitoring addon with MSI authentication to be enabled.

19.0.0b29
+++++++
* `az aks create/update`: Fix DCR not being created or updated when `--enable-container-network-logs`, `--enable-retina-flow-logs`, or `--enable-high-log-scale-mode` flags are used, ensuring the Data Collection Rule streams (e.g. `Microsoft-ContainerLogV2-HighScale`) are kept in sync.
* `az aks update`: Add validation for `--enable-high-log-scale-mode` on the update path requiring the monitoring addon with MSI authentication to be enabled.
Comment on lines +21 to +22
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please also add the history notes under the Pending section in your new release version.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done


19.0.0b28
+++++++
Expand Down
26 changes: 24 additions & 2 deletions src/aks-preview/azext_aks_preview/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,27 @@ def check_is_azure_cli_core_editable_installed():
return False


def get_monitoring_addon_key(addon_profiles, monitoring_addon_name):
"""Return the canonical key for the monitoring addon, normalizing non-standard casing.

The API response may return the monitoring addon key in any casing (e.g.
"omsagent", "omsAgent", "oMSaGent"). This helper performs a
case-insensitive lookup and, when a non-standard key is found, re-keys
addon_profiles in-place so that subsequent code always uses the canonical
monitoring_addon_name (lowercase) form.
"""
if addon_profiles is None:
return monitoring_addon_name
if monitoring_addon_name in addon_profiles:
return monitoring_addon_name
target_lower = monitoring_addon_name.lower()
for key in list(addon_profiles):
if key.lower() == target_lower:
addon_profiles[monitoring_addon_name] = addon_profiles.pop(key)
return monitoring_addon_name
return monitoring_addon_name


def check_is_monitoring_addon_enabled(addons, instance):
is_monitoring_addon_enabled = False
is_monitoring_addon = False
Expand All @@ -401,10 +422,11 @@ def check_is_monitoring_addon_enabled(addons, instance):
is_monitoring_addon = True
break
addon_profiles = instance.addon_profiles or {}
monitoring_addon_key = get_monitoring_addon_key(addon_profiles, CONST_MONITORING_ADDON_NAME)
is_monitoring_addon_enabled = (
is_monitoring_addon
and CONST_MONITORING_ADDON_NAME in addon_profiles
and addon_profiles[CONST_MONITORING_ADDON_NAME].enabled
and monitoring_addon_key in addon_profiles
and addon_profiles[monitoring_addon_key].enabled
)
except Exception as ex: # pylint: disable=broad-except
logger.debug("failed to check monitoring addon enabled: %s", ex)
Expand Down
35 changes: 24 additions & 11 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
check_is_private_link_cluster,
get_cluster_snapshot_by_snapshot_id,
get_k8s_extension_module,
get_monitoring_addon_key,
get_nodepool_snapshot_by_snapshot_id,
print_or_merge_credentials,
process_message_for_run_command,
Expand Down Expand Up @@ -551,7 +552,7 @@ def __init__(self, location, resource_id):
)

resources = get_resources_client(cmd.cli_ctx, cluster_subscription)
for _ in range(3):
for attempt in range(3):
try:
if enable_syslog:
resources.begin_create_or_update_by_id(
Expand All @@ -567,8 +568,11 @@ def __init__(self, location, resource_id):
)
error = None
break
except CLIError as e:
except (CLIError, HttpResponseError) as e:
error = e
# Wait before retry to allow workspace tables to become available
if attempt < 2:
time.sleep(30)
else:
raise error

Expand Down Expand Up @@ -3027,22 +3031,24 @@ def aks_disable_addons(cmd, client, resource_group_name, name, addons, no_wait=F
subscription_id = get_subscription_id(cmd.cli_ctx)

try:
addon_profiles = instance.addon_profiles or {}
monitoring_addon_key = get_monitoring_addon_key(addon_profiles, CONST_MONITORING_ADDON_NAME)
if (
addons == "monitoring" and
CONST_MONITORING_ADDON_NAME in instance.addon_profiles and
instance.addon_profiles[CONST_MONITORING_ADDON_NAME].enabled and
monitoring_addon_key in addon_profiles and
addon_profiles[monitoring_addon_key].enabled and
CONST_MONITORING_USING_AAD_MSI_AUTH in
instance.addon_profiles[CONST_MONITORING_ADDON_NAME].config and
addon_profiles[monitoring_addon_key].config and
str(
instance.addon_profiles[CONST_MONITORING_ADDON_NAME].config[
addon_profiles[monitoring_addon_key].config[
CONST_MONITORING_USING_AAD_MSI_AUTH
]
).lower() == "true"
):
# remove the DCR association because otherwise the DCR can't be deleted
ensure_container_insights_for_monitoring(
cmd,
instance.addon_profiles[CONST_MONITORING_ADDON_NAME],
addon_profiles[monitoring_addon_key],
subscription_id,
resource_group_name,
name,
Expand Down Expand Up @@ -3145,22 +3151,29 @@ def aks_enable_addons(
if (
is_monitoring_addon_enabled
):
addon_profiles = instance.addon_profiles or {}
monitoring_addon_key = get_monitoring_addon_key(addon_profiles, CONST_MONITORING_ADDON_NAME)
if (
CONST_MONITORING_USING_AAD_MSI_AUTH in
instance.addon_profiles[CONST_MONITORING_ADDON_NAME].config and
addon_profiles[monitoring_addon_key].config and
str(
instance.addon_profiles[CONST_MONITORING_ADDON_NAME].config[
addon_profiles[monitoring_addon_key].config[
CONST_MONITORING_USING_AAD_MSI_AUTH
]
).lower() == "true"
):
if not msi_auth:
raise ArgumentUsageError(
"--enable-msi-auth-for-monitoring can not be used on clusters with service principal auth.")
# Auto-enable HLSM when CNL is active and HLSM wasn't explicitly set
if enable_high_log_scale_mode is None and \
(addon_profiles[monitoring_addon_key].config or {}).get(
"enableRetinaNetworkFlags", "").lower() == "true":
enable_high_log_scale_mode = True
# create a Data Collection Rule (DCR) and associate it with the cluster
ensure_container_insights_for_monitoring(
cmd,
instance.addon_profiles[CONST_MONITORING_ADDON_NAME],
addon_profiles[monitoring_addon_key],
subscription_id,
resource_group_name,
name,
Expand Down Expand Up @@ -3188,7 +3201,7 @@ def aks_enable_addons(
raise ArgumentUsageError("--ampls-resource-id can not be used without MSI auth.")
ensure_container_insights_for_monitoring(
cmd,
instance.addon_profiles[CONST_MONITORING_ADDON_NAME],
addon_profiles[monitoring_addon_key],
subscription_id,
resource_group_name,
name,
Expand Down
Loading
Loading