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

feat: Allow users set upgrade_settings.max_surge property #9

Closed
wants to merge 3 commits into from
Closed
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ module "aks" {
| container\_registries\_ids | List of Azure Container Registries IDs where Azure Kubernetes Service needs pull access. | `list(string)` | `[]` | no |
| custom\_diagnostic\_settings\_name | Custom name of the diagnostics settings, name will be 'default' if not set. | `string` | `"default"` | no |
| custom\_name | Custom AKS, generated if not set | `string` | `""` | no |
| default\_node\_pool | Default Node Pool configuration. | <pre>object({<br> name = optional(string, "default")<br> type = optional(string, "VirtualMachineScaleSets")<br> vm_size = optional(string, "Standard_D2_v3")<br> os_sku = optional(string, "Ubuntu")<br> os_disk_type = optional(string, "Managed")<br> os_disk_size_gb = optional(number)<br> enable_auto_scaling = optional(bool, false)<br> node_count = optional(number, 1)<br> min_count = optional(number, 1)<br> max_count = optional(number, 10)<br> max_pods = optional(number)<br> node_labels = optional(map(any))<br> node_taints = optional(list(any))<br> enable_host_encryption = optional(bool)<br> enable_node_public_ip = optional(bool, false)<br> orchestrator_version = optional(string)<br> zones = optional(list(number), [1, 2, 3])<br> tags = optional(map(string), {})<br> })</pre> | `{}` | no |
| default\_node\_pool | Default Node Pool configuration. | <pre>object({<br> name = optional(string, "default")<br> type = optional(string, "VirtualMachineScaleSets")<br> vm_size = optional(string, "Standard_D2_v3")<br> os_sku = optional(string, "Ubuntu")<br> os_disk_type = optional(string, "Managed")<br> os_disk_size_gb = optional(number)<br> enable_auto_scaling = optional(bool, false)<br> node_count = optional(number, 1)<br> min_count = optional(number, 1)<br> max_count = optional(number, 10)<br> max_pods = optional(number)<br> max_surge = optional(string)<br> node_labels = optional(map(any))<br> node_taints = optional(list(any))<br> enable_host_encryption = optional(bool)<br> enable_node_public_ip = optional(bool, false)<br> orchestrator_version = optional(string)<br> zones = optional(list(number), [1, 2, 3])<br> tags = optional(map(string), {})<br> })</pre> | `{}` | no |
| default\_tags\_enabled | Option to enable or disable default tags. | `bool` | `true` | no |
| environment | Project environment. | `string` | n/a | yes |
| extra\_tags | Additional tags to add on resources. | `map(string)` | `{}` | no |
Expand All @@ -288,7 +288,7 @@ module "aks" {
| logs\_metrics\_categories | Metrics categories to send to destinations. | `list(string)` | `null` | no |
| name\_prefix | Optional prefix for the generated name | `string` | `""` | no |
| name\_suffix | Optional suffix for the generated name | `string` | `""` | no |
| node\_pools | A list of Node Pools to create. | <pre>list(object({<br> name = string<br> vm_size = optional(string, "Standard_D2_v3")<br> os_sku = optional(string, "Ubuntu")<br> os_disk_type = optional(string, "Managed")<br> os_disk_size_gb = optional(number)<br> kubelet_disk_type = optional(string)<br> enable_auto_scaling = optional(bool, false)<br> node_count = optional(number, 1)<br> min_count = optional(number, 1)<br> max_count = optional(number, 10)<br> max_pods = optional(number)<br> node_labels = optional(map(any))<br> node_taints = optional(list(any))<br> enable_host_encryption = optional(bool)<br> enable_node_public_ip = optional(bool, false)<br> node_subnet = optional(object({<br> name = optional(string)<br> virtual_network_name = optional(string)<br> resource_group_name = optional(string)<br> }), {})<br> pod_subnet = optional(object({<br> name = optional(string)<br> virtual_network_name = optional(string)<br> resource_group_name = optional(string)<br> }), {})<br> priority = optional(string)<br> eviction_policy = optional(string)<br> orchestrator_version = optional(string)<br> zones = optional(list(number), [1, 2, 3])<br> tags = optional(map(string), {})<br> }))</pre> | `[]` | no |
| node\_pools | A list of Node Pools to create. | <pre>list(object({<br> name = string<br> vm_size = optional(string, "Standard_D2_v3")<br> os_sku = optional(string, "Ubuntu")<br> os_disk_type = optional(string, "Managed")<br> os_disk_size_gb = optional(number)<br> kubelet_disk_type = optional(string)<br> enable_auto_scaling = optional(bool, false)<br> node_count = optional(number, 1)<br> min_count = optional(number, 1)<br> max_count = optional(number, 10)<br> max_pods = optional(number)<br> max_surge = optional(string)<br> node_labels = optional(map(any))<br> node_taints = optional(list(any))<br> enable_host_encryption = optional(bool)<br> enable_node_public_ip = optional(bool, false)<br> node_subnet = optional(object({<br> name = optional(string)<br> virtual_network_name = optional(string)<br> resource_group_name = optional(string)<br> }), {})<br> pod_subnet = optional(object({<br> name = optional(string)<br> virtual_network_name = optional(string)<br> resource_group_name = optional(string)<br> }), {})<br> priority = optional(string)<br> eviction_policy = optional(string)<br> orchestrator_version = optional(string)<br> zones = optional(list(number), [1, 2, 3])<br> tags = optional(map(string), {})<br> }))</pre> | `[]` | no |
| nodes\_resource\_group\_name | Name of the Resource Group in which to put Azure Kubernetes Service nodes. | `string` | `null` | no |
| nodes\_subnet | The Subnet used by nodes. | <pre>object({<br> name = string<br> virtual_network_name = string<br> resource_group_name = optional(string)<br> })</pre> | n/a | yes |
| oidc\_issuer\_enabled | Whether the OIDC issuer URL should be enabled. | `bool` | `true` | no |
Expand Down
7 changes: 7 additions & 0 deletions r-aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ resource "azurerm_kubernetes_cluster" "aks" {
os_sku = local.default_node_pool.os_sku
os_disk_size_gb = coalesce(local.default_node_pool.os_disk_size_gb, can(regex("^Windows", local.default_node_pool.os_sku)) ? local.default_node_profile["windows"].os_disk_size_gb : local.default_node_profile["linux"].os_disk_size_gb)
max_pods = coalesce(local.default_node_pool.max_pods, can(regex("^Windows", local.default_node_pool.os_sku)) ? local.default_node_profile["windows"].max_pods : local.default_node_profile["linux"].max_pods)

dynamic "upgrade_settings" {
for_each = local.default_node_pool.max_surge[*]
content {
max_surge = local.default_node_pool.max_surge
}
}
}

dynamic "auto_scaler_profile" {
Expand Down
8 changes: 8 additions & 0 deletions r-node-pools.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,13 @@ resource "azurerm_kubernetes_cluster_node_pool" "node_pools" {
os_disk_size_gb = coalesce(each.value.os_disk_size_gb, can(regex("^Windows", each.value.os_sku)) ? local.default_node_profile["windows"].os_disk_size_gb : local.default_node_profile["linux"].os_disk_size_gb)
max_pods = coalesce(each.value.max_pods, can(regex("^Windows", each.value.os_sku)) ? local.default_node_profile["windows"].max_pods : local.default_node_profile["linux"].max_pods)


dynamic "upgrade_settings" {
for_each = local.default_node_pool.max_surge[*]
content {
max_surge = local.default_node_pool.max_surge
}
}

tags = merge(local.default_tags, var.extra_tags, each.value.tags)
}
2 changes: 2 additions & 0 deletions variables-aks-light.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ variable "default_node_pool" {
min_count = optional(number, 1)
max_count = optional(number, 10)
max_pods = optional(number)
max_surge = optional(string)
node_labels = optional(map(any))
node_taints = optional(list(any))
enable_host_encryption = optional(bool)
Expand Down Expand Up @@ -272,6 +273,7 @@ variable "node_pools" {
min_count = optional(number, 1)
max_count = optional(number, 10)
max_pods = optional(number)
max_surge = optional(string)
node_labels = optional(map(any))
node_taints = optional(list(any))
enable_host_encryption = optional(bool)
Expand Down