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
15 changes: 15 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@
- name: --windows-admin-password
type: string
short-summary: Password to create on Windows node VMs.
- name: --enable-ahub
type: bool
short-summary: Enable Azure Hybrid User Benefits (AHUB) for Windows VMs.
- name: --enable-aad
type: bool
short-summary: Enable managed AAD feature for cluster.
Expand Down Expand Up @@ -389,6 +392,8 @@
text: az aks create -g MyResourceGroup -n MyManagedCluster --outbound-type userDefinedRouting --load-balancer-sku standard --vnet-subnet-id customUserSubnetVnetID
- name: Create a kubernetes cluster with supporting Windows agent pools.
text: az aks create -g MyResourceGroup -n MyManagedCluster --load-balancer-sku Standard --network-plugin azure --windows-admin-username azure --windows-admin-password 'replacePassword1234$'
- name: Create a kubernetes cluster with supporting Windows agent pools with AHUB enabled.
text: az aks create -g MyResourceGroup -n MyManagedCluster --load-balancer-sku Standard --network-plugin azure --windows-admin-username azure --windows-admin-password 'replacePassword1234$' --enable-ahub
- name: Create a kubernetes cluster with managed AAD enabled.
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-aad --aad-admin-group-object-ids <id-1,id-2> --aad-tenant-id <id>
- name: Create a kubernetes cluster with server side encryption using your owned key.
Expand Down Expand Up @@ -455,6 +460,12 @@
- name: --aad-tenant-id
type: string
short-summary: The ID of an Azure Active Directory tenant.
- name: --enable-ahub
type: bool
short-summary: Enable Azure Hybrid User Benefits (AHUB) feature for cluster.
- name: --disable-ahub
type: bool
short-summary: Disable Azure Hybrid User Benefits (AHUB) feature for cluster.
examples:
- name: Update a kubernetes cluster with standard SKU load balancer to use two AKS created IPs for the load balancer outbound connection usage.
text: az aks update -g MyResourceGroup -n MyManagedCluster --load-balancer-managed-outbound-ip-count 2
Expand All @@ -476,6 +487,10 @@
text: az aks update -g MyResourceGroup -n MyManagedCluster --aad-admin-group-object-ids <id-1,id-2> --aad-tenant-id <id>
- name: Migrate a AKS AAD-Integrated cluster or a non-AAD cluster to a AKS-managed AAD cluster.
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-aad --aad-admin-group-object-ids <id-1,id-2> --aad-tenant-id <id>
- name: Enable Azure Hybrid User Benefits featture for a kubernetes cluster.
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-ahub
- name: Disable Azure Hybrid User Benefits featture for a kubernetes cluster.
text: az aks update -g MyResourceGroup -n MyManagedCluster --disable-ahub
"""

helps['aks delete'] = """
Expand Down
3 changes: 3 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def load_arguments(self, _):
c.argument('enable_node_public_ip', action='store_true', is_preview=True)
c.argument('windows_admin_username', options_list=['--windows-admin-username'])
c.argument('windows_admin_password', options_list=['--windows-admin-password'])
c.argument('enable_ahub', options_list=['--enable-ahub'])
c.argument('node_osdisk_diskencryptionset_id', type=str, options_list=['--node-osdisk-diskencryptionset-id', '-d'])

with self.argument_context('aks update') as c:
Expand All @@ -227,6 +228,8 @@ def load_arguments(self, _):
c.argument('load_balancer_outbound_ports', type=int, validator=validate_load_balancer_outbound_ports)
c.argument('load_balancer_idle_timeout', type=int, validator=validate_load_balancer_idle_timeout)
c.argument('api_server_authorized_ip_ranges', type=str, validator=validate_ip_ranges)
c.argument('enable_ahub', options_list=['--enable-ahub'])
c.argument('disable_ahub', options_list=['--disable-ahub'])

with self.argument_context('aks disable-addons') as c:
c.argument('addons', options_list=['--addons', '-a'])
Expand Down
26 changes: 23 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,7 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
admin_username="azureuser",
windows_admin_username=None,
windows_admin_password=None,
enable_ahub=False,
kubernetes_version='',
node_vm_size="Standard_DS2_v2",
node_osdisk_size=0,
Expand Down Expand Up @@ -1696,9 +1697,14 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
raise CLIError(
'Please specify both username and password in non-interactive mode.')

windows_license_type = None
if enable_ahub:
windows_license_type = 'Windows_Server'

windows_profile = ManagedClusterWindowsProfile(
admin_username=windows_admin_username,
admin_password=windows_admin_password)
admin_password=windows_admin_password,
license_type=windows_license_type)

# Skip create service principal profile for the cluster if the cluster
# enables managed identity and customer doesn't explicitly provide a service principal.
Expand Down Expand Up @@ -2088,6 +2094,8 @@ def aks_update(cmd, client, resource_group_name, name,
enable_aad=False,
aad_tenant_id=None,
aad_admin_group_object_ids=None,
enable_ahub=False,
disable_ahub=False,
no_wait=False):
update_autoscaler = enable_cluster_autoscaler + disable_cluster_autoscaler + update_cluster_autoscaler
update_lb_profile = is_load_balancer_profile_provided(load_balancer_managed_outbound_ip_count,
Expand All @@ -2104,7 +2112,9 @@ def aks_update(cmd, client, resource_group_name, name,
not uptime_sla and
api_server_authorized_ip_ranges is None and
not enable_aad and
not update_aad_profile):
not update_aad_profile and
not enable_ahub and
not disable_ahub):
raise CLIError('Please specify one or more of "--enable-cluster-autoscaler" or '
'"--disable-cluster-autoscaler" or '
'"--update-cluster-autoscaler" or '
Expand All @@ -2119,7 +2129,9 @@ def aks_update(cmd, client, resource_group_name, name,
'"--api-server-authorized-ip-ranges" or '
'"--enable-aad" or '
'"--aad-tenant-id" or '
'"--aad-admin-group-object-ids"')
'"--aad-admin-group-object-ids" or '
'"--enable-ahub" or '
'"--disable-ahub"')

instance = client.get(resource_group_name, name)
# For multi-agent pool, use the az aks nodepool command
Expand Down Expand Up @@ -2229,6 +2241,14 @@ def aks_update(cmd, client, resource_group_name, name,
if aad_admin_group_object_ids is not None:
instance.aad_profile.admin_group_object_ids = _parse_comma_separated_list(aad_admin_group_object_ids)

if enable_ahub and disable_ahub:
raise CLIError('Cannot specify "--enable-ahub" and "--disable-ahub" at the same time')

if enable_ahub:
instance.windows_profile.license_type = 'Windows_Server'
if disable_ahub:
instance.windows_profile.license_type = 'None'

return sdk_no_wait(no_wait, client.create_or_update, resource_group_name, name, instance)


Expand Down
Loading