Skip to content

Commit 5405123

Browse files
authored
Merge branch 'Azure:main' into main
2 parents a24d584 + ccd52a4 commit 5405123

160 files changed

Lines changed: 76403 additions & 16518 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.

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,5 @@
331331
/src/carbon/ @itiinani
332332

333333
/src/amlfs/ @Aman-Jain-14 @amajai @mawhite @brpanask @tibanyas
334+
335+
/src/storage-discovery/ @shanefujs @calvinhzy

src/aks-preview/HISTORY.rst

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

15+
18.0.0b24
16+
+++++++
17+
* Suppress the ssh access annoying message if the cluster sku name is automatic.
18+
19+
18.0.0b23
20+
+++++++
21+
* `az aks create`: Add new parameter `--disable-run-command` to disable run command feature for the cluster
22+
* `az aks update`: Add new parameters `--disable-run-command` and `--enable-run-command` to toggle the run command feature on or off
23+
1524
18.0.0b22
1625
+++++++
1726
* Vendor new SDK and bump API version to 2025-06-02-preview.

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,9 @@
520520
- name: --enable-keda
521521
type: bool
522522
short-summary: Enable KEDA workload auto-scaler.
523+
- name: --disable-run-command
524+
type: bool
525+
short-summary: Disable Run command feature for the cluster.
523526
- name: --enable-defender
524527
type: bool
525528
short-summary: Enable Microsoft Defender security profile.
@@ -1124,6 +1127,12 @@
11241127
- name: --disable-keda
11251128
type: bool
11261129
short-summary: Disable KEDA workload auto-scaler.
1130+
- name: --enable-run-command
1131+
type: bool
1132+
short-summary: Enable Run command feature for the cluster.
1133+
- name: --disable-run-command
1134+
type: bool
1135+
short-summary: Disable Run command feature for the cluster.
11271136
- name: --enable-defender
11281137
type: bool
11291138
short-summary: Enable Microsoft Defender security profile.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,7 @@ def load_arguments(self, _):
862862
),
863863
)
864864
c.argument("dns_zone_resource_ids", is_preview=True)
865+
c.argument('disable_run_command', action='store_true')
865866
c.argument("enable_keda", action="store_true", is_preview=True)
866867
c.argument(
867868
"enable_vpa",
@@ -1302,6 +1303,8 @@ def load_arguments(self, _):
13021303
validator=validate_apiserver_subnet_id,
13031304
is_preview=True,
13041305
)
1306+
c.argument('enable_run_command', action='store_true')
1307+
c.argument('disable_run_command', action='store_true')
13051308
c.argument("enable_keda", action="store_true", is_preview=True)
13061309
c.argument("disable_keda", action="store_true", is_preview=True)
13071310
c.argument(

src/aks-preview/azext_aks_preview/agentpool_decorator.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
CONST_DEFAULT_WINDOWS_NODE_VM_SIZE,
4242
CONST_DEFAULT_VMS_VM_SIZE,
4343
CONST_DEFAULT_WINDOWS_VMS_VM_SIZE,
44+
CONST_MANAGED_CLUSTER_SKU_NAME_AUTOMATIC,
4445
CONST_SSH_ACCESS_LOCALUSER,
4546
CONST_GPU_DRIVER_NONE,
4647
CONST_NODEPOOL_MODE_MANAGEDSYSTEM,
@@ -567,6 +568,9 @@ def get_ssh_access(self) -> Union[str, None]:
567568
"""
568569
return self.raw_param.get("ssh_access")
569570

571+
def get_sku_name(self) -> str:
572+
return self.raw_param.get("sku")
573+
570574
def get_yes(self) -> bool:
571575
"""Obtain the value of yes.
572576
@@ -982,13 +986,19 @@ def set_up_ssh_access(self, agentpool: AgentPool) -> AgentPool:
982986
self._ensure_agentpool(agentpool)
983987

984988
ssh_access = self.context.get_ssh_access()
989+
sku_name = self.context.get_sku_name()
985990
if ssh_access is not None:
986991
if agentpool.security_profile is None:
987992
agentpool.security_profile = self.models.AgentPoolSecurityProfile() # pylint: disable=no-member
988993
agentpool.security_profile.ssh_access = ssh_access
989994
if ssh_access == CONST_SSH_ACCESS_LOCALUSER:
990-
logger.warning("The new node pool will enable SSH access, recommended to use '--ssh-access disabled' "
991-
"option to disable SSH access for the node pool to make it more secure.")
995+
if sku_name == CONST_MANAGED_CLUSTER_SKU_NAME_AUTOMATIC:
996+
logger.warning("SSH access is in preview")
997+
else:
998+
logger.warning(
999+
"The new node pool will enable SSH access, recommended to use "
1000+
"'--ssh-access disabled' option to disable SSH access for the node pool to make it more secure."
1001+
)
9921002
return agentpool
9931003

9941004
def set_up_skip_gpu_driver_install(self, agentpool: AgentPool) -> AgentPool:

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ def aks_create(
681681
enable_optimized_addon_scaling=False,
682682
enable_cilium_dataplane=False,
683683
custom_ca_trust_certificates=None,
684+
disable_run_command=False,
684685
# advanced networking
685686
enable_acns=None,
686687
disable_acns_observability=None,
@@ -914,6 +915,8 @@ def aks_update(
914915
disable_optimized_addon_scaling=False,
915916
cluster_snapshot_id=None,
916917
custom_ca_trust_certificates=None,
918+
enable_run_command=False,
919+
disable_run_command=False,
917920
# safeguards parameters
918921
safeguards_level=None,
919922
safeguards_version=None,

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,6 +1985,71 @@ def get_custom_ca_trust_certificates(self) -> Union[List[bytes], None]:
19851985
)
19861986
return certs
19871987

1988+
def _get_enable_run_command(self, enable_validation: bool = False) -> bool:
1989+
"""Internal function to obtain the value of enable_run_command.
1990+
:return: bool
1991+
"""
1992+
enable_run_command = self.raw_param.get("enable_run_command")
1993+
1994+
# In create mode, try to read the property value corresponding to the parameter from the `mc` object.
1995+
if self.decorator_mode == DecoratorMode.CREATE:
1996+
if (
1997+
self.mc and
1998+
hasattr(self.mc, "api_server_access_profile") and # backward compatibility
1999+
self.mc.api_server_access_profile and
2000+
self.mc.api_server_access_profile.disable_run_command is not None
2001+
):
2002+
enable_run_command = not self.mc.api_server_access_profile.disable_run_command
2003+
2004+
# validation
2005+
if enable_validation:
2006+
if enable_run_command and self._get_disable_run_command(enable_validation=False):
2007+
raise MutuallyExclusiveArgumentError(
2008+
"Cannot specify --enable-run-command and --disable-run-command at the same time."
2009+
)
2010+
2011+
return enable_run_command
2012+
2013+
def get_enable_run_command(self) -> bool:
2014+
"""Obtain the value of enable_run_command.
2015+
This function will verify the parameter by default. If both enable_run_command and disable_run_command are
2016+
specified, raise a MutuallyExclusiveArgumentError.
2017+
:return: bool
2018+
"""
2019+
return self._get_enable_run_command(enable_validation=True)
2020+
2021+
def _get_disable_run_command(self, enable_validation: bool = False) -> bool:
2022+
"""Internal function to obtain the value of disable_run_command.
2023+
:return: bool
2024+
"""
2025+
disable_run_command = self.raw_param.get("disable_run_command")
2026+
2027+
# In create mode, try to read the property value corresponding to the parameter from the `mc` object.
2028+
if self.decorator_mode == DecoratorMode.CREATE:
2029+
if (
2030+
self.mc and
2031+
hasattr(self.mc, "api_server_access_profile") and # backward compatibility
2032+
self.mc.api_server_access_profile and
2033+
self.mc.api_server_access_profile.disable_run_command is not None
2034+
):
2035+
disable_run_command = self.mc.api_server_access_profile.disable_run_command
2036+
2037+
# validation
2038+
if enable_validation:
2039+
if disable_run_command and self._get_enable_run_command(enable_validation=False):
2040+
raise MutuallyExclusiveArgumentError(
2041+
"Cannot specify --enable-run-command and --disable-run-command at the same time."
2042+
)
2043+
return disable_run_command
2044+
2045+
def get_disable_run_command(self) -> bool:
2046+
"""Obtain the value of disable_run_command.
2047+
This function will verify the parameter by default. If both enable_run_command and disable_run_command
2048+
are specified, raise a MutuallyExclusiveArgumentError.
2049+
:return: bool
2050+
"""
2051+
return self._get_disable_run_command(enable_validation=True)
2052+
19882053
def _get_enable_azure_monitor_metrics(self, enable_validation: bool = False) -> bool:
19892054
"""Internal function to obtain the value of enable_azure_monitor_metrics.
19902055
This function supports the option of enable_validation. When enabled, if both enable_azure_monitor_metrics and
@@ -3035,6 +3100,26 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
30353100
network_profile.advanced_networking = acns
30363101
return mc
30373102

3103+
def set_up_run_command(self, mc: ManagedCluster) -> ManagedCluster:
3104+
"""Set up run command for the ManagedCluster object.
3105+
:return: the ManagedCluster object
3106+
"""
3107+
if hasattr(super(), 'set_up_run_command'):
3108+
return super().set_up_run_command(mc)
3109+
3110+
self._ensure_mc(mc)
3111+
3112+
disable_run_command = self.context.get_disable_run_command()
3113+
if disable_run_command:
3114+
if mc.api_server_access_profile is None:
3115+
mc.api_server_access_profile = self.models.ManagedClusterAPIServerAccessProfile(
3116+
disable_run_command=True
3117+
)
3118+
else:
3119+
mc.api_server_access_profile.disable_run_command = True
3120+
3121+
return mc
3122+
30383123
def set_up_api_server_access_profile(self, mc: ManagedCluster) -> ManagedCluster:
30393124
"""Set up apiserverAccessProfile enableVnetIntegration and subnetId for the ManagedCluster object.
30403125
@@ -3670,6 +3755,8 @@ def construct_mc_profile_preview(self, bypass_restore_defaults: bool = False) ->
36703755
mc = self.set_up_kube_proxy_config(mc)
36713756
# set up custom ca trust certificates
36723757
mc = self.set_up_custom_ca_trust_certificates(mc)
3758+
# set up run command
3759+
mc = self.set_up_run_command(mc)
36733760
# set up node resource group profile
36743761
mc = self.set_up_node_resource_group_profile(mc)
36753762
# set up auto upgrade profile
@@ -4732,6 +4819,35 @@ def update_custom_ca_trust_certificates(self, mc: ManagedCluster) -> ManagedClus
47324819

47334820
return mc
47344821

4822+
def update_run_command(self, mc: ManagedCluster) -> ManagedCluster:
4823+
"""Update run command for the ManagedCluster object.
4824+
:return: the ManagedCluster object
4825+
"""
4826+
if hasattr(super(), 'update_run_command'):
4827+
return super().update_run_command(mc)
4828+
4829+
self._ensure_mc(mc)
4830+
4831+
enable_run_command = self.context.get_enable_run_command()
4832+
disable_run_command = self.context.get_disable_run_command()
4833+
if enable_run_command or disable_run_command:
4834+
if mc.api_server_access_profile is None:
4835+
mc.api_server_access_profile = self.models.ManagedClusterAPIServerAccessProfile(
4836+
disable_run_command=(
4837+
not enable_run_command
4838+
if enable_run_command or disable_run_command
4839+
else None
4840+
)
4841+
)
4842+
else:
4843+
mc.api_server_access_profile.disable_run_command = (
4844+
not enable_run_command
4845+
if enable_run_command or disable_run_command
4846+
else None
4847+
)
4848+
4849+
return mc
4850+
47354851
def update_azure_monitor_profile(self, mc: ManagedCluster) -> ManagedCluster:
47364852
"""Update azure monitor profile for the ManagedCluster object.
47374853
:return: the ManagedCluster object
@@ -5466,6 +5582,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
54665582
mc = self.update_kube_proxy_config(mc)
54675583
# update custom ca trust certificates
54685584
mc = self.update_custom_ca_trust_certificates(mc)
5585+
# update run command
5586+
mc = self.update_run_command(mc)
54695587
# update node resource group profile
54705588
mc = self.update_node_resource_group_profile(mc)
54715589
# update auto upgrade profile

0 commit comments

Comments
 (0)