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

support creating node pools for tiflash and cdc on ack #2420

Merged
merged 3 commits into from
May 11, 2020
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
6 changes: 6 additions & 0 deletions deploy/aliyun/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,10 @@ module "tidb-cluster" {
tidb_count = var.tidb_count
monitor_instance_type = var.monitor_instance_type
create_tidb_cluster_release = var.create_tidb_cluster_release
create_tiflash_node_pool = var.create_tiflash_node_pool
create_cdc_node_pool = var.create_cdc_node_pool
tiflash_count = var.tiflash_count
cdc_count = var.cdc_count
cdc_instance_type = var.cdc_instance_type
tiflash_instance_type = var.tiflash_instance_type
}
26 changes: 26 additions & 0 deletions deploy/aliyun/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,29 @@ variable "tidb_cluster_name" {
description = "The TiDB cluster name"
default = "my-cluster"
}

variable "create_tiflash_node_pool" {
description = "whether creating node pool for tiflash"
default = false
}

variable "create_cdc_node_pool" {
description = "whether creating node pool for cdc"
default = false
}

variable "tiflash_count" {
default = 2
}

variable "cdc_count" {
default = 3
}

variable "cdc_instance_type" {
default = "ecs.c5.2xlarge"
}

variable "tiflash_instance_type" {
default = "ecs.i2.2xlarge"
}
26 changes: 25 additions & 1 deletion deploy/modules/aliyun/tidb-cluster/local.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ locals {
node_labels = ""
}

tidb_cluster_worker_groups = [
tidb_cluster_worker_groups = [for group in local.tidb_cluster_worker_groups_raw : group if group.enable]
tidb_cluster_worker_groups_raw = [
{
name = "${var.cluster_name}-pd"
enable = true
instance_type = var.pd_instance_type
min_size = var.pd_count
max_size = var.pd_count
Expand All @@ -29,6 +31,7 @@ locals {
},
{
name = "${var.cluster_name}-tikv"
enable = true
instance_type = var.tikv_instance_type
min_size = var.tikv_count
max_size = var.tikv_count
Expand All @@ -38,6 +41,7 @@ locals {
},
{
name = "${var.cluster_name}-tidb"
enable = true
instance_type = var.tidb_instance_type
min_size = var.tidb_count
max_size = var.tidb_count
Expand All @@ -46,9 +50,29 @@ locals {
},
{
name = "${var.cluster_name}-monitor"
enable = true
instance_type = var.monitor_instance_type
min_size = 1
max_size = 1
},
{
name = "${var.cluster_name}-tiflash"
enable = var.create_tiflash_node_pool
instance_type = var.tiflash_instance_type
min_size = var.tiflash_count
max_size = var.tiflash_count
node_taints = "dedicated=${var.cluster_name}-tiflash:NoSchedule"
node_labels = "dedicated=${var.cluster_name}-tiflash,pingcap.com/aliyun-local-ssd=true"
post_userdata = file("${path.module}/userdata.sh")
},
{
name = "${var.cluster_name}-cdc"
enable = var.create_cdc_node_pool
instance_type = var.cdc_instance_type
min_size = var.cdc_count
max_size = var.cdc_count
node_taints = "dedicated=${var.cluster_name}-cdc:NoSchedule"
node_labels = "dedicated=${var.cluster_name}-cdc"
}
]
}
26 changes: 26 additions & 0 deletions deploy/modules/aliyun/tidb-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,29 @@ variable "create_tidb_cluster_release" {
description = "whether creating tidb-cluster helm release"
default = false
}

variable "create_tiflash_node_pool" {
description = "whether creating node pool for tiflash"
default = false
}

variable "create_cdc_node_pool" {
description = "whether creating node pool for cdc"
default = false
}

variable "tiflash_count" {
default = 2
}

variable "cdc_count" {
default = 3
}

variable "cdc_instance_type" {
default = "ecs.c5.2xlarge"
}

variable "tiflash_instance_type" {
default = "ecs.i2.2xlarge"
}
24 changes: 12 additions & 12 deletions deploy/modules/aliyun/tidb-operator/operator.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ EOS
}

data "helm_repository" "pingcap" {
provider = "helm.initial"
depends_on = ["null_resource.setup-env"]
name = "pingcap"
url = "http://charts.pingcap.org/"
provider = helm.initial
depends_on = [null_resource.setup-env]
name = "pingcap"
url = "http://charts.pingcap.org/"
}

resource "helm_release" "tidb-operator" {
provider = "helm.initial"
depends_on = ["null_resource.setup-env"]
provider = helm.initial
depends_on = [null_resource.setup-env]

repository = data.helm_repository.pingcap.name
chart = "tidb-operator"
version = var.operator_version
namespace = "tidb-admin"
name = "tidb-operator"
values = [var.operator_helm_values]
chart = "tidb-operator"
version = var.operator_version
namespace = "tidb-admin"
name = "tidb-operator"
values = [var.operator_helm_values]

set {
name = "scheduler.kubeSchedulerImageName"
name = "scheduler.kubeSchedulerImageName"
value = "registry.cn-hangzhou.aliyuncs.com/google_containers/kube-scheduler-amd64"
}
}