Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sets node count for default pool equal to total desired node count to correctly size master #673

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions deploy/gcp/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
17 changes: 9 additions & 8 deletions deploy/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -389,7 +390,7 @@ resource "null_resource" "deploy-tidb-cluster" {

provisioner "local-exec" {
interpreter = ["bash", "-c"]
command = <<EOS
command = <<EOS
set -euo pipefail

helm upgrade --install tidb-cluster ${path.module}/charts/tidb-cluster --namespace=tidb -f ${local.tidb_cluster_values_path}
Expand Down
2 changes: 1 addition & 1 deletion deploy/gcp/prod.tfvars
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pd_instance_type = "n1-standard-4"
pd_instance_type = "n1-standard-4"
tikv_instance_type = "n1-highmem-8"
tidb_instance_type = "n1-standard-16"
2 changes: 1 addition & 1 deletion deploy/gcp/small.tfvars
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pd_instance_type = "n1-standard-2"
pd_instance_type = "n1-standard-2"
tikv_instance_type = "n1-highmem-4"
tidb_instance_type = "n1-standard-8"
6 changes: 3 additions & 3 deletions deploy/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ variable "monitor_count" {
description = "Number of monitor nodes per availability zone"
default = 1
}
variable "pd_instance_type" { }
variable "pd_instance_type" {}

variable "tikv_instance_type" { }
variable "tikv_instance_type" {}

variable "tidb_instance_type" { }
variable "tidb_instance_type" {}

variable "monitor_instance_type" {
default = "n1-standard-2"
Expand Down