Skip to content

Commit

Permalink
[terraform] propagate crdb_external_nodes (#1015)
Browse files Browse the repository at this point in the history
* [terraform] pass missing crdb_external_nodes

* add workspace_location to google deployments'
  • Loading branch information
barroco authored Apr 12, 2024
1 parent 8e3f849 commit aefdc4b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ locals {
workspace_folder = replace(replace(var.kubernetes_context_name, "/", "_"), ":", "_")
# Replace ':' and '/' characters from folder name by underscores. Those characters are used by AWS for contexts.
workspace_location = abspath("${path.module}/../../../../build/workspace/${local.workspace_folder}")

# Tanka defines itself the variables below. For helm, since we are using the official helm CRDB chart,
# the following has to be provided and constructed here.
helm_crdb_statefulset_name = "dss-cockroachdb"
helm_nodes_to_join = concat(["${local.helm_crdb_statefulset_name}-0.${local.helm_crdb_statefulset_name}"], var.crdb_external_nodes)
}

resource "local_file" "tanka_config_main" {
Expand Down Expand Up @@ -72,10 +77,10 @@ resource "local_file" "helm_chart_values" {
filename = "${local.workspace_location}/helm_values.yml"
content = yamlencode({
cockroachdb = {
fullnameOverride = "dss-cockroachdb"
fullnameOverride = local.helm_crdb_statefulset_name

conf = {
join = var.crdb_external_nodes
join = local.helm_nodes_to_join
cluster-name = "dss-aws-1"
single-node = false
locality = "zone=${var.crdb_locality}"
Expand Down
1 change: 1 addition & 0 deletions deploy/infrastructure/modules/terraform-aws-dss/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module "terraform-commons-dss" {
should_init = var.should_init
authorization = var.authorization
crdb_locality = var.crdb_locality
crdb_external_nodes = var.crdb_external_nodes
crdb_internal_nodes = module.terraform-aws-kubernetes.crdb_nodes
ip_gateway = module.terraform-aws-kubernetes.ip_gateway
kubernetes_api_endpoint = module.terraform-aws-kubernetes.kubernetes_api_endpoint
Expand Down
1 change: 1 addition & 0 deletions deploy/infrastructure/modules/terraform-google-dss/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module "terraform-commons-dss" {
authorization = var.authorization
crdb_locality = var.crdb_locality
image_pull_secret = var.image_pull_secret
crdb_external_nodes = var.crdb_external_nodes
kubernetes_api_endpoint = module.terraform-google-kubernetes.kubernetes_api_endpoint
crdb_internal_nodes = module.terraform-google-kubernetes.crdb_nodes
ip_gateway = module.terraform-google-kubernetes.ip_gateway
Expand Down
7 changes: 6 additions & 1 deletion deploy/infrastructure/modules/terraform-google-dss/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ output "generated_files_location" {
value = module.terraform-commons-dss.generated_files_location
}

output "workspace_location" {
value = module.terraform-commons-dss.workspace_location
}

output "cluster_context" {
value = module.terraform-google-kubernetes.kubernetes_context_name
}
}

1 change: 1 addition & 0 deletions deploy/operations/ci/aws-1/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module "terraform-aws-dss" {
cluster_name = var.cluster_name
crdb_hostname_suffix = var.crdb_hostname_suffix
crdb_locality = var.crdb_locality
crdb_external_nodes = var.crdb_external_nodes
image = var.image
kubernetes_version = var.kubernetes_version
node_count = 3
Expand Down

0 comments on commit aefdc4b

Please sign in to comment.