From 56d0b9eae4ac0ee15a2aead14e5d39bb89e12dad Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Sat, 20 Jul 2019 16:51:29 -0700 Subject: [PATCH] Avoid creating extraneous GCE controller instance groups * Intended as part of #504 improvement * Single controller clusters only require one controller instance group (previously created zone-many) * Multi-controller clusters must "wrap" controllers over zonal heterogeneous instance groups. For example, 5 controllers over 3 zones (no change) --- google-cloud/container-linux/kubernetes/apiserver.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud/container-linux/kubernetes/apiserver.tf b/google-cloud/container-linux/kubernetes/apiserver.tf index b06ecf70..318d9c1f 100644 --- a/google-cloud/container-linux/kubernetes/apiserver.tf +++ b/google-cloud/container-linux/kubernetes/apiserver.tf @@ -57,7 +57,7 @@ resource "google_compute_backend_service" "apiserver" { # Instance group of heterogeneous (unmanged) controller instances resource "google_compute_instance_group" "controllers" { - count = length(local.zones) + count = min(var.controller_count, length(local.zones)) name = format("%s-controllers-%s", var.cluster_name, element(local.zones, count.index)) zone = element(local.zones, count.index)