Skip to content

Commit

Permalink
Merge branch 'AZ-1351-upgrade-settings' into 'master'
Browse files Browse the repository at this point in the history
AZ-1351: Add parameter `upgrade settings`

Closes AZ-1351

See merge request claranet/projects/cloud/azure/terraform/modules/aks-light!12
  • Loading branch information
Laurent Piroelle committed Feb 23, 2024
2 parents f54a743 + 5d15e7a commit 55a6808
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Added
* AZ-1348: Add Data Collection Rule management
* AZ-1351: Add `upgrade_settings` parameter

# v7.1.1 - 2024-02-16

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ module "aks" {
| custom\_name | Custom AKS name, generated if not set. | `string` | `""` | no |
| data\_collection\_rule | AKS Data Collection Rule configuration. | <pre>object({<br> enabled = optional(bool, true)<br> custom_log_analytics_workspace_id = optional(string)<br> data_streams = optional(list(string), [<br> "Microsoft-ContainerLog",<br> "Microsoft-ContainerLogV2",<br> "Microsoft-KubeEvents",<br> "Microsoft-KubePodInventory",<br> "Microsoft-InsightsMetrics",<br> "Microsoft-ContainerInventory",<br> "Microsoft-ContainerNodeInventory",<br> "Microsoft-KubeNodeInventory",<br> "Microsoft-KubeServices",<br> "Microsoft-KubePVInventory"<br> ])<br> namespaces_filter = optional(list(string), [<br> "kube-system",<br> "gatekeeper-system",<br> "kube-node-lease",<br> "calico-system",<br> ])<br> namespace_filtering_mode = optional(string, "Exclude")<br> data_collection_interval = optional(string, "5m")<br> container_log_v2_enabled = optional(bool, true)<br> })</pre> | `{}` | no |
| data\_collection\_rule\_custom\_name | Custom name for the AKS Data Collection Rule. | `string` | `null` | 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> temporary_name_for_rotation = optional(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> 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> temporary_name_for_rotation = optional(string)<br> upgrade_settings = optional(object({<br> max_surge = optional(string, "10%")<br> }), {})<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 @@ -312,7 +312,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> 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> upgrade_settings = optional(object({<br> max_surge = optional(string, "10%")<br> }), {})<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
3 changes: 3 additions & 0 deletions r-aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ resource "azurerm_kubernetes_cluster" "aks" {
zones = local.default_node_pool.zones
tags = local.default_node_pool_tags
temporary_name_for_rotation = coalesce(local.default_node_pool.temporary_name_for_rotation, format("%stmp", substr(local.default_node_pool.name, 0, 9)))
upgrade_settings {
max_surge = local.default_node_pool.upgrade_settings.max_surge
}

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)
Expand Down
3 changes: 3 additions & 0 deletions r-node-pools.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ resource "azurerm_kubernetes_cluster_node_pool" "node_pools" {
eviction_policy = each.value.eviction_policy
orchestrator_version = each.value.orchestrator_version
zones = each.value.zones
upgrade_settings {
max_surge = each.value.upgrade_settings.max_surge
}

os_sku = each.value.os_sku
os_type = can(regex("^Windows", each.value.os_sku)) ? "Windows" : "Linux"
Expand Down
2 changes: 1 addition & 1 deletion terraform.tfvars.ci
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ node_pools = [

extra_tags = {
foo = "bar"
}
}
10 changes: 8 additions & 2 deletions variables-aks-light.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ variable "default_node_pool" {
zones = optional(list(number), [1, 2, 3])
tags = optional(map(string), {})
temporary_name_for_rotation = optional(string)
upgrade_settings = optional(object({
max_surge = optional(string, "10%")
}), {})
})
nullable = false
default = {}
Expand Down Expand Up @@ -290,8 +293,11 @@ variable "node_pools" {
priority = optional(string)
eviction_policy = optional(string)
orchestrator_version = optional(string)
zones = optional(list(number), [1, 2, 3])
tags = optional(map(string), {})
upgrade_settings = optional(object({
max_surge = optional(string, "10%")
}), {})
zones = optional(list(number), [1, 2, 3])
tags = optional(map(string), {})
}))
nullable = false
default = []
Expand Down

0 comments on commit 55a6808

Please sign in to comment.