From 8e8f4d2117af7687c1934987e51a436c45db07df Mon Sep 17 00:00:00 2001 From: Luca Prete Date: Fri, 3 Dec 2021 14:15:51 +0100 Subject: [PATCH] [#374] Add taint when Windows node pools are created to match the one GKE implicitly adds --- modules/gke-nodepool/main.tf | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/gke-nodepool/main.tf b/modules/gke-nodepool/main.tf index cdd39d090..585cbd23d 100644 --- a/modules/gke-nodepool/main.tf +++ b/modules/gke-nodepool/main.tf @@ -51,7 +51,22 @@ locals { "effect" = lookup(local.node_taint_effect, element(split(":", taint), 1)), } ] - node_taints = local.temp_node_pools_taints + # The taint is added to match the one that + # GKE implicitly adds when Windows node pools are created. + win_node_pools_taint = ( + var.node_image_type == null + ? [] + : length(regexall("WINDOWS", var.node_image_type)) > 0 + ? [ + { + "key" = "node.kubernetes.io/os" + "value" = "windows" + "effect" = local.node_taint_effect.NoSchedule + } + ] + : [] + ) + node_taints = concat(local.temp_node_pools_taints, local.win_node_pools_taint) } resource "google_service_account" "service_account" {