Skip to content

Commit 837546f

Browse files
committed
Merge branch 'main' of https://github.com/erinborders/azure-cli-extensions into erinborders/machine-preview
2 parents 72f4df4 + 1fac1ba commit 837546f

51 files changed

Lines changed: 8218 additions & 7253 deletions

Some content is hidden

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

scripts/ci/credscan/CredScanSuppressions.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,35 @@
294294
"src\\storage-preview\\azext_storage_preview\\tests\\latest\\recordings\\test_storage_account_local_user.yaml"
295295
],
296296
"_justification": "Fake credentials for recordings reported by new version credential scanner."
297+
},
298+
{
299+
"file": [
300+
"src\\workloads\\azext_workloads\\tests\\latest\\recordings\\test_workloads_distributed_ha_avset_difftransrgShare.yaml",
301+
"src\\workloads\\azext_workloads\\tests\\latest\\recordings\\test_workloads_distributed_ha_avzone_cusrestrustedtransshare.yaml",
302+
"src\\workloads\\azext_workloads\\tests\\latest\\recordings\\test_workloads_distributed_trustedaccessnotransshare.yaml",
303+
"src\\workloads\\azext_workloads\\tests\\latest\\recordings\\test_workloads_singlesystem_cusrestrusted.yaml",
304+
"src\\workloads\\azext_workloads\\tests\\latest\\recordings\\test_workloads_singlesystem_notrusted.yaml"
305+
],
306+
"_justification": "[Workloads] False positive."
307+
},
308+
{
309+
"file": [
310+
"src\\oracle-database\\azext_oracle_database\\tests\\latest\\test_oracle_db_systems.py",
311+
"src\\oracle-database\\azext_oracle_database\\tests\\latest\\recordings\\test_create_db_system.yaml"
312+
],
313+
"_justification": "[Oracle Database] False positive."
314+
},
315+
{
316+
"file": [
317+
"src\\load\\azext_load\\tests\\latest\\recordings\\test_load_test_run_download_files.yaml"
318+
],
319+
"_justification": "[Load] False positive."
320+
},
321+
{
322+
"file": [
323+
"src\\databox\\testkey.pvk"
324+
],
325+
"_justification": "[Databox] False positive."
297326
}
298327
]
299328
}

src/aks-preview/HISTORY.rst

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

1212
Pending
1313
+++++++
14+
15+
19.0.0b27
16+
+++++++
17+
* `az aks nodepool add`: Fix `InvalidParameter` error when `mode` is `Machines`.
18+
19+
19.0.0b26
20+
+++++++
1421
* `az aks create/update`: Add `--enable-app-routing-istio` / `--disable-app-routing-istio` (short: `--enable-ari` / `--disable-ari`) flags to enable or disable Istio as a Gateway API implementation for App Routing.
1522
* `az aks approuting gateway istio enable/disable`: Add new subcommands to enable or disable the Istio Gateway API implementation for App Routing on an existing cluster.
1623
* `az aks machine add`: Add `--spot-max-price` flag support to set the max price (in US Dollars) you are willing to pay for spot instances on a machine.
1724
* `az aks machine add`: Add `--eviction-policy` flag support to set the eviction policy for a machine.
1825
* `az aks machine add`: Add `--enable-ultra-ssd` flag support to enable ultra ssd on a machine.
26+
* Add 'mTLS' as a transit encryption type option for `--acns-transit-encryption-type` in `az aks create/update`
1927

2028
19.0.0b25
2129
+++++++

src/aks-preview/azext_aks_preview/_consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
# ACNS transit encryption type
155155
CONST_TRANSIT_ENCRYPTION_TYPE_NONE = "None"
156156
CONST_TRANSIT_ENCRYPTION_TYPE_WIREGUARD = "WireGuard"
157+
CONST_TRANSIT_ENCRYPTION_TYPE_MTLS = "mTLS"
157158

158159
# ACNS performance acceleration mode
159160
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE = "None"

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
CONST_ADVANCED_NETWORKPOLICIES_L7,
159159
CONST_TRANSIT_ENCRYPTION_TYPE_NONE,
160160
CONST_TRANSIT_ENCRYPTION_TYPE_WIREGUARD,
161+
CONST_TRANSIT_ENCRYPTION_TYPE_MTLS,
161162
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH,
162163
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE,
163164
CONST_UPGRADE_STRATEGY_ROLLING,
@@ -360,6 +361,7 @@
360361
transit_encryption_types = [
361362
CONST_TRANSIT_ENCRYPTION_TYPE_NONE,
362363
CONST_TRANSIT_ENCRYPTION_TYPE_WIREGUARD,
364+
CONST_TRANSIT_ENCRYPTION_TYPE_MTLS,
363365
]
364366
acns_datapath_acceleration_modes = [
365367
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE,
@@ -970,7 +972,7 @@ def load_arguments(self, _):
970972
"acns_transit_encryption_type",
971973
is_preview=True,
972974
arg_type=get_enum_type(transit_encryption_types),
973-
help="Specify the transit encryption type for ACNS. Available values are 'None' and 'WireGuard'.",
975+
help="Specify the transit encryption type for ACNS. Available values are 'None', 'WireGuard', and 'mTLS'.",
974976
)
975977
c.argument(
976978
"enable_retina_flow_logs",
@@ -1648,7 +1650,7 @@ def load_arguments(self, _):
16481650
"acns_transit_encryption_type",
16491651
is_preview=True,
16501652
arg_type=get_enum_type(transit_encryption_types),
1651-
help="Specify the transit encryption type for ACNS. Available values are 'None' and 'WireGuard'.",
1653+
help="Specify the transit encryption type for ACNS. Available values are 'None', 'WireGuard', and 'mTLS'.",
16521654
)
16531655
c.argument(
16541656
"enable_retina_flow_logs",

src/aks-preview/azext_aks_preview/agentpool_decorator.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
CONST_SSH_ACCESS_LOCALUSER,
4747
CONST_GPU_DRIVER_NONE,
4848
CONST_NODEPOOL_MODE_MANAGEDSYSTEM,
49+
CONST_NODEPOOL_MODE_MACHINES,
4950
)
5051
from azext_aks_preview._helpers import (
5152
get_nodepool_snapshot_by_snapshot_id,
@@ -1452,6 +1453,25 @@ def set_up_managed_system_mode(self, agentpool: AgentPool) -> AgentPool:
14521453

14531454
return agentpool
14541455

1456+
def set_up_machines_mode(self, agentpool: AgentPool) -> AgentPool:
1457+
"""Handle the special Machines mode by resetting all properties except name and mode.
1458+
1459+
:param agentpool: the AgentPool object
1460+
:return: the AgentPool object
1461+
"""
1462+
self._ensure_agentpool(agentpool)
1463+
1464+
mode = self.context.get_mode()
1465+
if mode == CONST_NODEPOOL_MODE_MACHINES:
1466+
agentpool.mode = CONST_NODEPOOL_MODE_MACHINES
1467+
# Make sure all other attributes are None
1468+
for attr in vars(agentpool):
1469+
if attr != 'name' and attr != 'mode' and not attr.startswith('_'):
1470+
if hasattr(agentpool, attr):
1471+
setattr(agentpool, attr, None)
1472+
1473+
return agentpool
1474+
14551475
def set_up_localdns_profile(self, agentpool: AgentPool) -> AgentPool:
14561476
"""Set up local DNS profile for the AgentPool object if provided via --localdns-config."""
14571477
self._ensure_agentpool(agentpool)
@@ -1468,11 +1488,12 @@ def construct_agentpool_profile_preview(self) -> AgentPool:
14681488
# DO NOT MOVE: keep this on top, construct the default AgentPool profile
14691489
agentpool = self.construct_agentpool_profile_default(bypass_restore_defaults=True)
14701490

1471-
# Check if mode is ManagedSystem, if yes, reset all properties
1491+
# Check if mode is ManagedSystem or Machines, if yes, reset all other properties
14721492
agentpool = self.set_up_managed_system_mode(agentpool)
1493+
agentpool = self.set_up_machines_mode(agentpool)
14731494

1474-
# If mode is ManagedSystem, skip all other property setups
1475-
if agentpool.mode == CONST_NODEPOOL_MODE_MANAGEDSYSTEM:
1495+
# If mode is ManagedSystem or Machines, skip all other property setups
1496+
if agentpool.mode == CONST_NODEPOOL_MODE_MANAGEDSYSTEM or agentpool.mode == CONST_NODEPOOL_MODE_MACHINES:
14761497
return agentpool
14771498

14781499
# set up preview vm properties

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
CONST_APP_ROUTING_ISTIO_MODE_ENABLED,
5252
CONST_APP_ROUTING_ISTIO_MODE_DISABLED,
5353
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH,
54-
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE
54+
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE,
55+
CONST_TRANSIT_ENCRYPTION_TYPE_MTLS,
56+
CONST_ADVANCED_NETWORKPOLICIES_L7,
5557
)
5658
from azext_aks_preview.azurecontainerstorage._consts import (
5759
CONST_ACSTOR_EXT_INSTALLATION_NAME,
@@ -919,6 +921,49 @@ def get_acns_transit_encryption_type(self) -> Union[str, None]:
919921
raise MutuallyExclusiveArgumentError(
920922
"--disable-acns-security and --disable-acns cannot be used with --acns-transit-encryption-type."
921923
)
924+
if acns_transit_encryption_type == CONST_TRANSIT_ENCRYPTION_TYPE_MTLS:
925+
# Check CLI args for L7
926+
acns_advanced_networkpolicies = self.raw_param.get("acns_advanced_networkpolicies")
927+
if acns_advanced_networkpolicies == CONST_ADVANCED_NETWORKPOLICIES_L7:
928+
raise MutuallyExclusiveArgumentError(
929+
"'--acns-transit-encryption-type mTLS' cannot be used with "
930+
"'--acns-advanced-networkpolicies L7'. "
931+
"Please choose either '--acns-advanced-networkpolicies L7' or "
932+
"'--acns-transit-encryption-type mTLS', but not both."
933+
)
934+
# Check CLI args for Istio
935+
enable_asm = self.raw_param.get("enable_azure_service_mesh", False)
936+
if enable_asm:
937+
raise MutuallyExclusiveArgumentError(
938+
"'--acns-transit-encryption-type mTLS' cannot be used with "
939+
"'--enable-azure-service-mesh'. "
940+
"Please remove '--enable-azure-service-mesh' or choose a different "
941+
"transit encryption type."
942+
)
943+
# On update, check existing cluster state
944+
if self.decorator_mode == DecoratorMode.UPDATE and self.mc:
945+
# Check if existing cluster has L7 enabled and user is not changing it
946+
if (acns_advanced_networkpolicies is None and
947+
self.mc.network_profile and
948+
self.mc.network_profile.advanced_networking and
949+
self.mc.network_profile.advanced_networking.security and
950+
self.mc.network_profile.advanced_networking.security.advanced_network_policies ==
951+
CONST_ADVANCED_NETWORKPOLICIES_L7):
952+
raise MutuallyExclusiveArgumentError(
953+
"'--acns-transit-encryption-type mTLS' cannot be used with L7 advanced network policies. "
954+
"The existing cluster already has L7 enabled. Please disable L7 by passing "
955+
"'--acns-advanced-networkpolicies None' or choose a different transit encryption type."
956+
)
957+
# Check if existing cluster has Istio enabled and user is not disabling it
958+
disable_asm = self.raw_param.get("disable_azure_service_mesh", False)
959+
if (not disable_asm and
960+
self.mc.service_mesh_profile and
961+
self.mc.service_mesh_profile.mode == CONST_AZURE_SERVICE_MESH_MODE_ISTIO):
962+
raise MutuallyExclusiveArgumentError(
963+
"'--acns-transit-encryption-type mTLS' cannot be used with Istio service mesh. "
964+
"The existing cluster already has Istio enabled. Please disable Istio by passing "
965+
"'--disable-azure-service-mesh' or choose a different transit encryption type."
966+
)
922967
return self.raw_param.get("acns_transit_encryption_type")
923968

924969
# Container network logs is the new name for retina flow logs.

0 commit comments

Comments
 (0)