From 6887ffc62936883fe465693d522b46eecf81d21c Mon Sep 17 00:00:00 2001 From: Gustavo Hidalgo Date: Fri, 12 Apr 2024 11:12:08 -0400 Subject: [PATCH] Add AKS cluster maintenance window. (#201) --- deployment/terraform/resources/aks.tf | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/deployment/terraform/resources/aks.tf b/deployment/terraform/resources/aks.tf index cb720b20..23452424 100644 --- a/deployment/terraform/resources/aks.tf +++ b/deployment/terraform/resources/aks.tf @@ -38,6 +38,37 @@ resource "azurerm_kubernetes_cluster" "pc" { azure_rbac_enabled = true } + maintenance_window { + allowed { + day = "Saturday" + hours = [10, 11, 12, 13, 14, 15, 16, 17, 18] + } + # not_allowed { + # start = ISO8601 + # end = ISO8601 + # } + } + + # Recommendation is to make it at least 4 hours long + # https://learn.microsoft.com/en-us/azure/aks/planned-maintenance?tabs=json-file#creating-a-maintenance-window + maintenance_window_auto_upgrade { + frequency = "Weekly" + day_of_week = "Saturday" + interval = 1 + duration = 4 + utc_offset = "+00:00" + start_time = "10:00" # UTC + } + + maintenance_window_node_os { + frequency = "Weekly" + day_of_week = "Saturday" + interval = 1 + duration = 4 + utc_offset = "+00:00" + start_time = "14:00" # UTC + } + tags = { Environment = var.environment ManagedBy = "AI4E"