From 93300cc6606b674db9e035d669a8619868ac8a36 Mon Sep 17 00:00:00 2001 From: Amy Brown Date: Wed, 25 Sep 2019 16:28:29 -0500 Subject: [PATCH 1/3] Hard code the number of primaries Due to some issues around scaling in internal production mode, the number of primaries should be locked down to 3. Scaling of the cluster beyond that should happen via secondaries. --- primary.tf | 2 +- secondary.tf | 1 - variables.tf | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/primary.tf b/primary.tf index 85d1de7b..b4e05add 100644 --- a/primary.tf +++ b/primary.tf @@ -1,5 +1,5 @@ resource "google_compute_instance" "primary" { - count = "${var.primary_count}" + count = "3" name = "${var.prefix}-primary-${count.index}" machine_type = "${var.primary_machine_type}" zone = "${var.zone}" diff --git a/secondary.tf b/secondary.tf index 37b397cc..a83ead0a 100644 --- a/secondary.tf +++ b/secondary.tf @@ -16,7 +16,6 @@ resource "google_compute_region_instance_group_manager" "secondary" { base_instance_name = "${var.prefix}-secondary" instance_template = "${module.instance-template.secondary_template}" - update_strategy = "NONE" region = "${var.region}" target_size = "${var.secondary_count}" diff --git a/variables.tf b/variables.tf index 2b34ad92..0a35f111 100644 --- a/variables.tf +++ b/variables.tf @@ -167,8 +167,8 @@ variable "image_family" { variable "primary_count" { type = "string" - description = "Number of primary nodes to run, must be odd number" - default = "1" + description = "Currently unused. Must have 3 primary nodes." + default = "3" } variable "prefix" { From 52d5bd9a9253ffe62e380773f5ce128e45f21d49 Mon Sep 17 00:00:00 2001 From: Amy Brown Date: Wed, 25 Sep 2019 16:39:36 -0500 Subject: [PATCH 2/3] slight adjustment Since internal production mode is the only mode with a scaling issue, force primary count to 3 only when mode is set to that, otherwise accept the variable value. --- primary.tf | 2 +- variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/primary.tf b/primary.tf index b4e05add..04f18036 100644 --- a/primary.tf +++ b/primary.tf @@ -1,5 +1,5 @@ resource "google_compute_instance" "primary" { - count = "3" + count = "${var.install_type == "ipm" ? 3 : var.primary_count}" name = "${var.prefix}-primary-${count.index}" machine_type = "${var.primary_machine_type}" zone = "${var.zone}" diff --git a/variables.tf b/variables.tf index 0a35f111..18f6350b 100644 --- a/variables.tf +++ b/variables.tf @@ -167,7 +167,7 @@ variable "image_family" { variable "primary_count" { type = "string" - description = "Currently unused. Must have 3 primary nodes." + description = "Number of primary nodes to run, must be odd number - 3 or 5 recommended." default = "3" } From ead36b5f8c661359aab37988a731a22cf1790df4 Mon Sep 17 00:00:00 2001 From: Amy Brown Date: Fri, 27 Sep 2019 10:08:43 -0500 Subject: [PATCH 3/3] Added comment re primary_count Added an explanation around the count line of the primary instance resource --- primary.tf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/primary.tf b/primary.tf index 04f18036..6b1db87e 100644 --- a/primary.tf +++ b/primary.tf @@ -1,4 +1,7 @@ resource "google_compute_instance" "primary" { + /* The number of primaries must be hard coded to 3 when Internal Production Mode + is selected. Currently, that mode does not support scaling. In other modes, the + cluster can be scaled according the primary_count variable. */ count = "${var.install_type == "ipm" ? 3 : var.primary_count}" name = "${var.prefix}-primary-${count.index}" machine_type = "${var.primary_machine_type}"