Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit f519ff6

Browse files
wanlonghenryrootbavneetsingh16
authored
sperate api version for connected and provisioned (#169)
* fix ci script * sperate_api_version * change_style * use_const_for_provisioned_api Co-authored-by: root <[email protected]> Co-authored-by: Bavneet Singh <[email protected]>
1 parent 85a879d commit f519ff6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/k8s-extension/azext_k8s_extension/partner_extensions/ContainerInsights.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import json
1010

1111
from ..utils import get_cluster_rp_api_version
12+
from .. import consts
1213

1314
from knack.log import get_logger
1415

@@ -244,7 +245,10 @@ def _ensure_default_log_analytics_workspace_for_monitoring(cmd, subscription_id,
244245
cluster_resource_id = '/subscriptions/{0}/resourceGroups/{1}/providers/{2}/{3}/{4}'.format(
245246
subscription_id, cluster_resource_group_name, cluster_rp, cluster_type, cluster_name)
246247
try:
247-
resource = resources.get_by_id(cluster_resource_id, '2022-05-01-preview')
248+
if cluster_rp.lower() == consts.HYBRIDCONTAINERSERVICE_RP:
249+
resource = resources.get_by_id(cluster_resource_id, consts.HYBRIDCONTAINERSERVICE_API_VERSION)
250+
else:
251+
resource = resources.get_by_id(cluster_resource_id, '2020-01-01-preview')
248252
cluster_location = resource.location.lower()
249253
except HttpResponseError as ex:
250254
raise ex
@@ -574,7 +578,10 @@ def _ensure_container_insights_dcr_for_monitoring(cmd, subscription_id, cluster_
574578
cluster_resource_id = '/subscriptions/{0}/resourceGroups/{1}/providers/{2}/{3}/{4}'.format(
575579
subscription_id, cluster_resource_group_name, cluster_rp, cluster_type, cluster_name)
576580
try:
577-
resource = resources.get_by_id(cluster_resource_id, '2022-05-01-preview')
581+
if cluster_rp.lower() == consts.HYBRIDCONTAINERSERVICE_RP:
582+
resource = resources.get_by_id(cluster_resource_id, consts.HYBRIDCONTAINERSERVICE_API_VERSION)
583+
else:
584+
resource = resources.get_by_id(cluster_resource_id, '2020-01-01-preview')
578585
cluster_region = resource.location.lower()
579586
except HttpResponseError as ex:
580587
raise ex

0 commit comments

Comments
 (0)