-
Notifications
You must be signed in to change notification settings - Fork 495
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
deploy/gcp: support zonal and multi-zonal cluster #809
Changes from 3 commits
4b8708e
919c7fb
e8ed70d
315b35b
c5ed1a4
c97d6e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# This will create a zonal cluster in zone us-central1-b with one additional zone. | ||
# Work nodes will be created in primary zone us-central1-b and additional zone us-central1-c. | ||
# | ||
gke_name = "multi-zonal" | ||
vpc_name = "multi-zonal" | ||
location = "us-central1-b" | ||
pd_instance_type = "n1-standard-2" | ||
tikv_instance_type = "n1-highmem-4" | ||
tidb_instance_type = "n1-standard-8" | ||
node_locations = [ | ||
"us-central1-c" | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# This will create a zonal cluster in zone us-central1-b without additional zones. | ||
# Work nodes will be created in a single zone only. | ||
# | ||
gke_name = "single-zonal" | ||
vpc_name = "single-zonal" | ||
location = "us-central1-b" | ||
pd_instance_type = "n1-standard-2" | ||
tikv_instance_type = "n1-highmem-4" | ||
tidb_instance_type = "n1-standard-8" | ||
pd_count = 3 | ||
tikv_count = 3 | ||
tidb_count = 3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
pd_instance_type = "n1-standard-2" | ||
tikv_instance_type = "n1-highmem-4" | ||
tidb_instance_type = "n1-standard-8" | ||
|
||
# specify tidb version | ||
tidb_version = "3.0.2" | ||
|
||
# override tidb cluster values | ||
override_values = <<EOF | ||
pd: | ||
hostNetwork: true | ||
tikv: | ||
resources: | ||
requests: | ||
cpu: "1" | ||
memory: 1Gi | ||
storage: 10Gi | ||
hostNetwork: true | ||
tidb: | ||
resources: | ||
requests: | ||
cpu: "1" | ||
memory: 1Gi | ||
hostNetwork: true | ||
EOF |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,17 @@ variable "GCP_PROJECT" { | |
description = "The GCP project in which to create the necessary resources" | ||
} | ||
|
||
variable "location" { | ||
description = "The GKE cluster location. If you specify a zone (such as us-central1-a), the cluster will be a zonal cluster with a single cluster master. If you specify a region (such as us-west1), the cluster will be a regional cluster with multiple masters spread across zones in the region. If not specified, the cluster will be a regional cluster in GCP_REGION." | ||
type = string | ||
} | ||
|
||
variable "node_locations" { | ||
description = "The list of zones in which the cluster's nodes should be located. These must be in the same region as the cluster zone for zonal clusters, or in the region of a regional cluster. In a multi-zonal cluster, the number of nodes specified in initial_node_count is created in all specified zones as well as the primary zone. If specified for a regional cluster, nodes will be created in only these zones." | ||
type = list(string) | ||
default = [] | ||
} | ||
|
||
variable "tidb_version" { | ||
description = "TiDB version" | ||
default = "v3.0.1" | ||
|
@@ -24,6 +35,12 @@ variable "tidb_operator_chart_version" { | |
default = "" | ||
} | ||
|
||
variable "operator_helm_values" { | ||
description = "Operator helm values" | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "create_vpc" { | ||
default = true | ||
} | ||
|
@@ -33,6 +50,12 @@ variable "gke_name" { | |
default = "tidb-cluster" | ||
} | ||
|
||
variable "gke_version" { | ||
description = "Kubernetes version to use for the GKE cluster" | ||
type = string | ||
default = "latest" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. declare it in root module to make it configurable |
||
|
||
variable "default_tidb_cluster_name" { | ||
description = "The name that will be given to the default tidb cluster created." | ||
default = "tidb-cluster" | ||
|
@@ -43,18 +66,6 @@ variable "vpc_name" { | |
default = "tidb-cluster" | ||
} | ||
|
||
variable "pd_replica_count" { | ||
default = 3 | ||
} | ||
|
||
variable "tikv_replica_count" { | ||
default = 3 | ||
} | ||
|
||
variable "tidb_replica_count" { | ||
default = 3 | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these three variables are not used anymore |
||
|
||
variable "pd_count" { | ||
description = "Number of PD nodes per availability zone" | ||
default = 1 | ||
|
@@ -80,6 +91,26 @@ variable "tikv_instance_type" {} | |
|
||
variable "tidb_instance_type" {} | ||
|
||
variable "pd_image_type" { | ||
description = "PD image type, avaiable: UBUNTU/COS" | ||
default = "COS" | ||
} | ||
|
||
variable "tidb_image_type" { | ||
description = "TiDB image type, avaiable: UBUNTU/COS" | ||
default = "COS" | ||
} | ||
|
||
variable "tikv_image_type" { | ||
description = "TiKV image type, avaiable: UBUNTU/COS" | ||
default = "COS" | ||
} | ||
|
||
variable "tikv_local_ssd_count" { | ||
description = "TiKV node pool local ssd count (cannot be changed after the node pool is created)" | ||
default = 1 | ||
} | ||
|
||
variable "monitor_instance_type" { | ||
default = "n1-standard-2" | ||
} | ||
|
@@ -92,3 +123,8 @@ variable "maintenance_window_start_time" { | |
description = "The time in HH:MM GMT format to define the start of the daily maintenance window" | ||
default = "01:00" | ||
} | ||
|
||
variable "override_values" { | ||
description = "YAML formatted values that will be passed in to the tidb-cluster helm release" | ||
default = "" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,20 @@ variable "subnetwork_name" { | |
description = "The name of the subnetwork in which to place the cluster" | ||
} | ||
|
||
variable "gcp_region" { | ||
description = "The GCP region" | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replaced by |
||
variable "gcp_project" { | ||
description = "The GCP project name" | ||
} | ||
|
||
variable "location" { | ||
description = "The GKE cluster location. If you specify a zone (such as us-central1-a), the cluster will be a zonal cluster with a single cluster master. If you specify a region (such as us-west1), the cluster will be a regional cluster with multiple masters spread across zones in the region." | ||
type = string | ||
} | ||
|
||
variable "node_locations" { | ||
description = "The list of zones in which the cluster's nodes should be located. These must be in the same region as the cluster zone for zonal clusters, or in the region of a regional cluster. In a multi-zonal cluster, the number of nodes specified in initial_node_count is created in all specified zones as well as the primary zone. If specified for a regional cluster, nodes will be created in only these zones." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of this for a single-zone cluster? Doesn't the above location variable already specify this properly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, I see, there are zonal clusters that are multi-zone clusters. I wonder why not just use the regional cluster though? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, if you need to run a multi-zone cluster, it's better to use a regional cluster. However, if users want a small cluster for testing or for low network latency between work nodes, they can use a zonal cluster and run nodes in a single zone.
Currently, in GCP, some types of machines are only available in a few zones, e.g. in region If users want to use these compute-optimized machines, they must specify |
||
type = list(string) | ||
} | ||
|
||
variable "gke_version" { | ||
description = "Kubernetes version to use for the GKE cluster" | ||
type = string | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
declare it in root module to make it configurable