Skip to content

Commit

Permalink
Small fixes for terraform aws (#646)
Browse files Browse the repository at this point in the history
- fix hardcode chart version
- fix unreachable bastion
- adjust tidb-cluster no-wait to avoid scheduled backup pvc blocking
- add version check
- disable pd node public_ip

Signed-off-by: Aylei <rayingecho@gmail.com>
  • Loading branch information
aylei authored Jul 10, 2019
1 parent 7f62e27 commit 4001039
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion deploy/aws/bastion.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ module "ec2" {
monitoring = false
user_data = file("bastion-userdata")
vpc_security_group_ids = [aws_security_group.ssh.id]
subnet_ids = local.default_subnets
subnet_ids = split(
",",
var.create_vpc ? join(",", module.vpc.public_subnets) : join(",", var.subnets),
)
}
2 changes: 1 addition & 1 deletion deploy/aws/clusters.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "local_file" "kubeconfig" {
# The helm provider for TiDB clusters must be configured in the top level, otherwise removing clusters will failed due to
# the helm provider configuration is removed too.
provider "helm" {
alias = "eks"
alias = "eks"
insecure = true
# service_account = "tiller"
install_tiller = false # currently this doesn't work, so we install tiller in the local-exec provisioner. See https://github.com/terraform-providers/terraform-provider-helm/issues/148
Expand Down
1 change: 1 addition & 0 deletions deploy/aws/tidb-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ resource "helm_release" "tidb-cluster" {
version = var.tidb_cluster_chart_version
namespace = var.cluster_name
name = var.cluster_name
wait = false

values = [
file("${path.module}/values/default.yaml"),
Expand Down
2 changes: 1 addition & 1 deletion deploy/aws/tidb-cluster/local.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ locals {
key_name = var.ssh_key_name
instance_type = var.pd_instance_type
root_volume_size = "50"
public_ip = true
public_ip = false
kubelet_extra_args = "--register-with-taints=dedicated=${var.cluster_name}-pd:NoSchedule --node-labels=dedicated=${var.cluster_name}-pd,pingcap.com/aws-local-ssd=true"
asg_desired_capacity = var.pd_count
asg_max_size = var.pd_count + 2
Expand Down
6 changes: 3 additions & 3 deletions deploy/aws/tidb-operator/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resource "local_file" "kubeconfig" {
}

provider "helm" {
alias = "initial"
alias = "initial"
insecure = true
# service_account = "tiller"
install_tiller = false # currently this doesn't work, so we install tiller in the local-exec provisioner. See https://github.com/terraform-providers/terraform-provider-helm/issues/148
Expand All @@ -49,8 +49,8 @@ resource "null_resource" "setup-env" {
working_dir = path.module
command = <<EOS
echo "${local_file.kubeconfig.sensitive_content}" > kube_config.yaml
kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/v1.0.0-beta.3/manifests/crd.yaml
kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/v1.0.0-beta.3/manifests/tiller-rbac.yaml
kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/${var.operator_version}/manifests/crd.yaml
kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/${var.operator_version}/manifests/tiller-rbac.yaml
kubectl apply -f manifests/local-volume-provisioner.yaml
kubectl apply -f manifests/gp2-storageclass.yaml
helm init --service-account tiller --upgrade --wait
Expand Down
4 changes: 4 additions & 0 deletions deploy/aws/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}

0 comments on commit 4001039

Please sign in to comment.