Skip to content

Commit 00dc1b6

Browse files
author
Saif Al-Din Ali
committed
2 parents f1897de + 3b50625 commit 00dc1b6

File tree

624 files changed

+50197
-20276
lines changed

Some content is hidden

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

624 files changed

+50197
-20276
lines changed

src/aks-preview/HISTORY.rst

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

1212
Pending
1313
+++++++
14+
15+
19.0.0b24
16+
+++++++
17+
* Vendor new SDK and bump API version to 2026-01-02-preview.
18+
19+
19.0.0b23
20+
+++++++
1421
* `az aks update`: Fix `--enable-secret-rotation`, `--disable-secret-rotation`, and `--rotation-poll-interval` flags being silently ignored when updating Azure Key Vault Secrets Provider addon configuration.
1522
* `az aks create/update`: Add `--enable-azure-monitor-logs` support to container network logs validation.
1623
* `az aks create/update`: Add `--enable-default-domain` and `--disable-default-domain` parameters to manage the default domain feature for web app routing.
24+
* `az aks create`: Add ephemeralDisk and elasticSan storage options to `--enable-azure-container-storage` for the latest version of Azure Container Storage.
25+
* `az aks update`: Add ephemeralDisk and elasticSan storage options to `--enable-azure-container-storage` and `--disable-azure-container-storage` for the latest version of Azure Container Storage.
1726

1827
19.0.0b22
1928
+++++++

src/aks-preview/README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ Released version and adopted API version
220220
* - 19.0.0b10 ~ 19.0.0b17
221221
- 2025-09-02-preview
222222
-
223-
* - 19.0.0b18 ~ latest
223+
* - 19.0.0b18 ~ 19.0.0b23
224224
- 2025-10-02-preview
225+
-
226+
* - 19.0.0b24 ~ latest
227+
- 2026-01-02-preview
225228
-

src/aks-preview/azext_aks_preview/_loadbalancer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def configure_load_balancer_profile(
175175
if managed_outbound_ip_count is not None:
176176
profile.managed_outbound_i_ps.count = managed_outbound_ip_count
177177
if managed_outbound_ipv6_count is not None:
178-
profile.managed_outbound_i_ps.count_ipv6 = managed_outbound_ipv6_count
178+
profile.managed_outbound_i_ps.count_i_pv6 = managed_outbound_ipv6_count
179179
else:
180180
profile.managed_outbound_i_ps = None
181181

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 14 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ def load_arguments(self, _):
11001100
# azure container storage
11011101
c.argument(
11021102
"enable_azure_container_storage",
1103-
arg_type=_get_enable_azure_container_storage_type(),
1103+
arg_type=_get_container_storage_enum_type(storage_pool_types),
11041104
help="enable azure container storage. Can be used as a flag (defaults to True) or with a"
11051105
" storage pool type value: (azureDisk, ephemeralDisk, elasticSan)",
11061106
)
@@ -1670,13 +1670,13 @@ def load_arguments(self, _):
16701670
# azure container storage
16711671
c.argument(
16721672
"enable_azure_container_storage",
1673-
arg_type=_get_enable_azure_container_storage_type(),
1673+
arg_type=_get_container_storage_enum_type(storage_pool_types),
16741674
help="enable azure container storage. Can be used as a flag (defaults to True) or with a"
16751675
" storage pool type value: (azureDisk, ephemeralDisk, elasticSan)",
16761676
)
16771677
c.argument(
16781678
"disable_azure_container_storage",
1679-
arg_type=_get_disable_azure_container_storage_type(),
1679+
arg_type=_get_container_storage_enum_type(disable_storage_pool_types),
16801680
help="disable azure container storage or any one of the storage pool types."
16811681
" Can be used as a flag (defaults to True) or with a storagepool type value:"
16821682
" azureDisk, ephemeralDisk, elasticSan, all (to disable all storage pools).",
@@ -3166,63 +3166,33 @@ def _get_default_install_location(exe_name):
31663166
return install_location
31673167

31683168

3169-
def _get_enable_azure_container_storage_type():
3169+
def _get_container_storage_enum_type(choices):
31703170
"""Custom argument type that accepts both None and enum values"""
31713171
import argparse
31723172
from azure.cli.core.azclierror import InvalidArgumentValueError
31733173

31743174
class AzureContainerStorageAction(argparse.Action):
31753175
def __call__(self, parser, namespace, values, option_string=None):
3176-
if values is None:
3176+
if values in [[], None]:
31773177
# When used as a flag without value, set as True
31783178
setattr(namespace, self.dest, True)
31793179
return
31803180

3181-
if isinstance(values, str):
3182-
# Handle enum values (case insensitive)
3183-
for storage_type in storage_pool_types:
3184-
if values.lower() == storage_type.lower():
3185-
setattr(namespace, self.dest, storage_type)
3186-
return
3187-
3188-
# Invalid value
3189-
valid_values = storage_pool_types
3190-
raise InvalidArgumentValueError(
3191-
f"Invalid value '{values}'. Valid values are: {', '.join(valid_values)}"
3192-
)
3193-
3194-
return CLIArgumentType(
3195-
nargs='?', # Optional argument
3196-
action=AzureContainerStorageAction,
3197-
)
3198-
3199-
3200-
def _get_disable_azure_container_storage_type():
3201-
"""Custom argument type that accepts both None and enum values"""
3202-
import argparse
3203-
from azure.cli.core.azclierror import InvalidArgumentValueError
3204-
3205-
class AzureContainerStorageAction(argparse.Action):
3206-
def __call__(self, parser, namespace, values, option_string=None):
3207-
if values is None:
3208-
# When used as a flag without value, set as True
3209-
setattr(namespace, self.dest, True)
3181+
# Allow multiple enum values in a case insensitive manner
3182+
normalized_value_arr = values if isinstance(values, list) else str(values).split(',')
3183+
normalized_value_arr = [str(v).lower().strip() for v in normalized_value_arr]
3184+
valid_value_arr = [v for v in choices if v.lower() in normalized_value_arr]
3185+
if len(valid_value_arr) == len(normalized_value_arr):
3186+
normalized_values = valid_value_arr[0] if len(valid_value_arr) == 1 else valid_value_arr
3187+
setattr(namespace, self.dest, normalized_values)
32103188
return
32113189

3212-
if isinstance(values, str):
3213-
# Handle enum values (case insensitive)
3214-
for storage_type in disable_storage_pool_types:
3215-
if values.lower() == storage_type.lower():
3216-
setattr(namespace, self.dest, storage_type)
3217-
return
3218-
32193190
# Invalid value
3220-
valid_values = disable_storage_pool_types
32213191
raise InvalidArgumentValueError(
3222-
f"Invalid value '{values}'. Valid values are: {', '.join(valid_values)}"
3192+
f"Invalid value '{values}'. Valid values are: {', '.join(choices)}"
32233193
)
32243194

32253195
return CLIArgumentType(
3226-
nargs='?', # Optional argument
3196+
nargs='*', # Allow multiple values
32273197
action=AzureContainerStorageAction,
32283198
)

src/aks-preview/azext_aks_preview/azurecontainerstorage/_helpers.py

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
from azext_aks_preview.azurecontainerstorage._consts import (
99
CONST_ACSTOR_ALL,
10+
CONST_ACSTOR_EXT_INSTALLATION_NAME,
1011
CONST_ACSTOR_IO_ENGINE_LABEL_KEY,
12+
CONST_ACSTOR_K8S_EXTENSION_NAME,
1113
CONST_DISK_TYPE_EPHEMERAL_VOLUME_ONLY,
1214
CONST_DISK_TYPE_PV_WITH_ANNOTATION,
1315
CONST_EPHEMERAL_NVME_PERF_TIER_BASIC,
@@ -140,13 +142,13 @@ def check_if_extension_is_installed(cmd, resource_group, cluster_name) -> bool:
140142
extension_type = extension.extension_type.lower()
141143
if extension_type != CONST_ACSTOR_V1_K8S_EXTENSION_NAME:
142144
return_val = False
143-
except: # pylint: disable=bare-except
145+
except Exception: # pylint: disable=broad-except
144146
return_val = False
145147

146148
return return_val
147149

148150

149-
def get_extension_installed_and_cluster_configs(
151+
def get_extension_installed_and_cluster_configs_v1(
150152
cmd,
151153
resource_group,
152154
cluster_name,
@@ -237,7 +239,7 @@ def get_extension_installed_and_cluster_configs(
237239
is_ephemeralDisk_nvme_enabled = True
238240
break
239241

240-
except: # pylint: disable=bare-except
242+
except Exception: # pylint: disable=broad-except
241243
is_extension_installed = False
242244

243245
return (
@@ -252,6 +254,56 @@ def get_extension_installed_and_cluster_configs(
252254
)
253255

254256

257+
def get_extension_installed_and_cluster_configs(
258+
cmd,
259+
resource_group,
260+
cluster_name
261+
) -> Tuple[bool, bool, bool]:
262+
client_factory = get_k8s_extension_module(CONST_K8S_EXTENSION_CLIENT_FACTORY_MOD_NAME)
263+
client = client_factory.cf_k8s_extension_operation(cmd.cli_ctx)
264+
k8s_extension_custom_mod = get_k8s_extension_module(CONST_K8S_EXTENSION_CUSTOM_MOD_NAME)
265+
is_extension_installed = False
266+
is_ephemeral_disk_enabled = False
267+
is_elastic_san_enabled = False
268+
269+
try:
270+
extension = k8s_extension_custom_mod.show_k8s_extension(
271+
client,
272+
resource_group,
273+
cluster_name,
274+
CONST_ACSTOR_EXT_INSTALLATION_NAME,
275+
"managedClusters",
276+
)
277+
278+
extension_type = extension.extension_type.lower()
279+
is_extension_installed = extension_type == CONST_ACSTOR_K8S_EXTENSION_NAME
280+
config_settings = extension.configuration_settings
281+
282+
if is_extension_installed and config_settings is not None:
283+
is_ephemeral_disk_enabled = (
284+
config_settings.get("csiDriverConfigs.local-csi-driver.enabled", "False") == "True"
285+
)
286+
is_elastic_san_enabled = (
287+
config_settings.get("csiDriverConfigs.azuresan-csi-driver.enabled", "False") == "True"
288+
)
289+
290+
except Exception: # pylint: disable=broad-except
291+
is_extension_installed = False
292+
293+
return (
294+
is_extension_installed,
295+
is_ephemeral_disk_enabled,
296+
is_elastic_san_enabled,
297+
)
298+
299+
300+
def should_delete_extension(storage_options_to_remove) -> bool:
301+
return (
302+
storage_options_to_remove in [True, CONST_ACSTOR_ALL] or
303+
(isinstance(storage_options_to_remove, list) and CONST_ACSTOR_ALL in storage_options_to_remove)
304+
)
305+
306+
255307
def get_container_storage_extension_installed(
256308
cmd,
257309
resource_group,

src/aks-preview/azext_aks_preview/azurecontainerstorage/_validators.py

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,12 @@ def validate_enable_azure_container_storage_v1_params( # pylint: disable=too-ma
432432

433433

434434
def validate_enable_azure_container_storage_params(
435+
enablement_option,
435436
is_extension_installed,
437+
is_ephemeral_disk_enabled,
438+
is_elastic_san_enabled,
436439
is_v1_extension_installed,
437440
v1_extension_version,
438-
storage_pool_type,
439441
storage_pool_name,
440442
storage_pool_sku,
441443
storage_pool_option,
@@ -450,18 +452,28 @@ def validate_enable_azure_container_storage_params(
450452
'that depend on Azure Container Storage.'
451453
)
452454

453-
if is_extension_installed:
454-
raise InvalidArgumentValueError(
455-
'Cannot enable Azure Container Storage as it is already enabled on the cluster.'
456-
)
457-
458-
# Todo: Remove this for the 2.1.0 release
459-
if storage_pool_type is not None and not isinstance(storage_pool_type, bool):
460-
raise InvalidArgumentValueError(
461-
'The latest version of Azure Container Storage only supports ephemeral nvme storage and does not '
462-
'require or support a storage-pool-type value for --enable-azure-container-storage parameter. '
463-
f'Please remove {storage_pool_type} from the command and try again.'
464-
)
455+
if not enablement_option or enablement_option is True:
456+
if is_extension_installed:
457+
raise InvalidArgumentValueError(
458+
'Cannot enable Azure Container Storage as it is already enabled on the cluster.'
459+
)
460+
else:
461+
enablement_option_arr = enablement_option if isinstance(enablement_option, list) else [enablement_option]
462+
enable_ephemeral_disk = CONST_STORAGE_POOL_TYPE_EPHEMERAL_DISK in enablement_option
463+
enable_elastic_san = CONST_STORAGE_POOL_TYPE_ELASTIC_SAN in enablement_option
464+
for option in enablement_option_arr:
465+
if option not in [CONST_STORAGE_POOL_TYPE_EPHEMERAL_DISK, CONST_STORAGE_POOL_TYPE_ELASTIC_SAN]:
466+
raise InvalidArgumentValueError(
467+
f"Unsupported storage option '{option}'. "
468+
f"Supported values are '{CONST_STORAGE_POOL_TYPE_EPHEMERAL_DISK}' "
469+
f"and '{CONST_STORAGE_POOL_TYPE_ELASTIC_SAN}'."
470+
)
471+
if is_ephemeral_disk_enabled == enable_ephemeral_disk and is_elastic_san_enabled == enable_elastic_san:
472+
options_display = "', '".join(enablement_option_arr)
473+
raise InvalidArgumentValueError(
474+
f"Cannot enable the requested storage options ('{options_display}') "
475+
"as they are already enabled on the cluster."
476+
)
465477

466478
if storage_pool_name is not None:
467479
raise InvalidArgumentValueError(
@@ -493,25 +505,42 @@ def validate_enable_azure_container_storage_params(
493505

494506

495507
def validate_disable_azure_container_storage_params(
508+
disablement_option,
496509
is_extension_installed,
497-
storage_pool_type,
510+
is_ephemeral_disk_enabled,
511+
is_elastic_san_enabled,
498512
storage_pool_name,
499513
storage_pool_sku,
500514
storage_pool_option,
501515
storage_pool_size
502516
):
503517
if not is_extension_installed:
504518
raise InvalidArgumentValueError(
505-
'Cannot disable Azure Container Storage as it is not enabled on the cluster.'
519+
'Cannot disable Azure Container Storage as it could not be found on the cluster.'
506520
)
507521

508-
# Todo: Remove this for the 2.1.0 release
509-
if storage_pool_type is not None and not isinstance(storage_pool_type, bool):
510-
raise InvalidArgumentValueError(
511-
'The latest version of Azure Container Storage only supports ephemeral nvme storage and does not '
512-
'require or support a storage-pool-type value for --disable-azure-container-storage parameter. '
513-
f'Please remove {storage_pool_type} from the command and try again.'
514-
)
522+
if disablement_option and disablement_option not in [True, CONST_ACSTOR_ALL]:
523+
actionable = False
524+
disablement_option_arr = disablement_option if isinstance(disablement_option, list) else [disablement_option]
525+
for disable_option in disablement_option_arr:
526+
if disable_option == CONST_ACSTOR_ALL:
527+
actionable = True
528+
elif disable_option == CONST_STORAGE_POOL_TYPE_EPHEMERAL_DISK:
529+
actionable = actionable or is_ephemeral_disk_enabled
530+
elif disable_option == CONST_STORAGE_POOL_TYPE_ELASTIC_SAN:
531+
actionable = actionable or is_elastic_san_enabled
532+
else:
533+
raise InvalidArgumentValueError(
534+
f"Cannot disable unsupported storage option '{disable_option}'. "
535+
f"Supported values are '{CONST_STORAGE_POOL_TYPE_EPHEMERAL_DISK}', "
536+
f"'{CONST_STORAGE_POOL_TYPE_ELASTIC_SAN}' and '{CONST_ACSTOR_ALL}'."
537+
)
538+
if not actionable:
539+
options_display = "', '".join(disablement_option_arr)
540+
raise InvalidArgumentValueError(
541+
f"Cannot disable the requested storage options ('{options_display}') "
542+
"as they could not be found on the cluster."
543+
)
515544

516545
if storage_pool_name is not None:
517546
raise InvalidArgumentValueError(

0 commit comments

Comments
 (0)