Skip to content

Commit

Permalink
Adds monitor node count variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jlerche committed May 17, 2019
1 parent f014b19 commit 042a114
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion deploy/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ resource "google_container_node_pool" "monitor_pool" {
cluster = "${google_container_cluster.cluster.name}"
location = "${google_container_cluster.cluster.location}"
name = "monitor-pool"
initial_node_count = "1"
initial_node_count = "${var.monitor_count}"

node_config {
machine_type = "${var.monitor_instance_type}"
Expand Down Expand Up @@ -251,12 +251,15 @@ resource "null_resource" "get-credentials" {
KUBECONFIG = "${local.kubeconfig}"
}
}

provisioner "local-exec" {
when = "destroy"

command = <<EOS
kubectl get pvc -n tidb -o jsonpath='{.items[*].spec.volumeName}'|fmt -1 | xargs -I {} kubectl patch pv {} -p '{"spec":{"persistentVolumeReclaimPolicy":"Delete"}}'
kubectl delete namespace tidb
EOS

environment {
KUBECONFIG = "${local.kubeconfig}"
}
Expand Down
5 changes: 5 additions & 0 deletions deploy/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ variable "tidb_count" {
default = 1
}

variable "monitor_count" {
description = "Number of monitor nodes per availability zone"
default = 1
}

variable "pd_instance_type" {
default = "n1-standard-4"
}
Expand Down

0 comments on commit 042a114

Please sign in to comment.