Skip to content

Commit ef09b9b

Browse files
committed
Merge branch 'main' of https://github.com/AzureArcForKubernetes/connectedk8s into gabrielmousa/proxyupdate
2 parents 2a3d246 + 979a4c3 commit ef09b9b

File tree

906 files changed

+312993
-240884
lines changed

Some content is hidden

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

906 files changed

+312993
-240884
lines changed

src/aks-preview/HISTORY.rst

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

15+
19.0.0b1
16+
+++++++
17+
* [BREAKING CHANGE]: `az aks create`: remove `--enable-custom-ca-trust` and `--disable-custom-ca-trust` options
18+
* [BREAKING CHANGE]: `az aks update`: remove `--enable-custom-ca-trust` and `--disable-custom-ca-trust` options
19+
* [BREAKING CHANGE]: `az aks nodepool add`: remove `--enable-custom-ca-trust` and `--disable-custom-ca-trust` options
20+
* [BREAKING CHANGE]: `az aks nodepool update`: remove `--enable-custom-ca-trust` and `--disable-custom-ca-trust` options
21+
* `az aks update`: Add new parameter `--kms-infrastructure-encryption` to enable KMS infrastructure encryption on an existing cluster.
22+
23+
18.0.0b44
24+
+++++++
25+
* Vendor new SDK and bump API version to 2025-08-02-preview.
26+
* Pre-deprecate `--enable-custom-ca-trust` and `--disable-custom-ca-trust` in `az aks create`, `az aks update` commands.
27+
* Hide `--enable-managed-system-pool` parameter for `az aks create` for now, as the feature is not ready yet.
28+
29+
18.0.0b43
30+
+++++++
31+
* Fix `--localdns-config` parameter to handle null values and case-insensitive JSON keys in DNS override sections, preventing crashes with malformed localdns configuration files.
32+
* Enhance `build_override` function to validate dictionary types and only initialize DNS overrides when present in localdns configuration (case-insensitive).
33+
* Refactor `build_localdns_profile` function to eliminate code duplication between AgentPool add and update operations.
34+
35+
18.0.0b42
36+
+++++++
37+
* Fix role assignment failure when using azure-cli version >= `2.77.0`.
38+
* Add option `Flatcar` to `--os-sku` for `az aks nodepool add` and `az aks nodepool update`.
39+
1540
18.0.0b41
1641
+++++++
1742
* Fix `--localdns-config` parameter to handle null values in JSON configuration files gracefully, preventing crashes when DNS override sections are null.
@@ -32,7 +57,7 @@ Pending
3257
* Add option `AzureLinuxOSGuard` and `AzureLinux3OSGuard` to `--os-sku` for `az aks nodepool add` and `az aks nodepool update`.
3358
* Add machine command `az aks machine add` to add a machine to an existing machine pool.
3459
* 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.
60+
- `az aks nodepool add/update/upgrade`: Add `--upgrade-strategy` parameter to switch between rolling and blue-green nodepool upgrades.
3661
- `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.
3762

3863
18.0.0b38
@@ -2012,4 +2037,4 @@ Pending
20122037
+++++
20132038

20142039
* new feature `enable-cluster-autoscaler`
2015-
* default agentType is VMSS
2040+
* default agentType is VMSS
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Azure CLI AKS Live Test Pipeline & Azure CLI AKS Unit Test Pipeline
22

3-
These pipelines are used to test newly added aks commands in module aks-preview (azure-cli-extensions) / acs (azure-cli, not covered by default). For more details, you may refer to this [wiki](https://dev.azure.com/msazure/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/156735/CLI-AKS-Live-Unit-Test-Pipeline).
3+
These pipelines are used to test newly added aks commands in module aks-preview (azure-cli-extensions) / acs (azure-cli, not covered by default). For more details, you may refer to this [wiki](https://dev.azure.com/msazure/CloudNativeCompute/_wiki/wikis/CloudNativeCompute.wiki/358312/AZCLI-AKS-Live-Unit-Test-Pipelines).
44

55
## How to use
66

@@ -10,4 +10,4 @@ By default, for **live test pipeline**, the test will be performed in **record m
1010

1111
If the newly added commands and test cases use the **features** that are being previewed, that is, some feature under container service needs to be manually registered before using the command, then such cases will not be able to execute/pass the test temporarily, since the subscription used for testing does not (and does not intend to) enable these additional features. In the future, we will use customer header to pass these features in test cases, but for now you can just bypass these cases. For now, you can follow the instructions in [section Bypass Test Case](#bypass-test-case) to **bypass such test cases**.
1212

13-
You can also trigger this pipeline **manually** and adjust variables such as test coverage, test filter, test location, etc. as needed. For more details, you may refer to the following sections.
13+
You can also trigger this pipeline **manually** and adjust variables such as test coverage, test filter, test location, etc. as needed. For more details, you may refer to the following sections.

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 & 16 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.
@@ -517,9 +517,6 @@
517517
- name: --dns-zone-resource-ids
518518
type: string
519519
short-summary: A comma separated list of resource IDs of the DNS zone resource to use with the App Routing addon.
520-
- name: --enable-custom-ca-trust
521-
type: bool
522-
short-summary: Enable Custom CA Trust on agent node pool.
523520
- name: --ca-certs --custom-ca-trust-certificates
524521
type: string
525522
short-summary: Path to a file containing up to 10 blank line separated certificates. Only valid for linux nodes.
@@ -730,8 +727,6 @@
730727
text: az aks create -g MyResourceGroup -n MyMC --kubernetes-version 1.20.13 --location westus2 --host-group-id /subscriptions/00000/resourceGroups/AnotherResourceGroup/providers/Microsoft.ContainerService/hostGroups/myHostGroup --node-vm-size VMSize --enable-managed-identity --assign-identity <user_assigned_identity_resource_id>
731728
- name: Create a kubernetes cluster with no CNI installed.
732729
text: az aks create -g MyResourceGroup -n MyManagedCluster --network-plugin none
733-
- name: Create a kubernetes cluster with Custom CA Trust enabled.
734-
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-custom-ca-trust
735730
- name: Create a kubernetes cluster with safeguards set to "Warning"
736731
text: az aks create -g MyResourceGroup -n MyManagedCluster --safeguards-level Warning --enable-addons azure-policy
737732
- name: Create a kubernetes cluster with safeguards set to "Warning" and some namespaces excluded
@@ -1110,6 +1105,10 @@
11101105
- name: --azure-keyvault-kms-key-vault-resource-id
11111106
type: string
11121107
short-summary: Resource ID of Azure Key Vault.
1108+
- name: --kms-infrastructure-encryption
1109+
type: string
1110+
short-summary: Enable encryption at rest of Kubernetes resource objects using service-managed keys.
1111+
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.
11131112
- name: --enable-image-cleaner
11141113
type: bool
11151114
short-summary: Enable ImageCleaner Service.
@@ -1928,7 +1927,7 @@
19281927
short-summary: The OS Type. Linux or Windows. Windows not supported yet for "VirtualMachines" VM set type.
19291928
- name: --os-sku
19301929
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.
1930+
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.
19321931
- name: --enable-fips-image
19331932
type: bool
19341933
short-summary: Use FIPS-enabled OS on agent nodes.
@@ -2019,9 +2018,6 @@
20192018
- name: --message-of-the-day
20202019
type: string
20212020
short-summary: Path to a file containing the desired message of the day. Only valid for linux nodes. Will be written to /etc/motd.
2022-
- name: --enable-custom-ca-trust
2023-
type: bool
2024-
short-summary: Enable Custom CA Trust on agent node pool.
20252021
- name: --disable-windows-outbound-nat
20262022
type: bool
20272023
short-summary: Disable Windows OutboundNAT on Windows agent node pool. Must use VMSS agent pool type.
@@ -2241,12 +2237,6 @@
22412237
- name: --node-taints
22422238
type: string
22432239
short-summary: The node taints for the node pool.
2244-
- name: --enable-custom-ca-trust
2245-
type: bool
2246-
short-summary: Enable Custom CA Trust on agent node pool.
2247-
- name: --dcat --disable-custom-ca-trust
2248-
type: bool
2249-
short-summary: Disable Custom CA Trust on agent node pool.
22502240
- name: --aks-custom-headers
22512241
type: string
22522242
short-summary: Send custom headers. When specified, format should be Key1=Value1,Key2=Value2

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 & 19 deletions
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,
@@ -185,7 +186,6 @@
185186
validate_defender_disable_and_enable_parameters,
186187
validate_disable_windows_outbound_nat,
187188
validate_asm_egress_name,
188-
validate_enable_custom_ca_trust,
189189
validate_eviction_policy,
190190
validate_grafanaresourceid,
191191
validate_host_group_id,
@@ -280,6 +280,7 @@
280280
node_os_skus_create = [
281281
CONST_OS_SKU_AZURELINUX,
282282
CONST_OS_SKU_AZURELINUX3,
283+
CONST_OS_SKU_FLATCAR,
283284
CONST_OS_SKU_UBUNTU,
284285
CONST_OS_SKU_CBLMARINER,
285286
CONST_OS_SKU_MARINER,
@@ -297,6 +298,7 @@
297298
node_os_skus_update = [
298299
CONST_OS_SKU_AZURELINUX,
299300
CONST_OS_SKU_AZURELINUX3,
301+
CONST_OS_SKU_FLATCAR,
300302
CONST_OS_SKU_UBUNTU,
301303
CONST_OS_SKU_UBUNTU2204,
302304
CONST_OS_SKU_UBUNTU2404,
@@ -973,8 +975,6 @@ def load_arguments(self, _):
973975
arg_type=get_enum_type(workload_runtimes),
974976
default=CONST_WORKLOAD_RUNTIME_OCI_CONTAINER,
975977
)
976-
# no validation for aks create because it already only supports Linux.
977-
c.argument("enable_custom_ca_trust", action="store_true")
978978
c.argument(
979979
"nodepool_allowed_host_ports",
980980
validator=validate_allowed_host_ports,
@@ -1124,7 +1124,10 @@ def load_arguments(self, _):
11241124
# virtual machines
11251125
c.argument("vm_sizes", is_preview=True)
11261126
c.argument("enable_imds_restriction", action="store_true", is_preview=True)
1127-
c.argument("enable_managed_system_pool", action="store_true", is_preview=True)
1127+
c.argument("enable_managed_system_pool",
1128+
action="store_true",
1129+
is_preview=True,
1130+
deprecate_info=c.deprecate(target="--enable-managed-system-pool", hide=True))
11281131
c.argument("enable_upstream_kubescheduler_user_configuration", action="store_true", is_preview=True)
11291132

11301133
with self.argument_context("aks update") as c:
@@ -1261,6 +1264,11 @@ def load_arguments(self, _):
12611264
"azure_keyvault_kms_key_vault_resource_id",
12621265
validator=validate_azure_keyvault_kms_key_vault_resource_id,
12631266
)
1267+
c.argument(
1268+
"kms_infrastructure_encryption",
1269+
arg_type=get_enum_type(["Enabled", "Disabled"]),
1270+
is_preview=True,
1271+
)
12641272
c.argument("http_proxy_config")
12651273
c.argument(
12661274
"bootstrap_artifact_source",
@@ -1776,11 +1784,6 @@ def load_arguments(self, _):
17761784
arg_type=get_enum_type(workload_runtimes),
17771785
default=CONST_WORKLOAD_RUNTIME_OCI_CONTAINER,
17781786
)
1779-
c.argument(
1780-
"enable_custom_ca_trust",
1781-
action="store_true",
1782-
validator=validate_enable_custom_ca_trust,
1783-
)
17841787
c.argument(
17851788
"disable_windows_outbound_nat",
17861789
action="store_true",
@@ -1895,16 +1898,6 @@ def load_arguments(self, _):
18951898
c.argument("mode", arg_type=get_enum_type(node_mode_types))
18961899
c.argument("scale_down_mode", arg_type=get_enum_type(scale_down_modes))
18971900
# extensions
1898-
c.argument(
1899-
"enable_custom_ca_trust",
1900-
action="store_true",
1901-
validator=validate_enable_custom_ca_trust,
1902-
)
1903-
c.argument(
1904-
"disable_custom_ca_trust",
1905-
options_list=["--disable-custom-ca-trust", "--dcat"],
1906-
action="store_true",
1907-
)
19081901
c.argument(
19091902
"allowed_host_ports", validator=validate_allowed_host_ports, is_preview=True
19101903
)

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

src/aks-preview/azext_aks_preview/_validators.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -731,14 +731,6 @@ def validate_bootstrap_container_registry_resource_id(namespace):
731731
raise InvalidArgumentValueError("--bootstrap-container-registry-resource-id is not a valid Azure resource ID.")
732732

733733

734-
def validate_enable_custom_ca_trust(namespace):
735-
"""Validates Custom CA Trust can only be used on Linux."""
736-
if namespace.enable_custom_ca_trust:
737-
if hasattr(namespace, 'os_type') and namespace.os_type != "Linux":
738-
raise ArgumentUsageError(
739-
'--enable_custom_ca_trust can only be set for Linux nodepools')
740-
741-
742734
def validate_custom_ca_trust_certificates(namespace):
743735
"""Validates Custom CA Trust Certificates can only be used on Linux."""
744736
if namespace.custom_ca_trust_certificates is not None and namespace.custom_ca_trust_certificates != "":

0 commit comments

Comments
 (0)