Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ To release a new version, please select a new version number (usually plus 1 to
Pending
+++++++

20.0.0b3
++++++
* Vendor new SDK and bump API version to 2026-02-02-preview.

20.0.0b2
+++++++
* `az aks nodepool update`: clean up some useless code in the update managed gpu function.
Expand Down
7 changes: 5 additions & 2 deletions src/aks-preview/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ Released version and adopted API version
* - 19.0.0b18 ~ 19.0.0b23
- 2025-10-02-preview
-
* - 19.0.0b24 ~ latest
* - 19.0.0b24 ~ 20.0.0b2
- 2026-01-02-preview
-
-
* - 20.0.0b3 ~ latest
- 2026-02-02-preview
-
4 changes: 2 additions & 2 deletions src/aks-preview/azext_aks_preview/_natgateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ def configure_nat_gateway_profile(
)

if outbound_ip_prefix_ids is not None:
ManagedClusterNATGatewayProfileOutboundIPPrefixes = models.ManagedClusterNATGatewayProfileOutboundIPPrefixes
ManagedClusterNATGatewayProfileOutboundIpPrefixes = models.ManagedClusterNATGatewayProfileOutboundIpPrefixes
prefix_id_list = [x.strip() for x in outbound_ip_prefix_ids.split(',') if x.strip()]
profile.outbound_ip_prefixes = ManagedClusterNATGatewayProfileOutboundIPPrefixes(
profile.outbound_ip_prefixes = ManagedClusterNATGatewayProfileOutboundIpPrefixes(
public_ip_prefixes=prefix_id_list
)

Expand Down
64 changes: 50 additions & 14 deletions src/aks-preview/azext_aks_preview/agentpool_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
read_file_content,
sdk_no_wait,
)
from azure.core import MatchConditions
from knack.log import get_logger
from knack.prompting import prompt_y_n

Expand Down Expand Up @@ -59,6 +60,16 @@

logger = get_logger(__name__)


def _get_etag_match_condition(if_match, if_none_match):
"""Convert if_match/if_none_match to etag/match_condition for the new SDK."""
if if_match is not None:
return if_match, MatchConditions.IfNotModified
if if_none_match is not None:
return if_none_match, MatchConditions.IfMissing
return None, None


# type variables
AgentPool = TypeVar("AgentPool")
AgentPoolsOperations = TypeVar("AgentPoolsOperations")
Expand Down Expand Up @@ -1184,7 +1195,7 @@ def get_update_enable_disable_cluster_autoscaler_and_min_max_count_vmsize_vms(
# if vm_size is not specified, use the size from the existing agentpool profile
if vm_size is None:
if autoscale_profile:
vm_size = autoscale_profile.size
vm_size = autoscale_profile[0].size

if manual_scale_profile:
vm_size = manual_scale_profile[0].size
Expand Down Expand Up @@ -1481,11 +1492,11 @@ def set_up_virtual_machines_profile(self, agentpool: AgentPool) -> AgentPool:
if enable_auto_scaling:
agentpool.virtual_machines_profile = self.models.VirtualMachinesProfile(
scale=self.models.ScaleProfile(
autoscale=self.models.AutoScaleProfile(
autoscale=[self.models.AutoScaleProfile(
size=sizes[0],
min_count=min_count,
max_count=max_count,
)
)]
)
)
else:
Expand Down Expand Up @@ -1549,10 +1560,26 @@ def set_up_machines_mode(self, agentpool: AgentPool) -> AgentPool:
if mode == CONST_NODEPOOL_MODE_MACHINES:
agentpool.mode = CONST_NODEPOOL_MODE_MACHINES
# Make sure all other attributes are None
for attr in vars(agentpool):
if attr != 'name' and attr != 'mode' and not attr.startswith('_'):
if hasattr(agentpool, attr):
# Check properties sub-model first (AgentPool), then flat fields (ManagedClusterAgentPoolProfile)
props = getattr(agentpool, 'properties', None)
rest_fields = getattr(props, '_attr_to_rest_field', None) if props is not None else None
if rest_fields is not None:
target, fields = props, rest_fields
else:
rest_fields = getattr(agentpool, '_attr_to_rest_field', None)
if rest_fields is not None and 'mode' in rest_fields:
target, fields = agentpool, rest_fields
else:
target, fields = None, None
if target is not None:
for attr in list(fields.keys()):
if attr not in ('name', 'mode'):
setattr(agentpool, attr, None)
else:
for attr in vars(agentpool):
if attr != 'name' and attr != 'mode' and not attr.startswith('_'):
if hasattr(agentpool, attr):
setattr(agentpool, attr, None)

return agentpool

Expand Down Expand Up @@ -1710,15 +1737,18 @@ def set_up_blue_green_upgrade_settings(self, agentpool: AgentPool) -> AgentPool:
def add_agentpool(self, agentpool: AgentPool) -> AgentPool:
"""Send request to add a new agentpool."""
self._ensure_agentpool(agentpool)
etag, match_condition = _get_etag_match_condition(
self.context.get_if_match(), self.context.get_if_none_match()
)
return sdk_no_wait(
self.context.get_no_wait(),
self.client.begin_create_or_update,
self.context.get_resource_group_name(),
self.context.get_cluster_name(),
self.context._get_nodepool_name(enable_validation=False),
agentpool,
if_match=self.context.get_if_match(),
if_none_match=self.context.get_if_none_match(),
etag=etag,
match_condition=match_condition,
headers=self.context.get_aks_custom_headers(),
)

Expand Down Expand Up @@ -2065,11 +2095,11 @@ def update_auto_scaler_properties_vms(self, agentpool: AgentPool) -> AgentPool:
if update_cluster_autoscaler or enable_cluster_autoscaler:
agentpool.virtual_machines_profile = self.models.VirtualMachinesProfile(
scale=self.models.ScaleProfile(
autoscale=self.models.AutoScaleProfile(
autoscale=[self.models.AutoScaleProfile(
size=vm_size,
min_count=min_count,
max_count=max_count,
)
)]
)
)

Expand Down Expand Up @@ -2182,15 +2212,18 @@ def update_agentpool(self, agentpool: AgentPool) -> AgentPool:
"""
self._ensure_agentpool(agentpool)

etag, match_condition = _get_etag_match_condition(
self.context.get_if_match(), self.context.get_if_none_match()
)
return sdk_no_wait(
self.context.get_no_wait(),
self.client.begin_create_or_update,
self.context.get_resource_group_name(),
self.context.get_cluster_name(),
self.context.get_nodepool_name(),
agentpool,
if_match=self.context.get_if_match(),
if_none_match=self.context.get_if_none_match(),
etag=etag,
match_condition=match_condition,
headers=self.context.get_aks_custom_headers(),
)

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

etag, match_condition = _get_etag_match_condition(
self.context.get_if_match(), self.context.get_if_none_match()
)
return sdk_no_wait(
self.context.get_no_wait(),
self.client.begin_create_or_update,
Expand All @@ -2213,7 +2249,7 @@ def add_agentpool(self, agentpool: AgentPool) -> AgentPool:
# validated in "init_agentpool", skip to avoid duplicate api calls
self.context._get_nodepool_name(enable_validation=False),
agentpool,
if_match=self.context.get_if_match(),
if_none_match=self.context.get_if_none_match(),
etag=etag,
match_condition=match_condition,
headers=self.context.get_aks_custom_headers(),
)
20 changes: 10 additions & 10 deletions src/aks-preview/azext_aks_preview/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,62 +100,62 @@ def _patch_custom_cas_in_security_profile(security_profile):
def load_command_table(self, _):
managed_clusters_sdk = CliCommandType(
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
"operations._managed_clusters_operations#ManagedClustersOperations.{}",
"operations._operations#ManagedClustersOperations.{}",
operation_group="managed_clusters",
client_factory=cf_managed_clusters,
)

agent_pools_sdk = CliCommandType(
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
"operations._agent_pools_operations#AgentPoolsOperations.{}",
"operations._operations#AgentPoolsOperations.{}",
client_factory=cf_managed_clusters,
)

managed_namespaces_sdk = CliCommandType(
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
"operations._managed_namespaces_operations#ManagedNamespacesOperations.{}",
"operations._operations#ManagedNamespacesOperations.{}",
client_factory=cf_managed_namespaces,
)

machines_sdk = CliCommandType(
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
"operations._machine_operations#MachinesOperations.{}",
"operations._operations#MachinesOperations.{}",
client_factory=cf_managed_clusters,
)

operations_sdk = CliCommandType(
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
"operations._operationstatusresult_operations#OperationStatusResultOperations.{}",
"operations._operations#OperationStatusResultOperations.{}",
client_factory=cf_operations,
)

maintenance_configuration_sdk = CliCommandType(
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
"operations._maintenance_configurations_operations#MaintenanceConfigurationsOperations.{}",
"operations._operations#MaintenanceConfigurationsOperations.{}",
client_factory=cf_maintenance_configurations,
)

nodepool_snapshot_sdk = CliCommandType(
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
"operations._snapshots_operations#SnapshotsOperations.{}",
"operations._operations#SnapshotsOperations.{}",
client_factory=cf_nodepool_snapshots,
)

mc_snapshot_sdk = CliCommandType(
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
"operations._managed_clusters_snapshots_operations#ManagedClusterSnapshotsOperations.{}",
"operations._operations#ManagedClusterSnapshotsOperations.{}",
client_factory=cf_mc_snapshots,
)

jwt_authenticators_sdk = CliCommandType(
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
"operations._jwt_authenticators_operations#JWTAuthenticatorsOperations.{}",
"operations._operations#JWTAuthenticatorsOperations.{}",
client_factory=cf_jwt_authenticators,
)

vm_skus_sdk = CliCommandType(
operations_tmpl="azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks."
"operations._vm_skus_operations#VmSkusOperations.{}",
"operations._operations#VmSkusOperations.{}",
client_factory=cf_vm_skus,
)

Expand Down
Loading
Loading