Skip to content

Commit dfa4670

Browse files
authored
{AKS} Fix combability issue with official azure-cli (#9699)
1 parent 1fac1ba commit dfa4670

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

src/aks-preview/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ To release a new version, please select a new version number (usually plus 1 to
1111

1212
Pending
1313
+++++++
14+
* Fix `match_condition` kwarg leaking to HTTP transport by overriding `put_mc` and `add_agentpool` to pass `if_match` / `if_none_match` directly to the vendored SDK. This change fixes the compatibility issue as azure-cli/acs module adopts TypeSpec emitted SDKs while azure-cli-extensions/aks-preview still uses the autorest emitted SDK.
1415

1516
19.0.0b27
1617
+++++++

src/aks-preview/azext_aks_preview/agentpool_decorator.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,22 @@ def set_up_blue_green_upgrade_settings(self, agentpool: AgentPool) -> AgentPool:
16181618

16191619
return agentpool
16201620

1621+
# pylint: disable=protected-access
1622+
def add_agentpool(self, agentpool: AgentPool) -> AgentPool:
1623+
"""Send request to add a new agentpool."""
1624+
self._ensure_agentpool(agentpool)
1625+
return sdk_no_wait(
1626+
self.context.get_no_wait(),
1627+
self.client.begin_create_or_update,
1628+
self.context.get_resource_group_name(),
1629+
self.context.get_cluster_name(),
1630+
self.context._get_nodepool_name(enable_validation=False),
1631+
agentpool,
1632+
if_match=self.context.get_if_match(),
1633+
if_none_match=self.context.get_if_none_match(),
1634+
headers=self.context.get_aks_custom_headers(),
1635+
)
1636+
16211637

16221638
class AKSPreviewAgentPoolUpdateDecorator(AKSAgentPoolUpdateDecorator):
16231639
def __init__(

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5376,6 +5376,34 @@ def postprocessing_after_mc_created(self, cluster: ManagedCluster) -> None:
53765376
resolve_assignee=False,
53775377
)
53785378

5379+
def put_mc(self, mc: ManagedCluster) -> ManagedCluster:
5380+
if self.check_is_postprocessing_required(mc):
5381+
# send request
5382+
poller = self.client.begin_create_or_update(
5383+
resource_group_name=self.context.get_resource_group_name(),
5384+
resource_name=self.context.get_name(),
5385+
parameters=mc,
5386+
if_match=self.context.get_if_match(),
5387+
if_none_match=self.context.get_if_none_match(),
5388+
headers=self.context.get_aks_custom_headers(),
5389+
)
5390+
self.immediate_processing_after_request(mc)
5391+
# poll until the result is returned
5392+
cluster = LongRunningOperation(self.cmd.cli_ctx)(poller)
5393+
self.postprocessing_after_mc_created(cluster)
5394+
else:
5395+
cluster = sdk_no_wait(
5396+
self.context.get_no_wait(),
5397+
self.client.begin_create_or_update,
5398+
resource_group_name=self.context.get_resource_group_name(),
5399+
resource_name=self.context.get_name(),
5400+
parameters=mc,
5401+
if_match=self.context.get_if_match(),
5402+
if_none_match=self.context.get_if_none_match(),
5403+
headers=self.context.get_aks_custom_headers(),
5404+
)
5405+
return cluster
5406+
53795407

53805408
class AKSPreviewManagedClusterUpdateDecorator(AKSManagedClusterUpdateDecorator):
53815409
def __init__(

0 commit comments

Comments
 (0)