Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ To release a new version, please select a new version number (usually plus 1 to

Pending
+++++++
* `az aks create`: Add parameters `--system-node-subnet-id`, `--node-subnet-id` and `--enable-hosted-system` to support BYO VNet for Automatic Managed System Pool clusters.

21.0.0b9
++++++++
Expand Down
27 changes: 26 additions & 1 deletion src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,28 @@
Cannot be used simultaneously with the Istio service mesh add-on (--enable-azure-service-mesh).
- name: --enable-hosted-system
type: bool
short-summary: Create a cluster with fully hosted system components. This applies only when creating a new automatic cluster.
short-summary: (Automatic SKU) Explicitly opt in to a Managed System Pool for the Automatic cluster.
long-summary: |
Only valid with `--sku automatic`. Use this flag when you want to deterministically
request a Managed System Pool regardless of region defaults. It is also implied when
you supply the bring-your-own VNet subnet trio (`--system-node-subnet-id`,
`--node-subnet-id`, `--apiserver-subnet-id`).
- name: --system-node-subnet-id
type: string
short-summary: (Automatic SKU) The ID of a subnet in an existing VNet to be used by the Managed System Pool in an Automatic cluster.
long-summary: |
Bring-your-own VNet for an Automatic cluster requires three subnets supplied together:
`--system-node-subnet-id` (this flag, for the Managed System Pool), `--node-subnet-id`
(for user node pools), and `--apiserver-subnet-id` (for the control plane API server).
All three subnets must belong to the same VNet and can only be used with `--sku automatic`.
- name: --node-subnet-id
type: string
short-summary: (Automatic SKU) The ID of a subnet in an existing VNet to be used by user node pools in an Automatic cluster.
long-summary: |
Bring-your-own VNet for an Automatic cluster requires three subnets supplied together:
`--system-node-subnet-id` (for the Managed System Pool), `--node-subnet-id` (this flag,
for user node pools), and `--apiserver-subnet-id` (for the control plane API server).
All three subnets must belong to the same VNet and can only be used with `--sku automatic`.
- name: --control-plane-scaling-size --cp-scaling-size
type: string
short-summary: (PREVIEW) The control plane scaling size for the cluster.
Expand Down Expand Up @@ -843,6 +864,10 @@
text: az aks create -g MyResourceGroup -n MyManagedCluster --control-plane-scaling-size H4
- name: Create an automatic cluster with hosted system components enabled.
text: az aks create -g MyResourceGroup -n MyManagedCluster --sku automatic --enable-hosted-system
- name: Create a hosted-system automatic cluster in a BYO VNet.
text: az aks create -g MyResourceGroup -n MyManagedCluster --sku automatic --system-node-subnet-id <systemNodeSubnetID> --node-subnet-id <nodeSubnetID> --apiserver-subnet-id <apiserverSubnetID>
- name: Create a hosted-system automatic cluster in a BYO VNet with Load Balancer outbound.
text: az aks create -g MyResourceGroup -n MyManagedCluster --sku automatic --enable-hosted-system --system-node-subnet-id <systemNodeSubnetID> --node-subnet-id <nodeSubnetID> --apiserver-subnet-id <apiserverSubnetID> --outbound-type loadBalancer
- name: Create a kubernetes cluster with Azure Backup enabled (default Week strategy). Requires the 'dataprotection' extension. Implicitly waits for cluster creation.
text: az aks create -g MyResourceGroup -n MyManagedCluster --generate-ssh-keys --enable-backup --yes

Expand Down
13 changes: 13 additions & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@
validate_duration_hours,
validate_vm_set_type,
validate_vnet_subnet_id,
validate_system_node_subnet_id,
validate_node_subnet_id,
validate_force_upgrade_disable_and_enable_parameters,
validate_azure_service_mesh_revision,
validate_artifact_streaming,
Expand Down Expand Up @@ -1308,6 +1310,17 @@ def load_arguments(self, _):
help="Enable Gateway API based ingress on App Routing via Istio"
)
c.argument("enable_hosted_system", action="store_true", is_preview=True)
c.argument(
"system_node_subnet_id",
validator=validate_system_node_subnet_id,
is_preview=True,
)
c.argument(
"node_subnet_id",
options_list=["--node-subnet-id"],
validator=validate_node_subnet_id,
is_preview=True,
)
c.argument(
"control_plane_scaling_size",
options_list=["--control-plane-scaling-size", "--cp-scaling-size"],
Expand Down
8 changes: 8 additions & 0 deletions src/aks-preview/azext_aks_preview/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ def validate_apiserver_subnet_id(namespace):
_validate_subnet_id(namespace.apiserver_subnet_id, "--apiserver-subnet-id")


def validate_system_node_subnet_id(namespace):
_validate_subnet_id(namespace.system_node_subnet_id, "--system-node-subnet-id")


def validate_node_subnet_id(namespace):
_validate_subnet_id(namespace.node_subnet_id, "--node-subnet-id")


def _validate_subnet_id(subnet_id, name):
if subnet_id is None or subnet_id == '':
return
Expand Down
15 changes: 12 additions & 3 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,8 @@ def aks_create(
# app routing istio
enable_app_routing_istio=False,
enable_hosted_system=False,
system_node_subnet_id=None,
node_subnet_id=None,
control_plane_scaling_size=None,
# health monitor
enable_continuous_control_plane_and_addon_monitor=False,
Expand Down Expand Up @@ -1919,14 +1921,21 @@ def aks_scale(cmd, # pylint: disable=unused-argument
instance = client.get(resource_group_name, name)
_fill_defaults_for_pod_identity_profile(instance.pod_identity_profile)

if len(instance.agent_pool_profiles) > 1 and nodepool_name == "":
agent_pool_profiles = instance.agent_pool_profiles or []
if not agent_pool_profiles:
raise CLIError(
"The cluster has no scalable node pools (this may be a Managed System Pool for "
"an Automatic cluster). Use az aks nodepool add/scale against a user node pool instead."
)

if len(agent_pool_profiles) > 1 and nodepool_name == "":
raise CLIError(
"There are more than one node pool in the cluster. "
"Please specify nodepool name or use az aks nodepool command to scale node pool"
)

for agent_profile in (instance.agent_pool_profiles or []):
if agent_profile.name == nodepool_name or (nodepool_name == "" and instance.agent_pool_profiles and len(instance.agent_pool_profiles) == 1):
for agent_profile in agent_pool_profiles:
if agent_profile.name == nodepool_name or (nodepool_name == "" and len(agent_pool_profiles) == 1):
if agent_profile.enable_auto_scaling:
raise CLIError(
"Cannot scale cluster autoscaler enabled node pool.")
Expand Down
Loading
Loading