Skip to content

Commit cae4092

Browse files
committed
add drain_timeout_in_minutes and node_soak_duration_in_minutes
Requires provider version v3.106.0 hashicorp/terraform-provider-azurerm#26137
1 parent 2c364a6 commit cae4092

5 files changed

Lines changed: 35 additions & 9 deletions

File tree

README.md

Lines changed: 5 additions & 3 deletions
Large diffs are not rendered by default.

extra_node_pool.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ resource "azurerm_kubernetes_cluster_node_pool" "node_pool_create_before_destroy
125125
for_each = each.value.upgrade_settings == null ? [] : ["upgrade_settings"]
126126

127127
content {
128-
max_surge = each.value.upgrade_settings.max_surge
128+
drain_timeout_in_minutes = each.value.upgrade_settings.drain_timeout_in_minutes
129+
node_soak_duration_in_minutes = each.value.upgrade_settings.node_soak_duration_in_minutes
130+
max_surge = each.value.upgrade_settings.max_surge
129131
}
130132
}
131133
dynamic "windows_profile" {
@@ -283,7 +285,9 @@ resource "azurerm_kubernetes_cluster_node_pool" "node_pool_create_after_destroy"
283285
for_each = each.value.upgrade_settings == null ? [] : ["upgrade_settings"]
284286

285287
content {
286-
max_surge = each.value.upgrade_settings.max_surge
288+
drain_timeout_in_minutes = each.value.upgrade_settings.drain_timeout_in_minutes
289+
node_soak_duration_in_minutes = each.value.upgrade_settings.node_soak_duration_in_minutes
290+
max_surge = each.value.upgrade_settings.max_surge
287291
}
288292
}
289293
dynamic "windows_profile" {

main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ resource "azurerm_kubernetes_cluster" "main" {
146146
for_each = var.agents_pool_max_surge == null ? [] : ["upgrade_settings"]
147147

148148
content {
149-
max_surge = var.agents_pool_max_surge
149+
drain_timeout_in_minutes = var.agents_pool_drain_timeout_in_minutes
150+
node_soak_duration_in_minutes = var.agents_pool_node_soak_duration_in_minutes
151+
max_surge = var.agents_pool_max_surge
152+
153+
150154
}
151155
}
152156
}

variables.tf

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,18 @@ variable "agents_pool_max_surge" {
173173
description = "The maximum number or percentage of nodes which will be added to the Default Node Pool size during an upgrade."
174174
}
175175

176+
variable "agents_pool_node_soak_duration_in_minutes" {
177+
type = number
178+
default = 0
179+
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."
180+
}
181+
182+
variable "agents_pool_drain_timeout_in_minutes" {
183+
type = number
184+
default = null
185+
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."
186+
}
187+
176188
variable "agents_pool_name" {
177189
type = string
178190
default = "nodepool"
@@ -1030,7 +1042,9 @@ variable "node_pools" {
10301042
ultra_ssd_enabled = optional(bool)
10311043
vnet_subnet_id = optional(string)
10321044
upgrade_settings = optional(object({
1033-
max_surge = string
1045+
drain_timeout_in_minutes = number
1046+
node_soak_duration_in_minutes = number
1047+
max_surge = string
10341048
}))
10351049
windows_profile = optional(object({
10361050
outbound_nat_enabled = optional(bool, true)
@@ -1130,7 +1144,9 @@ variable "node_pools" {
11301144
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.
11311145
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.
11321146
upgrade_settings = optional(object({
1133-
max_surge = string
1147+
drain_timeout_in_minutes = number
1148+
node_soak_duration_in_minutes = number
1149+
max_surge = string
11341150
}))
11351151
windows_profile = optional(object({
11361152
outbound_nat_enabled = optional(bool, true)

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ terraform {
88
}
99
azurerm = {
1010
source = "hashicorp/azurerm"
11-
version = ">= 3.84.0, < 4.0"
11+
version = ">= 3.106.1, < 4.0"
1212
}
1313
null = {
1414
source = "hashicorp/null"

0 commit comments

Comments
 (0)