From ab6d93c30ddd23610b88223f989678891faf060a Mon Sep 17 00:00:00 2001 From: Jacob Lerche Date: Fri, 19 Jul 2019 16:08:28 -0700 Subject: [PATCH] Sets node count for default pool equal to total desired node count to correctly size master node --- deploy/gcp/data.tf | 12 ++++++------ deploy/gcp/main.tf | 17 +++++++++-------- deploy/gcp/prod.tfvars | 2 +- deploy/gcp/small.tfvars | 2 +- deploy/gcp/variables.tf | 6 +++--- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/deploy/gcp/data.tf b/deploy/gcp/data.tf index 3eda2d68728..0e760bfbd96 100644 --- a/deploy/gcp/data.tf +++ b/deploy/gcp/data.tf @@ -2,16 +2,16 @@ data "template_file" "tidb_cluster_values" { template = file("${path.module}/templates/tidb-cluster-values.yaml.tpl") vars = { - cluster_version = var.tidb_version - pd_replicas = var.pd_replica_count - tikv_replicas = var.tikv_replica_count - tidb_replicas = var.tidb_replica_count - operator_version = var.tidb_operator_version + cluster_version = var.tidb_version + pd_replicas = var.pd_replica_count + tikv_replicas = var.tikv_replica_count + tidb_replicas = var.tidb_replica_count + operator_version = var.tidb_operator_version tidb_operator_registry = var.tidb_operator_registry } } -data "google_compute_zones" "available" { } +data "google_compute_zones" "available" {} data "external" "tidb_ilb_ip" { depends_on = [null_resource.deploy-tidb-cluster] diff --git a/deploy/gcp/main.tf b/deploy/gcp/main.tf index bded06a24f8..6ca68bd9618 100644 --- a/deploy/gcp/main.tf +++ b/deploy/gcp/main.tf @@ -100,7 +100,8 @@ resource "google_container_cluster" "cluster" { } remove_default_node_pool = true - initial_node_count = 1 + // see https://github.com/terraform-providers/terraform-provider-google/issues/3385 for why initial_node_count is sum of node counts + initial_node_count = var.pd_count + var.tikv_count + var.tidb_count + var.monitor_count min_master_version = "latest" @@ -126,7 +127,7 @@ resource "google_container_node_pool" "pd_pool" { initial_node_count = var.pd_count management { - auto_repair = false + auto_repair = false auto_upgrade = false } @@ -158,13 +159,13 @@ resource "google_container_node_pool" "tikv_pool" { initial_node_count = var.tikv_count management { - auto_repair = false + auto_repair = false auto_upgrade = false } node_config { - machine_type = var.tikv_instance_type - image_type = "UBUNTU" + machine_type = var.tikv_instance_type + image_type = "UBUNTU" // This value cannot be changed (instead a new node pool is needed) // 1 SSD is 375 GiB local_ssd_count = 1 @@ -195,7 +196,7 @@ resource "google_container_node_pool" "tidb_pool" { initial_node_count = var.tidb_count management { - auto_repair = false + auto_repair = false auto_upgrade = false } @@ -228,7 +229,7 @@ resource "google_container_node_pool" "monitor_pool" { initial_node_count = var.monitor_count management { - auto_repair = false + auto_repair = false auto_upgrade = false } @@ -389,7 +390,7 @@ resource "null_resource" "deploy-tidb-cluster" { provisioner "local-exec" { interpreter = ["bash", "-c"] -command = <