Skip to content

Commit e516116

Browse files
authored
{AKS} Vendor new SDK and bump API version to 2026-02-02-preview (#9798)
1 parent 91ee5b4 commit e516116

353 files changed

Lines changed: 49247 additions & 46265 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/aks-preview/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ To release a new version, please select a new version number (usually plus 1 to
1212
Pending
1313
+++++++
1414

15+
20.0.0b3
16+
++++++
17+
* Vendor new SDK and bump API version to 2026-02-02-preview.
18+
1519
20.0.0b2
1620
+++++++
1721
* `az aks nodepool update`: clean up some useless code in the update managed gpu function.

src/aks-preview/README.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ Released version and adopted API version
223223
* - 19.0.0b18 ~ 19.0.0b23
224224
- 2025-10-02-preview
225225
-
226-
* - 19.0.0b24 ~ latest
226+
* - 19.0.0b24 ~ 20.0.0b2
227227
- 2026-01-02-preview
228-
-
228+
-
229+
* - 20.0.0b3 ~ latest
230+
- 2026-02-02-preview
231+
-

src/aks-preview/azext_aks_preview/_natgateway.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def configure_nat_gateway_profile(
9797
)
9898

9999
if outbound_ip_prefix_ids is not None:
100-
ManagedClusterNATGatewayProfileOutboundIPPrefixes = models.ManagedClusterNATGatewayProfileOutboundIPPrefixes
100+
ManagedClusterNATGatewayProfileOutboundIpPrefixes = models.ManagedClusterNATGatewayProfileOutboundIpPrefixes
101101
prefix_id_list = [x.strip() for x in outbound_ip_prefix_ids.split(',') if x.strip()]
102-
profile.outbound_ip_prefixes = ManagedClusterNATGatewayProfileOutboundIPPrefixes(
102+
profile.outbound_ip_prefixes = ManagedClusterNATGatewayProfileOutboundIpPrefixes(
103103
public_ip_prefixes=prefix_id_list
104104
)
105105

src/aks-preview/azext_aks_preview/agentpool_decorator.py

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
read_file_content,
3030
sdk_no_wait,
3131
)
32+
from azure.core import MatchConditions
3233
from knack.log import get_logger
3334
from knack.prompting import prompt_y_n
3435

@@ -59,6 +60,16 @@
5960

6061
logger = get_logger(__name__)
6162

63+
64+
def _get_etag_match_condition(if_match, if_none_match):
65+
"""Convert if_match/if_none_match to etag/match_condition for the new SDK."""
66+
if if_match is not None:
67+
return if_match, MatchConditions.IfNotModified
68+
if if_none_match is not None:
69+
return if_none_match, MatchConditions.IfMissing
70+
return None, None
71+
72+
6273
# type variables
6374
AgentPool = TypeVar("AgentPool")
6475
AgentPoolsOperations = TypeVar("AgentPoolsOperations")
@@ -1184,7 +1195,7 @@ def get_update_enable_disable_cluster_autoscaler_and_min_max_count_vmsize_vms(
11841195
# if vm_size is not specified, use the size from the existing agentpool profile
11851196
if vm_size is None:
11861197
if autoscale_profile:
1187-
vm_size = autoscale_profile.size
1198+
vm_size = autoscale_profile[0].size
11881199

11891200
if manual_scale_profile:
11901201
vm_size = manual_scale_profile[0].size
@@ -1481,11 +1492,11 @@ def set_up_virtual_machines_profile(self, agentpool: AgentPool) -> AgentPool:
14811492
if enable_auto_scaling:
14821493
agentpool.virtual_machines_profile = self.models.VirtualMachinesProfile(
14831494
scale=self.models.ScaleProfile(
1484-
autoscale=self.models.AutoScaleProfile(
1495+
autoscale=[self.models.AutoScaleProfile(
14851496
size=sizes[0],
14861497
min_count=min_count,
14871498
max_count=max_count,
1488-
)
1499+
)]
14891500
)
14901501
)
14911502
else:
@@ -1549,10 +1560,26 @@ def set_up_machines_mode(self, agentpool: AgentPool) -> AgentPool:
15491560
if mode == CONST_NODEPOOL_MODE_MACHINES:
15501561
agentpool.mode = CONST_NODEPOOL_MODE_MACHINES
15511562
# Make sure all other attributes are None
1552-
for attr in vars(agentpool):
1553-
if attr != 'name' and attr != 'mode' and not attr.startswith('_'):
1554-
if hasattr(agentpool, attr):
1563+
# Check properties sub-model first (AgentPool), then flat fields (ManagedClusterAgentPoolProfile)
1564+
props = getattr(agentpool, 'properties', None)
1565+
rest_fields = getattr(props, '_attr_to_rest_field', None) if props is not None else None
1566+
if rest_fields is not None:
1567+
target, fields = props, rest_fields
1568+
else:
1569+
rest_fields = getattr(agentpool, '_attr_to_rest_field', None)
1570+
if rest_fields is not None and 'mode' in rest_fields:
1571+
target, fields = agentpool, rest_fields
1572+
else:
1573+
target, fields = None, None
1574+
if target is not None:
1575+
for attr in list(fields.keys()):
1576+
if attr not in ('name', 'mode'):
15551577
setattr(agentpool, attr, None)
1578+
else:
1579+
for attr in vars(agentpool):
1580+
if attr != 'name' and attr != 'mode' and not attr.startswith('_'):
1581+
if hasattr(agentpool, attr):
1582+
setattr(agentpool, attr, None)
15561583

15571584
return agentpool
15581585

@@ -1710,15 +1737,18 @@ def set_up_blue_green_upgrade_settings(self, agentpool: AgentPool) -> AgentPool:
17101737
def add_agentpool(self, agentpool: AgentPool) -> AgentPool:
17111738
"""Send request to add a new agentpool."""
17121739
self._ensure_agentpool(agentpool)
1740+
etag, match_condition = _get_etag_match_condition(
1741+
self.context.get_if_match(), self.context.get_if_none_match()
1742+
)
17131743
return sdk_no_wait(
17141744
self.context.get_no_wait(),
17151745
self.client.begin_create_or_update,
17161746
self.context.get_resource_group_name(),
17171747
self.context.get_cluster_name(),
17181748
self.context._get_nodepool_name(enable_validation=False),
17191749
agentpool,
1720-
if_match=self.context.get_if_match(),
1721-
if_none_match=self.context.get_if_none_match(),
1750+
etag=etag,
1751+
match_condition=match_condition,
17221752
headers=self.context.get_aks_custom_headers(),
17231753
)
17241754

@@ -2065,11 +2095,11 @@ def update_auto_scaler_properties_vms(self, agentpool: AgentPool) -> AgentPool:
20652095
if update_cluster_autoscaler or enable_cluster_autoscaler:
20662096
agentpool.virtual_machines_profile = self.models.VirtualMachinesProfile(
20672097
scale=self.models.ScaleProfile(
2068-
autoscale=self.models.AutoScaleProfile(
2098+
autoscale=[self.models.AutoScaleProfile(
20692099
size=vm_size,
20702100
min_count=min_count,
20712101
max_count=max_count,
2072-
)
2102+
)]
20732103
)
20742104
)
20752105

@@ -2182,15 +2212,18 @@ def update_agentpool(self, agentpool: AgentPool) -> AgentPool:
21822212
"""
21832213
self._ensure_agentpool(agentpool)
21842214

2215+
etag, match_condition = _get_etag_match_condition(
2216+
self.context.get_if_match(), self.context.get_if_none_match()
2217+
)
21852218
return sdk_no_wait(
21862219
self.context.get_no_wait(),
21872220
self.client.begin_create_or_update,
21882221
self.context.get_resource_group_name(),
21892222
self.context.get_cluster_name(),
21902223
self.context.get_nodepool_name(),
21912224
agentpool,
2192-
if_match=self.context.get_if_match(),
2193-
if_none_match=self.context.get_if_none_match(),
2225+
etag=etag,
2226+
match_condition=match_condition,
21942227
headers=self.context.get_aks_custom_headers(),
21952228
)
21962229

@@ -2205,6 +2238,9 @@ def add_agentpool(self, agentpool: AgentPool) -> AgentPool:
22052238
"""
22062239
self._ensure_agentpool(agentpool)
22072240

2241+
etag, match_condition = _get_etag_match_condition(
2242+
self.context.get_if_match(), self.context.get_if_none_match()
2243+
)
22082244
return sdk_no_wait(
22092245
self.context.get_no_wait(),
22102246
self.client.begin_create_or_update,
@@ -2213,7 +2249,7 @@ def add_agentpool(self, agentpool: AgentPool) -> AgentPool:
22132249
# validated in "init_agentpool", skip to avoid duplicate api calls
22142250
self.context._get_nodepool_name(enable_validation=False),
22152251
agentpool,
2216-
if_match=self.context.get_if_match(),
2217-
if_none_match=self.context.get_if_none_match(),
2252+
etag=etag,
2253+
match_condition=match_condition,
22182254
headers=self.context.get_aks_custom_headers(),
22192255
)

src/aks-preview/azext_aks_preview/commands.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,62 +100,62 @@ def _patch_custom_cas_in_security_profile(security_profile):
100100
def load_command_table(self, _):
101101
managed_clusters_sdk = CliCommandType(
102102
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
103-
"operations._managed_clusters_operations#ManagedClustersOperations.{}",
103+
"operations._operations#ManagedClustersOperations.{}",
104104
operation_group="managed_clusters",
105105
client_factory=cf_managed_clusters,
106106
)
107107

108108
agent_pools_sdk = CliCommandType(
109109
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
110-
"operations._agent_pools_operations#AgentPoolsOperations.{}",
110+
"operations._operations#AgentPoolsOperations.{}",
111111
client_factory=cf_managed_clusters,
112112
)
113113

114114
managed_namespaces_sdk = CliCommandType(
115115
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
116-
"operations._managed_namespaces_operations#ManagedNamespacesOperations.{}",
116+
"operations._operations#ManagedNamespacesOperations.{}",
117117
client_factory=cf_managed_namespaces,
118118
)
119119

120120
machines_sdk = CliCommandType(
121121
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
122-
"operations._machine_operations#MachinesOperations.{}",
122+
"operations._operations#MachinesOperations.{}",
123123
client_factory=cf_managed_clusters,
124124
)
125125

126126
operations_sdk = CliCommandType(
127127
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
128-
"operations._operationstatusresult_operations#OperationStatusResultOperations.{}",
128+
"operations._operations#OperationStatusResultOperations.{}",
129129
client_factory=cf_operations,
130130
)
131131

132132
maintenance_configuration_sdk = CliCommandType(
133133
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
134-
"operations._maintenance_configurations_operations#MaintenanceConfigurationsOperations.{}",
134+
"operations._operations#MaintenanceConfigurationsOperations.{}",
135135
client_factory=cf_maintenance_configurations,
136136
)
137137

138138
nodepool_snapshot_sdk = CliCommandType(
139139
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
140-
"operations._snapshots_operations#SnapshotsOperations.{}",
140+
"operations._operations#SnapshotsOperations.{}",
141141
client_factory=cf_nodepool_snapshots,
142142
)
143143

144144
mc_snapshot_sdk = CliCommandType(
145145
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
146-
"operations._managed_clusters_snapshots_operations#ManagedClusterSnapshotsOperations.{}",
146+
"operations._operations#ManagedClusterSnapshotsOperations.{}",
147147
client_factory=cf_mc_snapshots,
148148
)
149149

150150
jwt_authenticators_sdk = CliCommandType(
151151
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
152-
"operations._jwt_authenticators_operations#JWTAuthenticatorsOperations.{}",
152+
"operations._operations#JWTAuthenticatorsOperations.{}",
153153
client_factory=cf_jwt_authenticators,
154154
)
155155

156156
vm_skus_sdk = CliCommandType(
157157
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
158-
"operations._vm_skus_operations#VmSkusOperations.{}",
158+
"operations._operations#VmSkusOperations.{}",
159159
client_factory=cf_vm_skus,
160160
)
161161

0 commit comments

Comments
 (0)