From e9fd7fceae8b47a10ed7503b38a8e91a741aae35 Mon Sep 17 00:00:00 2001 From: Robin-Manuel Thiel Date: Wed, 6 Dec 2023 17:21:47 +0100 Subject: [PATCH] Add Auto-Upgrades to AKS Template --- src/terraform-aks/templates/azure_aks.tf | 25 ++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/terraform-aks/templates/azure_aks.tf b/src/terraform-aks/templates/azure_aks.tf index 3c03701..ab61616 100644 --- a/src/terraform-aks/templates/azure_aks.tf +++ b/src/terraform-aks/templates/azure_aks.tf @@ -3,9 +3,30 @@ resource "azurerm_kubernetes_cluster" "default" { location = azurerm_resource_group.default.location resource_group_name = azurerm_resource_group.default.name dns_prefix = "${local.prefix}aks" - kubernetes_version = var.kubernetes_version - automatic_channel_upgrade = "patch" + kubernetes_version = var.kubernetes_version sku_tier = "Standard" + automatic_channel_upgrade = "stable" + node_os_channel_upgrade = "Unmanaged" + + # Upgrade the cluster every first Sunday of a month at 1:00 am UTC for 8 hours + maintenance_window_auto_upgrade { + frequency = "RelativeMonthly" + interval = 1 + day_of_week = "Sunday" + week_index = "First" + duration = 8 + start_time = "01:00" + } + + # Upgrade the Node OS image every first Sunday of a month at 1:00 am UTC for 8 hours + maintenance_window_node_os { + frequency = "RelativeMonthly" + interval = 1 + day_of_week = "Sunday" + week_index = "First" + duration = 8 + start_time = "01:00" + } default_node_pool { name = "system"