{AKS} Fix DCR create/update for container network logs and high log scale mode #9667
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9667"
general
weight: 0.35
carlotaarvela
Related command
az aks create,az aks updateGeneral 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.---
Description
Fixes the
az aks createandaz aks updatecommands so that the Data Collection Rule (DCR) is properly created or updated when container network logs (CNL) or high log scale mode (HLSM) flags are passed. Previously, the DCR was not being created/updated in these scenarios, causing streams likeMicrosoft-ContainerLogV2-HighScaleto be out of sync.Also fixes
--disable-azure-monitor-logsso it actually disables monitoring by settingazureMonitorProfile.containerInsights.enabled = False(the RP's source of truth), and handlesomsAgentvsomsagentkey casing inconsistencies from the Azure API.Changes
Shared utilities:
_get_monitoring_addon_key()helper to resolve the monitoring addon key from a cluster'saddon_profiles, handling bothomsagentandomsAgentkey variants returned by the API.Context (
AKSPreviewManagedClusterContext):get_enable_msi_auth_for_monitoring()to detect MSI auth on clusters whereservice_principal_profile.client_idis"msi"by checking the addon'suseAADAuthconfig instead of returningFalse.get_container_network_logs()andget_enable_high_log_scale_mode()to handle bothomsagentandomsAgentaddon key variants.MutuallyExclusiveArgumentError.enable_high_log_scale_modeto the special parameter defaults list so standalone--enable-high-log-scale-modepasses thecheck_raw_parametersgate.Create path (
AKSPreviewManagedClusterCreateDecorator):_setup_azure_monitor_logs()(pre-PUT), matching the base classbuild_monitoring_addon_profilepattern. DCRA is still created in postprocessing._should_create_dcra()and_is_cnl_or_hlsm_changing()helpers to detect when CNL/HLSM flags require DCR/DCRA creation._postprocess_monitoring_enable()and_postprocess_monitoring_disable()into reusable methods.Update path (
AKSPreviewManagedClusterUpdateDecorator):update_monitoring_profile_flow_logs(): Added base class delegation (super().update_monitoring_profile_flow_logs(mc)) for CLI >= 2.84.0 compatibility, and guarded the call site inupdate_mc_profile_preview()to avoid double execution.--enable-container-network-logsor--enable-retina-flow-logsis passed, themonitoring_addon_postprocessing_requiredintermediate is now set, triggering the DCR update viaensure_container_insights_for_monitoring.--enable-high-log-scale-mode: requires the monitoring addon with MSI auth to be enabled, with an escape hatch when--enable-azure-monitor-logsis passed simultaneously.--enable-high-log-scale-mode false: prevents disabling HLSM while CNL is still enabled._disable_azure_monitor_logs(): now setsmc.azure_monitor_profile.container_insights.enabled = False(the RP source of truth) and usesconfig = Noneinstead ofconfig = {}to match the base CLI behavior._get_monitoring_addon_key()for correct key resolution.Tests:
test_aks_create_with_azuremonitorlogs_and_cnl,test_aks_update_enable_azuremonitorlogs_with_hlsm,test_aks_create_with_retina_flow_logs_alias,test_aks_update_enable_cnl_via_azuremonitorlogs,test_aks_update_disable_azuremonitorlogs,test_aks_update_standalone_enable_high_log_scale_mode.Testing
pytest src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py -k "container_network_logs or high_log_scale_mode or enable_container_network or standalone_high_log or disable_azure_monitor or postprocessing_create_dcr or update_monitoring_profile_flow_logs"AZURE_TEST_RUN_LIVE=true pytest src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py -k "test_aks_create_with_azuremonitorlogs_and_cnl or test_aks_update_enable_azuremonitorlogs_with_hlsm or test_aks_create_with_retina_flow_logs_alias or test_aks_update_enable_cnl_via_azuremonitorlogs or test_aks_update_disable_azuremonitorlogs or test_aks_update_standalone_enable_high_log_scale_mode"