Skip to content

Commit

Permalink
add drain_timeout_in_minutes and node_soak_duration_in_minutes
Browse files Browse the repository at this point in the history
Requires provider version v3.106.0
hashicorp/terraform-provider-azurerm#26137
  • Loading branch information
zioproto authored and lonegunmanb committed Jun 28, 2024
1 parent d92bdfc commit 5c71566
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
8 changes: 5 additions & 3 deletions README.md

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions extra_node_pool.tf
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ resource "azurerm_kubernetes_cluster_node_pool" "node_pool_create_before_destroy
for_each = each.value.upgrade_settings == null ? [] : ["upgrade_settings"]

content {
max_surge = each.value.upgrade_settings.max_surge
drain_timeout_in_minutes = each.value.upgrade_settings.drain_timeout_in_minutes
node_soak_duration_in_minutes = each.value.upgrade_settings.node_soak_duration_in_minutes
max_surge = each.value.upgrade_settings.max_surge
}
}
dynamic "windows_profile" {
Expand Down Expand Up @@ -283,7 +285,9 @@ resource "azurerm_kubernetes_cluster_node_pool" "node_pool_create_after_destroy"
for_each = each.value.upgrade_settings == null ? [] : ["upgrade_settings"]

content {
max_surge = each.value.upgrade_settings.max_surge
drain_timeout_in_minutes = each.value.upgrade_settings.drain_timeout_in_minutes
node_soak_duration_in_minutes = each.value.upgrade_settings.node_soak_duration_in_minutes
max_surge = each.value.upgrade_settings.max_surge
}
}
dynamic "windows_profile" {
Expand Down
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ resource "azurerm_kubernetes_cluster" "main" {
for_each = var.agents_pool_max_surge == null ? [] : ["upgrade_settings"]

content {
max_surge = var.agents_pool_max_surge
drain_timeout_in_minutes = var.agents_pool_drain_timeout_in_minutes
node_soak_duration_in_minutes = var.agents_pool_node_soak_duration_in_minutes
max_surge = var.agents_pool_max_surge
}
}
}
Expand Down
20 changes: 18 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ variable "agents_pool_max_surge" {
description = "The maximum number or percentage of nodes which will be added to the Default Node Pool size during an upgrade."
}

variable "agents_pool_node_soak_duration_in_minutes" {
type = number
default = 0
description = "(Optional) The amount of time in minutes to wait after draining a node and before reimaging and moving on to next node. Defaults to 0."
}

variable "agents_pool_drain_timeout_in_minutes" {
type = number
default = null
description = "(Optional) The amount of time in minutes to wait on eviction of pods and graceful termination per node. This eviction wait time honors waiting on pod disruption budgets. If this time is exceeded, the upgrade fails. Unsetting this after configuring it will force a new resource to be created."
}

variable "agents_pool_name" {
type = string
default = "nodepool"
Expand Down Expand Up @@ -1030,7 +1042,9 @@ variable "node_pools" {
ultra_ssd_enabled = optional(bool)
vnet_subnet_id = optional(string)
upgrade_settings = optional(object({
max_surge = string
drain_timeout_in_minutes = number
node_soak_duration_in_minutes = number
max_surge = string
}))
windows_profile = optional(object({
outbound_nat_enabled = optional(bool, true)
Expand Down Expand Up @@ -1130,7 +1144,9 @@ variable "node_pools" {
ultra_ssd_enabled = (Optional) Used to specify whether the UltraSSD is enabled in the Node Pool. Defaults to `false`. See [the documentation](https://docs.microsoft.com/azure/aks/use-ultra-disks) for more information. Changing this forces a new resource to be created.
vnet_subnet_id = (Optional) The ID of the Subnet where this Node Pool should exist. Changing this forces a new resource to be created. A route table must be configured on this Subnet.
upgrade_settings = optional(object({
max_surge = string
drain_timeout_in_minutes = number
node_soak_duration_in_minutes = number
max_surge = string
}))
windows_profile = optional(object({
outbound_nat_enabled = optional(bool, true)
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ terraform {
}
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.84.0, < 4.0"
version = ">= 3.106.1, < 4.0"
}
null = {
source = "hashicorp/null"
Expand Down

0 comments on commit 5c71566

Please sign in to comment.