From 94f04faabadc8f6a1504cbd9c15b9a936e29aae0 Mon Sep 17 00:00:00 2001 From: bragi92 Date: Mon, 12 Sep 2022 12:49:23 -0700 Subject: [PATCH 1/4] fix: Update DCR creation to Clusters resource group instead of workspace --- .../partner_extensions/ContainerInsights.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py index 8f1271b2593..019c7d864b4 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py @@ -588,7 +588,6 @@ def _ensure_container_insights_dcr_for_monitoring(cmd, subscription_id, cluster_ # extract subscription ID and resource group from workspace_resource_id URL parsed = parse_resource_id(workspace_resource_id) - workspace_subscription_id, workspace_resource_group = parsed["subscription"], parsed["resource_group"] workspace_region = '' resources = cf_resources(cmd.cli_ctx, workspace_subscription_id) try: @@ -601,7 +600,7 @@ def _ensure_container_insights_dcr_for_monitoring(cmd, subscription_id, cluster_ raise ex dataCollectionRuleName = f"MSCI-{cluster_name}-{cluster_region}" - dcr_resource_id = f"/subscriptions/{workspace_subscription_id}/resourceGroups/{workspace_resource_group}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" + dcr_resource_id = f"/subscriptions/{subscription_id}/resourceGroups/{cluster_resource_group_name}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" # first get the association between region display names and region IDs (because for some reason # the "which RPs are available in which regions" check returns region display names) From 810d8625f023bf5db49227b84a2f8ed4ca693841 Mon Sep 17 00:00:00 2001 From: bragi92 Date: Mon, 12 Sep 2022 18:34:41 -0700 Subject: [PATCH 2/4] . --- .../azext_k8s_extension/partner_extensions/ContainerInsights.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py index 019c7d864b4..0b33f152dc8 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py @@ -589,6 +589,7 @@ def _ensure_container_insights_dcr_for_monitoring(cmd, subscription_id, cluster_ # extract subscription ID and resource group from workspace_resource_id URL parsed = parse_resource_id(workspace_resource_id) workspace_region = '' + workspace_subscription_id = parsed["subscription"] resources = cf_resources(cmd.cli_ctx, workspace_subscription_id) try: resource = resources.get_by_id(workspace_resource_id, '2015-11-01-preview') From cbacd7200867351aff51e5ea442a5a36b1719275 Mon Sep 17 00:00:00 2001 From: bragi92 Date: Mon, 12 Sep 2022 18:35:17 -0700 Subject: [PATCH 3/4] . --- .../azext_k8s_extension/partner_extensions/ContainerInsights.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py index 0b33f152dc8..f28db3e401e 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py @@ -588,8 +588,8 @@ def _ensure_container_insights_dcr_for_monitoring(cmd, subscription_id, cluster_ # extract subscription ID and resource group from workspace_resource_id URL parsed = parse_resource_id(workspace_resource_id) - workspace_region = '' workspace_subscription_id = parsed["subscription"] + workspace_region = '' resources = cf_resources(cmd.cli_ctx, workspace_subscription_id) try: resource = resources.get_by_id(workspace_resource_id, '2015-11-01-preview') From 5135c107bc81eb57ee9e4568fb91d640a10e1590 Mon Sep 17 00:00:00 2001 From: bragi92 Date: Mon, 19 Sep 2022 22:23:54 -0700 Subject: [PATCH 4/4] casing check --- .../azext_k8s_extension/partner_extensions/ContainerInsights.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py index f28db3e401e..fbbc45ac325 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py @@ -587,7 +587,7 @@ def _ensure_container_insights_dcr_for_monitoring(cmd, subscription_id, cluster_ raise ex # extract subscription ID and resource group from workspace_resource_id URL - parsed = parse_resource_id(workspace_resource_id) + parsed = parse_resource_id(workspace_resource_id.lower()) workspace_subscription_id = parsed["subscription"] workspace_region = '' resources = cf_resources(cmd.cli_ctx, workspace_subscription_id)