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

Gke terraform upgrade to 0.12 and fix bastion instance zone to be region agnostic #554

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 1 addition & 3 deletions deploy/gcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This document describes how to deploy TiDB Operator and a TiDB cluster on GCP GK
First of all, make sure the following items are installed on your machine:

* [Google Cloud SDK](https://cloud.google.com/sdk/install)
* [terraform](https://www.terraform.io/downloads.html)
* [terraform](https://www.terraform.io/downloads.html) >= 0.12
* [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl) >= 1.11
* [helm](https://github.com/helm/helm/blob/master/docs/install.md#installing-the-helm-client) >= 2.9.0
* [jq](https://stedolan.github.io/jq/download/)
Expand Down Expand Up @@ -236,5 +236,3 @@ terraform destroy
You have to manually delete disks in the Google Cloud Console, or with `gcloud` after running `terraform destroy` if you do not need the data anymore.

> *Note*: When `terraform destroy` is running, an error with the following message might occur: `Error reading Container Cluster "my-cluster": Cluster "my-cluster" has status "RECONCILING" with message""`. This happens when GCP is upgrading the kubernetes master node, which it does automatically at times. While this is happening, it is not possible to delete the cluster. When it is done, run `terraform destroy` again.

> *Note*: When `terraform destroy` is running, an error with the following message might occur: `Error deleting NodePool: googleapi: Error 400: Operation operation-1558952543255-89695179 is currently deleting a node pool for cluster my-cluster. Please wait and try again once it is done., failedPrecondition`. This happens when terraform issues delete requests to cluster resources concurrently. To resolve, wait a little bit and then run `terraform destroy` again.
28 changes: 17 additions & 11 deletions deploy/gcp/data.tf
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
data "template_file" "tidb_cluster_values" {
template = "${file("${path.module}/templates/tidb-cluster-values.yaml.tpl")}"
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}"
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
}
}

data external "available_zones_in_region" {
depends_on = [null_resource.prepare-dir]
program = ["bash", "-c", "gcloud compute regions describe ${var.GCP_REGION} --format=json | jq '{zone: .zones|.[0]|match(\"[^/]*$\"; \"g\")|.string}'"]
}

data "external" "tidb_ilb_ip" {
depends_on = ["null_resource.deploy-tidb-cluster"]
depends_on = [null_resource.deploy-tidb-cluster]
program = ["bash", "-c", "kubectl --kubeconfig ${local.kubeconfig} get svc -n tidb tidb-cluster-tidb -o json | jq '.status.loadBalancer.ingress[0]'"]
}

data "external" "monitor_ilb_ip" {
depends_on = ["null_resource.deploy-tidb-cluster"]
depends_on = [null_resource.deploy-tidb-cluster]
program = ["bash", "-c", "kubectl --kubeconfig ${local.kubeconfig} get svc -n tidb tidb-cluster-grafana -o json | jq '.status.loadBalancer.ingress[0]'"]
}

data "external" "tidb_port" {
depends_on = ["null_resource.deploy-tidb-cluster"]
depends_on = [null_resource.deploy-tidb-cluster]
program = ["bash", "-c", "kubectl --kubeconfig ${local.kubeconfig} get svc -n tidb tidb-cluster-tidb -o json | jq '.spec.ports | .[] | select( .name == \"mysql-client\") | {port: .port|tostring}'"]
}

data "external" "monitor_port" {
depends_on = ["null_resource.deploy-tidb-cluster"]
depends_on = [null_resource.deploy-tidb-cluster]
program = ["bash", "-c", "kubectl --kubeconfig ${local.kubeconfig} get svc -n tidb tidb-cluster-grafana -o json | jq '.spec.ports | .[] | select( .name == \"grafana\") | {port: .port|tostring}'"]
}

Loading