Skip to content

Commit c8a9481

Browse files
committed
Merge branch 'main' of github.com:Azure/azure-cli-extensions into bump-holmesgpt
2 parents abc42f3 + 021dc93 commit c8a9481

File tree

824 files changed

+169094
-66101
lines changed

Some content is hidden

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

824 files changed

+169094
-66101
lines changed

src/aks-preview/HISTORY.rst

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

1212
Pending
1313
+++++++
14+
* `az aks update`: Add new parameter `--kms-infrastructure-encryption` to enable KMS infrastructure encryption on an existing cluster.
15+
16+
18.0.0b44
17+
+++++++
18+
* Vendor new SDK and bump API version to 2025-08-02-preview.
19+
* Pre-deprecate `--enable-custom-ca-trust` and `--disable-custom-ca-trust` in `az aks create`, `az aks update` commands.
20+
* Hide `--enable-managed-system-pool` parameter for `az aks create` for now, as the feature is not ready yet.
21+
22+
18.0.0b43
23+
+++++++
24+
* Fix `--localdns-config` parameter to handle null values and case-insensitive JSON keys in DNS override sections, preventing crashes with malformed localdns configuration files.
25+
* Enhance `build_override` function to validate dictionary types and only initialize DNS overrides when present in localdns configuration (case-insensitive).
26+
* Refactor `build_localdns_profile` function to eliminate code duplication between AgentPool add and update operations.
27+
28+
18.0.0b42
29+
+++++++
30+
* Fix role assignment failure when using azure-cli version >= `2.77.0`.
31+
* Add option `Flatcar` to `--os-sku` for `az aks nodepool add` and `az aks nodepool update`.
1432

1533
18.0.0b41
1634
+++++++
@@ -32,7 +50,7 @@ Pending
3250
* Add option `AzureLinuxOSGuard` and `AzureLinux3OSGuard` to `--os-sku` for `az aks nodepool add` and `az aks nodepool update`.
3351
* Add machine command `az aks machine add` to add a machine to an existing machine pool.
3452
* Add blue-green upgrade strategy support for AKS node pools:
35-
- `az aks nodepool add/update/upgrade`: Add `--upgrade-strategy` parameter to switch between rolling and blue-green nodepool upgrades.
53+
- `az aks nodepool add/update/upgrade`: Add `--upgrade-strategy` parameter to switch between rolling and blue-green nodepool upgrades.
3654
- `az aks nodepool add/update/upgrade`: Add `--drain-batch-size`, `--drain-timeout-bg`, `--batch-soak-duration`, `--final-soak-duration` parameters to configure blue-green upgrade settings.
3755

3856
18.0.0b38
@@ -2012,4 +2030,4 @@ Pending
20122030
+++++
20132031

20142032
* new feature `enable-cluster-autoscaler`
2015-
* default agentType is VMSS
2033+
* default agentType is VMSS

src/aks-preview/azext_aks_preview/_consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
CONST_OS_SKU_WINDOWSANNUAL = "WindowsAnnual"
4141
CONST_OS_SKU_AZURELINUX = "AzureLinux"
4242
CONST_OS_SKU_AZURELINUX3 = "AzureLinux3"
43+
CONST_OS_SKU_FLATCAR = "Flatcar"
4344
CONST_OS_SKU_UBUNTU2204 = "Ubuntu2204"
4445
CONST_OS_SKU_UBUNTU2404 = "Ubuntu2404"
4546
CONST_OS_SKU_AZURELINUXOSGUARD = "AzureLinuxOSGuard"

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
short-summary: The ID of a PPG.
272272
- name: --os-sku
273273
type: string
274-
short-summary: The os-sku of the agent node pool. Ubuntu or CBLMariner.
274+
short-summary: The os-sku of the agent node pool. Ubuntu, Ubuntu2204, Ubuntu2404, CBLMariner, AzureLinux, AzureLinux3, AzureLinuxOSGuard, AzureLinux3OSGuard, or Flatcar when os-type is Linux, default is Ubuntu if not set; Windows2019, Windows2022, Windows2025, or WindowsAnnual when os-type is Windows, the current default is Windows2022 if not set.
275275
- name: --enable-fips-image
276276
type: bool
277277
short-summary: Use FIPS-enabled OS on agent nodes.
@@ -1110,6 +1110,10 @@
11101110
- name: --azure-keyvault-kms-key-vault-resource-id
11111111
type: string
11121112
short-summary: Resource ID of Azure Key Vault.
1113+
- name: --kms-infrastructure-encryption
1114+
type: string
1115+
short-summary: Enable encryption at rest of Kubernetes resource objects using service-managed keys.
1116+
long-summary: Enable infrastructure encryption for Kubernetes resource objects. This feature provides encryption at rest for cluster secrets and configuration using service-managed keys. For more information see https://aka.ms/aks/kubernetesResourceObjectEncryption.
11131117
- name: --enable-image-cleaner
11141118
type: bool
11151119
short-summary: Enable ImageCleaner Service.
@@ -1928,7 +1932,7 @@
19281932
short-summary: The OS Type. Linux or Windows. Windows not supported yet for "VirtualMachines" VM set type.
19291933
- name: --os-sku
19301934
type: string
1931-
short-summary: The os-sku of the agent node pool. Ubuntu, Ubuntu2204, Ubuntu2404, CBLMariner, AzureLinux AzureLinux3, AzureLinuxOSGuard, or AzureLinux3OSGuard when os-type is Linux, default is Ubuntu if not set; Windows2019, Windows2022, Windows2025, or WindowsAnnual when os-type is Windows, the current default is Windows2022 if not set.
1935+
short-summary: The os-sku of the agent node pool. Ubuntu, Ubuntu2204, Ubuntu2404, CBLMariner, AzureLinux, AzureLinux3, AzureLinuxOSGuard, AzureLinux3OSGuard, or Flatcar when os-type is Linux, default is Ubuntu if not set; Windows2019, Windows2022, Windows2025, or WindowsAnnual when os-type is Windows, the current default is Windows2022 if not set.
19321936
- name: --enable-fips-image
19331937
type: bool
19341938
short-summary: Use FIPS-enabled OS on agent nodes.

src/aks-preview/azext_aks_preview/_helpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,10 @@ def process_dns_overrides(overrides_dict, target_dict, build_override_func):
460460
:param target_dict: Target dictionary to populate with processed overrides
461461
:param build_override_func: Function to build override objects from dict values
462462
"""
463+
if not isinstance(overrides_dict, dict):
464+
raise InvalidArgumentValueError(
465+
f"Expected a dictionary for DNS overrides, but got {type(overrides_dict).__name__}: {overrides_dict}"
466+
)
463467
if overrides_dict is not None:
464468
for key, value in overrides_dict.items():
465469
if value is not None:

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
CONST_OS_DISK_TYPE_MANAGED,
9494
CONST_OS_SKU_AZURELINUX,
9595
CONST_OS_SKU_AZURELINUX3,
96+
CONST_OS_SKU_FLATCAR,
9697
CONST_OS_SKU_CBLMARINER,
9798
CONST_OS_SKU_MARINER,
9899
CONST_OS_SKU_AZURELINUXOSGUARD,
@@ -280,6 +281,7 @@
280281
node_os_skus_create = [
281282
CONST_OS_SKU_AZURELINUX,
282283
CONST_OS_SKU_AZURELINUX3,
284+
CONST_OS_SKU_FLATCAR,
283285
CONST_OS_SKU_UBUNTU,
284286
CONST_OS_SKU_CBLMARINER,
285287
CONST_OS_SKU_MARINER,
@@ -297,6 +299,7 @@
297299
node_os_skus_update = [
298300
CONST_OS_SKU_AZURELINUX,
299301
CONST_OS_SKU_AZURELINUX3,
302+
CONST_OS_SKU_FLATCAR,
300303
CONST_OS_SKU_UBUNTU,
301304
CONST_OS_SKU_UBUNTU2204,
302305
CONST_OS_SKU_UBUNTU2404,
@@ -1124,7 +1127,10 @@ def load_arguments(self, _):
11241127
# virtual machines
11251128
c.argument("vm_sizes", is_preview=True)
11261129
c.argument("enable_imds_restriction", action="store_true", is_preview=True)
1127-
c.argument("enable_managed_system_pool", action="store_true", is_preview=True)
1130+
c.argument("enable_managed_system_pool",
1131+
action="store_true",
1132+
is_preview=True,
1133+
deprecate_info=c.deprecate(target="--enable-managed-system-pool", hide=True))
11281134
c.argument("enable_upstream_kubescheduler_user_configuration", action="store_true", is_preview=True)
11291135

11301136
with self.argument_context("aks update") as c:
@@ -1261,6 +1267,11 @@ def load_arguments(self, _):
12611267
"azure_keyvault_kms_key_vault_resource_id",
12621268
validator=validate_azure_keyvault_kms_key_vault_resource_id,
12631269
)
1270+
c.argument(
1271+
"kms_infrastructure_encryption",
1272+
arg_type=get_enum_type(["Enabled", "Disabled"]),
1273+
is_preview=True,
1274+
)
12641275
c.argument("http_proxy_config")
12651276
c.argument(
12661277
"bootstrap_artifact_source",

src/aks-preview/azext_aks_preview/_roleassignments.py

Lines changed: 4 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -3,103 +3,8 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55

6-
import time
7-
import uuid
8-
9-
from azure.cli.command_modules.acs._client_factory import (
10-
get_auth_management_client,
6+
# pylint: disable=unused-import
7+
from azure.cli.command_modules.acs._roleassignments import (
8+
add_role_assignment,
9+
add_role_assignment_executor,
1110
)
12-
from azure.cli.command_modules.acs._graph import resolve_object_id
13-
from azure.cli.command_modules.acs._roleassignments import build_role_scope, resolve_role_id
14-
from azure.cli.core.azclierror import AzCLIError
15-
from azure.cli.core.profiles import ResourceType, get_sdk
16-
from azure.core.exceptions import HttpResponseError, ResourceExistsError
17-
from knack.log import get_logger
18-
19-
logger = get_logger(__name__)
20-
21-
# pylint: disable=protected-access
22-
23-
24-
# temp workaround for the breaking change caused by default API version bump of the auth SDK
25-
def add_role_assignment(cmd, role, service_principal_msi_id, is_service_principal=True, delay=2, scope=None):
26-
return _add_role_assignment_new(cmd, role, service_principal_msi_id, is_service_principal, delay, scope)
27-
28-
29-
# TODO(fuming): remove and replaced by import from azure.cli.command_modules.acs once dependency bumped to 2.47.0
30-
def _add_role_assignment_executor_new(cmd, role, assignee, resource_group_name=None, scope=None, resolve_assignee=True):
31-
factory = get_auth_management_client(cmd.cli_ctx, scope)
32-
assignments_client = factory.role_assignments
33-
definitions_client = factory.role_definitions
34-
35-
# FIXME: is this necessary?
36-
if assignments_client._config is None:
37-
raise AzCLIError("Assignments client config is undefined.")
38-
39-
scope = build_role_scope(resource_group_name, scope, assignments_client._config.subscription_id)
40-
41-
# XXX: if role is uuid, this function's output cannot be used as role assignment defintion id
42-
# ref: https://github.com/Azure/azure-cli/issues/2458
43-
role_id = resolve_role_id(role, scope, definitions_client)
44-
45-
# If the cluster has service principal resolve the service principal client id to get the object id,
46-
# if not use MSI object id.
47-
object_id = resolve_object_id(cmd.cli_ctx, assignee) if resolve_assignee else assignee
48-
49-
assignment_name = uuid.uuid4()
50-
custom_headers = None
51-
52-
RoleAssignmentCreateParameters = get_sdk(
53-
cmd.cli_ctx,
54-
ResourceType.MGMT_AUTHORIZATION,
55-
"RoleAssignmentCreateParameters",
56-
mod="models",
57-
operation_group="role_assignments",
58-
)
59-
if cmd.supported_api_version(min_api="2018-01-01-preview", resource_type=ResourceType.MGMT_AUTHORIZATION):
60-
parameters = RoleAssignmentCreateParameters(role_definition_id=role_id, principal_id=object_id,
61-
principal_type=None)
62-
return assignments_client.create(scope, assignment_name, parameters, headers=custom_headers)
63-
64-
# for backward compatibility
65-
RoleAssignmentProperties = get_sdk(
66-
cmd.cli_ctx,
67-
ResourceType.MGMT_AUTHORIZATION,
68-
"RoleAssignmentProperties",
69-
mod="models",
70-
operation_group="role_assignments",
71-
)
72-
properties = RoleAssignmentProperties(role_definition_id=role_id, principal_id=object_id)
73-
return assignments_client.create(scope, assignment_name, properties, headers=custom_headers)
74-
75-
76-
# TODO(fuming): remove and replaced by import from azure.cli.command_modules.acs once dependency bumped to 2.47.0
77-
def _add_role_assignment_new(cmd, role, service_principal_msi_id, is_service_principal=True, delay=2, scope=None):
78-
# AAD can have delays in propagating data, so sleep and retry
79-
hook = cmd.cli_ctx.get_progress_controller(True)
80-
hook.add(message="Waiting for AAD role to propagate", value=0, total_val=1.0)
81-
logger.info("Waiting for AAD role to propagate")
82-
for x in range(0, 10):
83-
hook.add(message="Waiting for AAD role to propagate", value=0.1 * x, total_val=1.0)
84-
try:
85-
# TODO: break this out into a shared utility library
86-
_add_role_assignment_executor_new(
87-
cmd,
88-
role,
89-
service_principal_msi_id,
90-
scope=scope,
91-
resolve_assignee=is_service_principal,
92-
)
93-
break
94-
except HttpResponseError as ex:
95-
if isinstance(ex, ResourceExistsError) or "The role assignment already exists." in ex.message:
96-
break
97-
logger.info(ex.message)
98-
except Exception as ex: # pylint: disable=broad-except
99-
logger.error(str(ex))
100-
time.sleep(delay + delay * x)
101-
else:
102-
return False
103-
hook.add(message="AAD role propagation done", value=1.0, total_val=1.0)
104-
logger.info("AAD role propagation done")
105-
return True

0 commit comments

Comments
 (0)