Skip to content

Commit 0e2767b

Browse files
committed
aks-preview: Support BYO VNet for --enable-hosted-system automatic clusters + --disable-hosted-system
Adds CLI surface for BYO VNet HOBO (hosted system pool) automatic clusters: * `--system-node-vnet-subnet-id` and `--node-vnet-subnet-id` on `az aks create` to bring your own VNet for the hosted system pool and user node pool. Must be used together with `--apiserver-subnet-id` and `--enable-hosted-system`. * `--disable-hosted-system` on `az aks create` to deterministically opt out of HOBO on automatic clusters (mutually exclusive with `--enable-hosted-system`, both gated to `--sku automatic`). Supported scenarios: 1. az aks create --sku automatic --enable-hosted-system 2. ... + --system-node-vnet-subnet-id --node-vnet-subnet-id --apiserver-subnet-id (NATGW) 3. ... + --outbound-type loadBalancer for BYO VNet with SLB outbound 4. az aks create --sku automatic --disable-hosted-system 5. az aks update --sku base to downgrade an automatic+HOBO cluster Validation (client-side, before PATCH): * --enable-hosted-system and --disable-hosted-system are mutually exclusive. * Both require --sku automatic. * If --enable-hosted-system is set with any of the 3 BYO subnet flags, all three must be provided; otherwise a clear error lists the missing ones. * BYO subnet flags cannot be used without --enable-hosted-system. Live-only E2E tests cover BYO+NATGW, BYO+SLB with downgrade to base SKU, and the disable opt-out path. Signed-off-by: wenhug <50309350+wenhug@users.noreply.github.com>
1 parent f5c2368 commit 0e2767b

7 files changed

Lines changed: 552 additions & 30 deletions

File tree

src/aks-preview/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ To release a new version, please select a new version number (usually plus 1 to
1212
Pending
1313
+++++++
1414
* `az aks nodepool update`: Support `--node-vm-size` to resize VM size of an existing VMSS-based agent pool (preview). Requires AFEC registration `Microsoft.ContainerService/AgentPoolVMSSResize`.
15+
* `az aks create`: Support BYO VNet for hosted-system automatic clusters via `--system-node-vnet-subnet-id` and `--node-vnet-subnet-id`; add `--disable-hosted-system` opt-out.
1516

1617
20.0.0b3
1718
++++++

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,28 @@
715715
- name: --enable-hosted-system
716716
type: bool
717717
short-summary: Create a cluster with fully hosted system components. This applies only when creating a new automatic cluster.
718+
long-summary: |
719+
Deterministically opts the cluster into HOBO (Hosted Overlay System Pool). AKS hosts and manages the system node pool.
720+
Can be combined with BYO VNet via `--system-node-vnet-subnet-id`, `--node-vnet-subnet-id`, and `--apiserver-subnet-id`
721+
(all three must be provided together and must belong to the same VNet). Cannot be used with `--disable-hosted-system`.
722+
- name: --disable-hosted-system
723+
type: bool
724+
short-summary: Opt the automatic cluster out of hosted system components.
725+
long-summary: |
726+
Deterministically creates an automatic cluster WITHOUT HOBO, even in regions where HOBO is the default.
727+
Only valid with `--sku automatic`. Mutually exclusive with `--enable-hosted-system`.
728+
- name: --system-node-vnet-subnet-id
729+
type: string
730+
short-summary: Resource ID of the subnet to be used by AKS-managed hosted system nodes (BYO VNet HOBO).
731+
long-summary: |
732+
Only valid with `--enable-hosted-system`. Must be provided together with `--node-vnet-subnet-id`
733+
and `--apiserver-subnet-id`, and all three subnets must belong to the same VNet.
734+
- name: --node-vnet-subnet-id
735+
type: string
736+
short-summary: Resource ID of the subnet joined by tenant worker nodes in BYO VNet HOBO clusters.
737+
long-summary: |
738+
Only valid with `--enable-hosted-system`. Must be provided together with `--system-node-vnet-subnet-id`
739+
and `--apiserver-subnet-id`, and all three subnets must belong to the same VNet.
718740
examples:
719741
- name: Create a Kubernetes cluster with an existing SSH public key.
720742
text: az aks create -g MyResourceGroup -n MyManagedCluster --ssh-key-value /path/to/publickey
@@ -808,6 +830,12 @@
808830
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-gateway-api
809831
- name: Create an automatic cluster with hosted system components enabled.
810832
text: az aks create -g MyResourceGroup -n MyManagedCluster --sku automatic --enable-hosted-system
833+
- name: Create a hosted-system automatic cluster in a BYO VNet (NAT gateway outbound, the default).
834+
text: az aks create -g MyResourceGroup -n MyManagedCluster --sku automatic --enable-hosted-system --system-node-vnet-subnet-id <systemNodeSubnetID> --node-vnet-subnet-id <nodeSubnetID> --apiserver-subnet-id <apiserverSubnetID>
835+
- name: Create a hosted-system automatic cluster in a BYO VNet with Load Balancer outbound.
836+
text: az aks create -g MyResourceGroup -n MyManagedCluster --sku automatic --enable-hosted-system --system-node-vnet-subnet-id <systemNodeSubnetID> --node-vnet-subnet-id <nodeSubnetID> --apiserver-subnet-id <apiserverSubnetID> --outbound-type loadBalancer
837+
- name: Create an automatic cluster and opt out of hosted system components.
838+
text: az aks create -g MyResourceGroup -n MyManagedCluster --sku automatic --disable-hosted-system
811839
812840
"""
813841

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@
237237
validate_utc_offset,
238238
validate_vm_set_type,
239239
validate_vnet_subnet_id,
240+
validate_system_node_vnet_subnet_id,
241+
validate_node_vnet_subnet_id,
240242
validate_force_upgrade_disable_and_enable_parameters,
241243
validate_azure_service_mesh_revision,
242244
validate_artifact_streaming,
@@ -1261,6 +1263,19 @@ def load_arguments(self, _):
12611263
help="Enable Gateway API based ingress on App Routing via Istio"
12621264
)
12631265
c.argument("enable_hosted_system", action="store_true", is_preview=True)
1266+
c.argument("disable_hosted_system", action="store_true", is_preview=True)
1267+
c.argument(
1268+
"system_node_vnet_subnet_id",
1269+
options_list=["--system-node-vnet-subnet-id"],
1270+
validator=validate_system_node_vnet_subnet_id,
1271+
is_preview=True,
1272+
)
1273+
c.argument(
1274+
"node_vnet_subnet_id",
1275+
options_list=["--node-vnet-subnet-id"],
1276+
validator=validate_node_vnet_subnet_id,
1277+
is_preview=True,
1278+
)
12641279
c.argument(
12651280
"enable_continuous_control_plane_and_addon_monitor",
12661281
action="store_true",

src/aks-preview/azext_aks_preview/_validators.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,14 @@ def validate_apiserver_subnet_id(namespace):
355355
_validate_subnet_id(namespace.apiserver_subnet_id, "--apiserver-subnet-id")
356356

357357

358+
def validate_system_node_vnet_subnet_id(namespace):
359+
_validate_subnet_id(namespace.system_node_vnet_subnet_id, "--system-node-vnet-subnet-id")
360+
361+
362+
def validate_node_vnet_subnet_id(namespace):
363+
_validate_subnet_id(namespace.node_vnet_subnet_id, "--node-vnet-subnet-id")
364+
365+
358366
def _validate_subnet_id(subnet_id, name):
359367
if subnet_id is None or subnet_id == '':
360368
return

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,9 @@ def aks_create(
11791179
# app routing istio
11801180
enable_app_routing_istio=False,
11811181
enable_hosted_system=False,
1182+
disable_hosted_system=False,
1183+
system_node_vnet_subnet_id=None,
1184+
node_vnet_subnet_id=None,
11821185
# health monitor
11831186
enable_continuous_control_plane_and_addon_monitor=False,
11841187
):

0 commit comments

Comments
 (0)