From e67c3848d6d23bbff5c1bf6a296ced317e3672ba Mon Sep 17 00:00:00 2001 From: darren Date: Fri, 30 Oct 2020 13:49:27 +0000 Subject: [PATCH 1/4] allow use of tags --- README.md | 1 + tasks/main.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 57eca85..2127e32 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Role Variables | nodepool_name | | nodepool1 | Node pool name, upto 12 alphanumeric characters. | | os_type | | Linux | | | pod_cidr | | | A CIDR notation IP range from which to assign pod IPs when kubenet is used.
*This range must not overlap with any Subnet IP ranges.* | +| resource_tags | | Dictionary of resource tags ```resource_tags: 'environment': 'production'``` | | service_cidr | | | A CIDR notation IP range from which to assign service cluster IPs.
*This range must not overlap with any Subnet IP ranges.* | | storage_profile | | ManagedDisks | | | ssh_key | | Loading from `~/.ssh/id_rsa.pub` | Public key path or key contents to install on node VMs for SSH access. | diff --git a/tasks/main.yml b/tasks/main.yml index 128ee47..4863574 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -103,6 +103,7 @@ network_profile: "{{ network_profile | default(omit) }}" aad_profile: "{{ aad_profile | default(omit) }}" addon: "{{ addon | default(omit) }}" + tags: "{{ resource_tags | default(omit) }}" # check_mode: true register: aks From 8fb0664abe822bf545fabc7ea77759d5e5485b86 Mon Sep 17 00:00:00 2001 From: Darren Jones <46378537+darrenjones24@users.noreply.github.com> Date: Fri, 30 Oct 2020 14:00:33 +0000 Subject: [PATCH 2/4] Update README.md --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2127e32..537a9c9 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Role Variables | nodepool_name | | nodepool1 | Node pool name, upto 12 alphanumeric characters. | | os_type | | Linux | | | pod_cidr | | | A CIDR notation IP range from which to assign pod IPs when kubenet is used.
*This range must not overlap with any Subnet IP ranges.* | -| resource_tags | | Dictionary of resource tags ```resource_tags: 'environment': 'production'``` | +| resource_tags | | | Dictionary of resource tags. | | service_cidr | | | A CIDR notation IP range from which to assign service cluster IPs.
*This range must not overlap with any Subnet IP ranges.* | | storage_profile | | ManagedDisks | | | ssh_key | | Loading from `~/.ssh/id_rsa.pub` | Public key path or key contents to install on node VMs for SSH access. | @@ -81,6 +81,22 @@ Create an AKS with monitoring: name: akscluster resource_group: aksroletest ``` +Use of Resource Tags + +```yml +- hosts: localhost + tasks: + - include_role: + name: azure.aks + vars: + name: akscluster + resource_group: aksroletest + resource_tags: + 'service name': 'akscluster' + 'service location': "{{ location }}" + +``` + License ------- From 56951eade1b12c44d71ee41f8cf1614ace5c9ea9 Mon Sep 17 00:00:00 2001 From: darren Date: Fri, 30 Oct 2020 14:54:34 +0000 Subject: [PATCH 3/4] allow user to change load_balancer_sku --- README.md | 1 + defaults/main.yml | 2 ++ tasks/parameter/network.yml | 1 + 3 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 57eca85..17a341f 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Role Variables | enable_rbac | | True | Enable Kubernetes Role-Based Access Control. | | http_application_routing | | False | Enable `http_application_routing` addon. Configure ingress with automatic public DNS name creation. | | kubernetes_version | | First value from `azure_rm_aks_version` module | Version of Kubernetes to use for creating the cluster. | +| load_balancer_sku | | Basic | The load balancer sku for the managed cluster. Standard or Basic | | location | | eastus | Region of the Kubernetes Service resource, will use `resource_group`'s location if not specified.
*Location is required if resource group not exist*| | max_pods | | 110| The maximum number of pods deployable to a node. | | monitoring | | False | Enable `monitoring` addon. Turn on Log Analytics monitoring. | diff --git a/defaults/main.yml b/defaults/main.yml index b44386e..d6985a8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -18,6 +18,7 @@ storage_profile_bak: ManagedDisks os_type_bak: Linux network_plugin_bak: kubenet +load_balancer_sku: standard parameter_list: - http_application_routing @@ -53,3 +54,4 @@ parameter_list: - vnet_subnet_id - aad_server_app_secret - client_secret + - load_balancer_sku diff --git a/tasks/parameter/network.yml b/tasks/parameter/network.yml index a4278ba..cf2d96a 100644 --- a/tasks/parameter/network.yml +++ b/tasks/parameter/network.yml @@ -9,4 +9,5 @@ - {'key': 'service_cidr', 'value': 'service_cidr'} - {'key': 'dns_service_ip', 'value': 'dns_service_ip'} - {'key': 'docker_bridge_cidr', 'value': 'docker_bridge_cidr'} + - {'key': 'load_balancer_sku', 'value': 'load_balancer_sku'} when: ( network_plugin is defined ) and ( vars[item.value] is defined ) From c794c9cab89099df333cb5296f36a77be0c89af8 Mon Sep 17 00:00:00 2001 From: darren Date: Fri, 30 Oct 2020 15:01:35 +0000 Subject: [PATCH 4/4] allow user to change agent_pool_type and set VirtualMachineScaleSets --- README.md | 1 + defaults/main.yml | 3 +++ tasks/parameter/agent_pool.yml | 1 + 3 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 57eca85..05660c2 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Role Variables | aad_server_app_secret | | | The secret of an Azure Active Directory server application. | | aad_tenant_id | | | The ID of an Azure Active Directory tenant. | | admin_username | | azureuser | User account to create on node VMs for SSH access. | +| agent_pool_type | | AvailabilitySet | Possible values include VirtualMachineScaleSets and AvailabilitySet. | | service_principal | | Loading from ansible-playbook, environment variable `AZURE_CLIENT_ID` or `~/.azure/credentials` | Service principal used for authentication to Azure APIs. | | client_secret | | Loading from ansible-playbook, environment variable `AZURE_SECRET` or `~/.azure/credentials` | Secret associated with the service principal. | | dns_prefix | | The same as `name` | Prefix for hostnames that are created. | diff --git a/defaults/main.yml b/defaults/main.yml index b44386e..68caf59 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -19,6 +19,8 @@ os_type_bak: Linux network_plugin_bak: kubenet +agent_pool_type: AvailabilitySet + parameter_list: - http_application_routing - monitoring @@ -53,3 +55,4 @@ parameter_list: - vnet_subnet_id - aad_server_app_secret - client_secret + - agent_pool_type diff --git a/tasks/parameter/agent_pool.yml b/tasks/parameter/agent_pool.yml index 657af21..5a0aec9 100644 --- a/tasks/parameter/agent_pool.yml +++ b/tasks/parameter/agent_pool.yml @@ -10,4 +10,5 @@ - {'key': 'storage_profiles', 'value': 'storage_profile'} - {'key': 'vnet_subnet_id', 'value': 'vnet_subnet_id'} - {'key': 'os_type', 'value': 'os_type'} + - {'key': 'type', 'value': 'agent_pool_type'} when: vars[item.value] is defined