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
20 changes: 20 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 @@ -157,6 +157,10 @@
type: int
short-summary: Load balancer managed outbound IP count.
long-summary: Desired number of managed outbound IPs for load balancer outbound connection. Valid for Standard SKU load balancer cluster only.
- name: --load-balancer-managed-outbound-ipv6-count
type: int
short-summary: Load balancer managed outbound IPv6 IP count.
long-summary: Desired number of managed outbound IPv6 IPs for load balancer outbound connection. Valid for dual-stack (--ip-families IPv4,IPv6) only. If updated, it will wipe off the existing setting on Load balancer managed outbound IPv6 count; Load balancer outbound IP resource IDs and Load balancer outbound IP prefix resource IDs.
- name: --load-balancer-outbound-ips
type: string
short-summary: Load balancer outbound IP resource IDs.
Expand Down Expand Up @@ -251,6 +255,18 @@
type: string
short-summary: A CIDR notation IP range from which to assign service cluster IPs.
long-summary: This range must not overlap with any Subnet IP ranges. For example, 10.0.0.0/16.
- name: --service-cidrs
type: string
short-summary: A comma separated list of CIDR notation IP ranges from which to assign service cluster IPs.
long-summary: Each range must not overlap with any Subnet IP ranges. For example, "10.0.0.0/16,2001:abcd::/108".
- name: --pod-cidrs
type: string
short-summary: A comma separated list of CIDR notation IP ranges from which to assign pod IPs when kubenet is used.
long-summary: Each range must not overlap with any Subnet IP ranges. For example, "172.244.0.0/16,fd0:abcd::/64".
- name: --ip-families
type: string
short-summary: A comma separated list of IP versions to use for cluster networking.
long-summary: Each IP version should be in the format IPvN. For example, IPv4.
- name: --vnet-subnet-id
type: string
short-summary: The ID of a subnet in an existing VNet into which to deploy the cluster.
Expand Down Expand Up @@ -537,6 +553,10 @@
type: int
short-summary: Load balancer managed outbound IP count.
long-summary: Desired number of managed outbound IPs for load balancer outbound connection. Valid for Standard SKU load balancer cluster only. --load-balancer-managed-outbound-ip-count, --load-balancer-outbound-ips and --load-balancer-outbound-ip-prefixes are mutually exclusive. If updated, it will wipe off the existing setting on Load balancer outbound IP resource IDs and Load balancer outbound IP prefix resource IDs. If the new value is greater than the original value, new additional outbound IPs will be created. If the value is less than the original value, existing outbound IPs will be deleted and outbound connections may fail due to configuration update.
- name: --load-balancer-managed-outbound-ipv6-count
type: int
short-summary: Load balancer managed outbound IPv6 IP count.
long-summary: Desired number of managed outbound IPv6 IPs for load balancer outbound connection. Valid for dual-stack (--ip-families IPv4,IPv6) only. If updated, it will wipe off the existing setting on Load balancer managed outbound IPv6 count; Load balancer outbound IP resource IDs and Load balancer outbound IP prefix resource IDs.
- name: --load-balancer-outbound-ips
type: string
short-summary: Load balancer outbound IP resource IDs.
Expand Down
59 changes: 32 additions & 27 deletions src/azure-cli/azure/cli/command_modules/acs/_loadbalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,53 @@ def set_load_balancer_sku(sku, kubernetes_version):
return "standard"


def update_load_balancer_profile(managed_outbound_ip_count, outbound_ips, outbound_ip_prefixes,
outbound_ports, idle_timeout, profile, models):
def update_load_balancer_profile(managed_outbound_ip_count, managed_outbound_ipv6_count, outbound_ips,
outbound_ip_prefixes, outbound_ports, idle_timeout, profile, models):
"""parse and update an existing load balancer profile"""
if not is_load_balancer_profile_provided(managed_outbound_ip_count, outbound_ips, outbound_ip_prefixes,
outbound_ports, idle_timeout):
if not is_load_balancer_profile_provided(managed_outbound_ip_count, managed_outbound_ipv6_count, outbound_ips,
outbound_ip_prefixes, outbound_ports, idle_timeout):
return profile
return configure_load_balancer_profile(managed_outbound_ip_count, outbound_ips, outbound_ip_prefixes,
outbound_ports, idle_timeout, profile, models)
return configure_load_balancer_profile(managed_outbound_ip_count, managed_outbound_ipv6_count, outbound_ips,
outbound_ip_prefixes, outbound_ports, idle_timeout, profile, models)


def create_load_balancer_profile(managed_outbound_ip_count, outbound_ips, outbound_ip_prefixes,
outbound_ports, idle_timeout, models):
def create_load_balancer_profile(managed_outbound_ip_count, managed_outbound_ipv6_count, outbound_ips,
outbound_ip_prefixes, outbound_ports, idle_timeout, models):
"""parse and build load balancer profile"""
if not is_load_balancer_profile_provided(managed_outbound_ip_count, outbound_ips, outbound_ip_prefixes,
outbound_ports, idle_timeout):
if not is_load_balancer_profile_provided(managed_outbound_ip_count, managed_outbound_ipv6_count, outbound_ips,
outbound_ip_prefixes, outbound_ports, idle_timeout):
return None

if isinstance(models, SimpleNamespace):
ManagedClusterLoadBalancerProfile = models.ManagedClusterLoadBalancerProfile
else:
ManagedClusterLoadBalancerProfile = models.get("ManagedClusterLoadBalancerProfile")
profile = ManagedClusterLoadBalancerProfile()
return configure_load_balancer_profile(managed_outbound_ip_count, outbound_ips, outbound_ip_prefixes,
outbound_ports, idle_timeout, profile, models)
return configure_load_balancer_profile(managed_outbound_ip_count, managed_outbound_ipv6_count, outbound_ips,
outbound_ip_prefixes, outbound_ports, idle_timeout, profile, models)


def configure_load_balancer_profile(managed_outbound_ip_count, outbound_ips, outbound_ip_prefixes, outbound_ports,
idle_timeout, profile, models):
def configure_load_balancer_profile(managed_outbound_ip_count, managed_outbound_ipv6_count, outbound_ips,
outbound_ip_prefixes, outbound_ports, idle_timeout, profile, models):
"""configure a load balancer with customer supplied values"""
if not profile:
return profile

outbound_ip_resources = _get_load_balancer_outbound_ips(outbound_ips, models)
outbound_ip_prefix_resources = _get_load_balancer_outbound_ip_prefixes(
outbound_ip_prefixes, models)

if managed_outbound_ip_count or outbound_ip_resources or outbound_ip_prefix_resources:
# ips -> i_ps due to track 2 naming issue
profile.managed_outbound_i_ps = None
outbound_ip_prefix_resources = _get_load_balancer_outbound_ip_prefixes(outbound_ip_prefixes, models)

if (
managed_outbound_ip_count or
managed_outbound_ipv6_count or
outbound_ip_resources or
outbound_ip_prefix_resources
):
# ips -> i_ps due to track 2 naming issue
profile.outbound_i_ps = None
profile.outbound_ip_prefixes = None
if managed_outbound_ip_count:
profile.managed_outbound_i_ps = None

if managed_outbound_ip_count or managed_outbound_ipv6_count:
if isinstance(models, SimpleNamespace):
ManagedClusterLoadBalancerProfileManagedOutboundIPs = (
models.ManagedClusterLoadBalancerProfileManagedOutboundIPs
Expand All @@ -73,10 +77,11 @@ def configure_load_balancer_profile(managed_outbound_ip_count, outbound_ips, out
ManagedClusterLoadBalancerProfileManagedOutboundIPs = models.get(
"ManagedClusterLoadBalancerProfileManagedOutboundIPs"
)
# ips -> i_ps due to track 2 naming issue
profile.managed_outbound_i_ps = ManagedClusterLoadBalancerProfileManagedOutboundIPs(
count=managed_outbound_ip_count
)
profile.managed_outbound_i_ps = ManagedClusterLoadBalancerProfileManagedOutboundIPs()
if managed_outbound_ip_count:
profile.managed_outbound_i_ps.count = managed_outbound_ip_count
if managed_outbound_ipv6_count:
profile.managed_outbound_i_ps.count_ipv6 = managed_outbound_ipv6_count
if outbound_ip_resources:
if isinstance(models, SimpleNamespace):
ManagedClusterLoadBalancerProfileOutboundIPs = models.ManagedClusterLoadBalancerProfileOutboundIPs
Expand All @@ -86,7 +91,6 @@ def configure_load_balancer_profile(managed_outbound_ip_count, outbound_ips, out
)
# ips -> i_ps due to track 2 naming issue
profile.outbound_i_ps = ManagedClusterLoadBalancerProfileOutboundIPs(
# ips -> i_ps due to track 2 naming issue
public_i_ps=outbound_ip_resources
)
if outbound_ip_prefix_resources:
Expand All @@ -108,9 +112,10 @@ def configure_load_balancer_profile(managed_outbound_ip_count, outbound_ips, out
return profile


def is_load_balancer_profile_provided(managed_outbound_ip_count, outbound_ips, ip_prefixes,
def is_load_balancer_profile_provided(managed_outbound_ip_count, managed_outbound_ipv6_count, outbound_ips, ip_prefixes,
outbound_ports, idle_timeout):
return any([managed_outbound_ip_count,
managed_outbound_ipv6_count,
outbound_ips,
ip_prefixes,
outbound_ports,
Expand Down
5 changes: 5 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 @@ -164,8 +164,12 @@ def load_arguments(self, _):
c.argument('docker_bridge_address')
c.argument('pod_cidr')
c.argument('service_cidr')
c.argument('ip_families')
c.argument('pod_cidrs')
c.argument('service_cidrs')
c.argument('load_balancer_sku', arg_type=get_enum_type(load_balancer_skus), validator=validate_load_balancer_sku)
c.argument('load_balancer_managed_outbound_ip_count', type=int)
c.argument('load_balancer_managed_outbound_ipv6_count', type=int)
c.argument('load_balancer_outbound_ips', validator=validate_load_balancer_outbound_ips)
c.argument('load_balancer_outbound_ip_prefixes', validator=validate_load_balancer_outbound_ip_prefixes)
c.argument('load_balancer_outbound_ports', type=int, validator=validate_load_balancer_outbound_ports)
Expand Down Expand Up @@ -271,6 +275,7 @@ def load_arguments(self, _):
c.argument('disable_local_accounts', action='store_true')
c.argument('enable_local_accounts', action='store_true')
c.argument('load_balancer_managed_outbound_ip_count', type=int)
c.argument('load_balancer_managed_outbound_ipv6_count', type=int)
c.argument('load_balancer_outbound_ips', validator=validate_load_balancer_outbound_ips)
c.argument('load_balancer_outbound_ip_prefixes', validator=validate_load_balancer_outbound_ip_prefixes)
c.argument('load_balancer_outbound_ports', type=int, validator=validate_load_balancer_outbound_ports)
Expand Down
5 changes: 5 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,14 @@ def aks_create(
no_ssh_key=False,
pod_cidr=None,
service_cidr=None,
ip_families=None,
pod_cidrs=None,
service_cidrs=None,
dns_service_ip=None,
docker_bridge_address=None,
load_balancer_sku=None,
load_balancer_managed_outbound_ip_count=None,
load_balancer_managed_outbound_ipv6_count=None,
load_balancer_outbound_ips=None,
load_balancer_outbound_ip_prefixes=None,
load_balancer_outbound_ports=None,
Expand Down Expand Up @@ -517,6 +521,7 @@ def aks_update(
disable_local_accounts=False,
enable_local_accounts=False,
load_balancer_managed_outbound_ip_count=None,
load_balancer_managed_outbound_ipv6_count=None,
load_balancer_outbound_ips=None,
load_balancer_outbound_ip_prefixes=None,
load_balancer_outbound_ports=None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ aks create:
enable_sgxquotehelper:
rule_exclusions:
- option_length_too_long
load_balancer_managed_outbound_ipv6_count:
rule_exclusions:
- option_length_too_long
nat_gateway_idle_timeout:
rule_exclusions:
- option_length_too_long
Expand All @@ -33,6 +36,9 @@ aks update:
disable_secret_rotation:
rule_exclusions:
- option_length_too_long
load_balancer_managed_outbound_ipv6_count:
rule_exclusions:
- option_length_too_long
nat_gateway_idle_timeout:
rule_exclusions:
- option_length_too_long
Expand Down
Loading