Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS] aks create/update: add --load-balancer-outbound-ports and --load-balancer-idle-timeout #11960

Merged
merged 15 commits into from
Jan 31, 2020
1 change: 1 addition & 0 deletions src/azure-cli/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release History
**ACS**

* Added support to set outbound allocated ports and idle timeouts on standard load balancer
gtracer marked this conversation as resolved.
Show resolved Hide resolved
* Update to API Version 2019-11-01

**ACR**

Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/acs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
- name: --load-balancer-outbound-ports
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ports means array or list, while type is int

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yungezz your right that in most cases it is a list of ports. But in this case we are taking the name from SLB which has a property called allocated-outbound-ports (interchangeable referred to as outbound ports) which is actually an int of the # of ports you want per VM. We want to keep the name consistent with SLB since we are using this CLI param to set the SLB in the customers AKS cluster

You can see more details here: https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-outbound-rules-overview#snatports

type: string
gtracer marked this conversation as resolved.
Show resolved Hide resolved
short-summary: Load balancer outbound allocated ports.
long-summary: Desired static number of outbound ports per VM in the load balancer backend pool. By default, azure dynamically configures allocated ports as VM count changes.
long-summary: Desired static number of outbound ports per VM in the load balancer backend pool. By default, set to 0 which uses the default allocation based on the number of VMs.
- name: --load-balancer-idle-timeout
type: string
gtracer marked this conversation as resolved.
Show resolved Hide resolved
short-summary: Load balancer idle timeout in minutes.
Expand Down Expand Up @@ -385,7 +385,7 @@
- name: --load-balancer-outbound-ports
type: string
short-summary: Load balancer outbound allocated ports.
gtracer marked this conversation as resolved.
Show resolved Hide resolved
long-summary: Desired static number of outbound ports per VM in the load balancer backend pool. By default, azure dynamically configures allocated ports as VM count changes.
long-summary: Desired static number of outbound ports per VM in the load balancer backend pool. By default, set to 0 which uses the default allocation based on the number of VMs.
- name: --load-balancer-idle-timeout
type: string
short-summary: Load balancer idle timeout in minutes.
Expand Down
6 changes: 3 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acs/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ def validate_load_balancer_outbound_ports(namespace):
if namespace.load_balancer_outbound_ports is not None:
if namespace.load_balancer_outbound_ports % 8 != 0:
raise CLIError("--load-balancer-allocated-ports must be a multiple of 8")
if namespace.load_balancer_outbound_ports < 0:
raise CLIError("--load-balancer-allocated-ports cannot be negative")
if namespace.load_balancer_outbound_ports < 0 or namespace.load_balancer_outbound_ports > 64000:
gtracer marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest to add the constraint in doc above also

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the _loadbalancer.py file? If so, can you explain your recommendation further? Are you worried that another operation will bypass the validation and then erroneously set it?

I am not particularly worried if it get's by passed as this validation is just "best effort / fail fast" we do the exact same validation in the RP itself

raise CLIError("--load-balancer-allocated-ports must be in the range [0,64000]")


def validate_load_balancer_idle_timeout(namespace):
"""validate load balancer profile idle timeout"""
if namespace.load_balancer_idle_timeout is not None:
if namespace.load_balancer_idle_timeout < 4 or namespace.load_balancer_idle_timeout > 120:
raise CLIError("--load-balancer-idle-timeout must be set between 4 and 120 minutes")
raise CLIError("--load-balancer-idle-timeout must be in the range [4,120]")


def validate_nodes_count(namespace):
Expand Down