Skip to content

Commit cea0bd0

Browse files
daweim0zhoxing-ms
andauthored
David/aks monitoring aad auth (Azure#3500)
* about to add check for if DCR is available in regions * tested * forgot to remove an exception * fixed linter problems * fixed some linter errors * fixing linter errors * fixing some feedback, more to come * fixed all feedback and a bug * cleanup * addressed comments and static analyzer errors * Update src/aks-preview/azext_aks_preview/_help.py Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com> * Update src/aks-preview/azext_aks_preview/_help.py Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com> * fix linter error * fixed small errors * added unit tests, cleaned up the msi/sp auth check * adding unit tests * commenting out tests which require a subscription-level feature flag * uncommented tests, put them in a list to not run Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com>
1 parent f29b323 commit cea0bd0

File tree

7 files changed

+494
-117
lines changed

7 files changed

+494
-117
lines changed

linter_exclusions.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ aks create:
7676
workspace_resource_id:
7777
rule_exclusions:
7878
- option_length_too_long
79+
enable_msi_auth_for_monitoring:
80+
rule_exclusions:
81+
- option_length_too_long
7982
enable_encryption_at_host:
8083
rule_exclusions:
8184
- option_length_too_long
@@ -93,6 +96,9 @@ aks enable-addons:
9396
workspace_resource_id:
9497
rule_exclusions:
9598
- option_length_too_long
99+
enable_msi_auth_for_monitoring:
100+
rule_exclusions:
101+
- option_length_too_long
96102
aks nodepool add:
97103
parameters:
98104
enable_node_public_ip:

src/aks-preview/azcli_aks_live_test/configs/ext_matrix_default.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
"test_aks_create_with_pod_identity_enabled",
2727
"test_aks_create_using_azurecni_with_pod_identity_enabled",
2828
"test_aks_pod_identity_usage",
29-
"test_aks_create_with_fips"
29+
"test_aks_create_with_fips",
30+
"test_aks_create_with_monitoring_aad_auth_msi",
31+
"test_aks_create_with_monitoring_aad_auth_uai",
32+
"test_aks_enable_monitoring_with_aad_auth_msi",
33+
"test_aks_enable_monitoring_with_aad_auth_uai"
3034
],
3135
"unknown": [
3236
"test_aks_create_and_update_with_managed_aad_enable_azure_rbac",

src/aks-preview/azext_aks_preview/_consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
CONST_MONITORING_ADDON_NAME = "omsagent"
2525
CONST_MONITORING_LOG_ANALYTICS_WORKSPACE_RESOURCE_ID = "logAnalyticsWorkspaceResourceID"
26+
CONST_MONITORING_USING_AAD_MSI_AUTH = "useAADAuth"
2627

2728
CONST_VIRTUAL_NODE_ADDON_NAME = "aciConnector"
2829
CONST_VIRTUAL_NODE_SUBNET_NAME = "SubnetName"

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@
222222
- name: --workspace-resource-id
223223
type: string
224224
short-summary: The resource ID of an existing Log Analytics Workspace to use for storing monitoring data. If not specified, uses the default Log Analytics Workspace if it exists, otherwise creates one.
225+
- name: --enable-msi-auth-for-monitoring
226+
type: bool
227+
short-summary: Send monitoring data to Log Analytics using the cluster's assigned identity (instead of the Log Analytics Workspace's shared key).
225228
- name: --enable-cluster-autoscaler
226229
type: bool
227230
short-summary: Enable cluster autoscaler, default value is false.
@@ -1042,6 +1045,9 @@
10421045
- name: --workspace-resource-id
10431046
type: string
10441047
short-summary: The resource ID of an existing Log Analytics Workspace to use for storing monitoring data.
1048+
- name: --enable-msi-auth-for-monitoring
1049+
type: bool
1050+
short-summary: Send monitoring data to Log Analytics using the cluster's assigned identity (instead of the Log Analytics Workspace's shared key).
10451051
- name: --subnet-name -s
10461052
type: string
10471053
short-summary: The subnet name for the virtual node to use.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def load_arguments(self, _):
9191
c.argument('pod_subnet_id', type=str, validator=validate_pod_subnet_id)
9292
c.argument('ppg')
9393
c.argument('workspace_resource_id')
94+
c.argument('enable_msi_auth_for_monitoring', arg_type=get_three_state_flag(), is_preview=True)
9495
c.argument('skip_subnet_role_assignment', action='store_true')
9596
c.argument('enable_fips_image', action='store_true', is_preview=True)
9697
c.argument('enable_cluster_autoscaler', action='store_true')
@@ -261,6 +262,8 @@ def load_arguments(self, _):
261262
c.argument('appgw_subnet_id', options_list=['--appgw-subnet-id'], arg_group='Application Gateway')
262263
c.argument('appgw_watch_namespace', options_list=['--appgw-watch-namespace'], arg_group='Application Gateway')
263264
c.argument('enable_secret_rotation', action='store_true')
265+
c.argument('workspace_resource_id')
266+
c.argument('enable_msi_auth_for_monitoring', arg_type=get_three_state_flag(), is_preview=True)
264267

265268
with self.argument_context('aks get-credentials') as c:
266269
c.argument('admin', options_list=['--admin', '-a'], default=False)

0 commit comments

Comments
 (0)