From aefdc4badef892336e91f93be0719a644b829e55 Mon Sep 17 00:00:00 2001 From: Michael Barroco Date: Fri, 12 Apr 2024 09:26:50 +0200 Subject: [PATCH] [terraform] propagate crdb_external_nodes (#1015) * [terraform] pass missing crdb_external_nodes * add workspace_location to google deployments' --- .../dependencies/terraform-commons-dss/main.tf | 9 +++++++-- deploy/infrastructure/modules/terraform-aws-dss/main.tf | 1 + .../infrastructure/modules/terraform-google-dss/main.tf | 1 + .../modules/terraform-google-dss/output.tf | 7 ++++++- deploy/operations/ci/aws-1/main.tf | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/deploy/infrastructure/dependencies/terraform-commons-dss/main.tf b/deploy/infrastructure/dependencies/terraform-commons-dss/main.tf index c14fdd9a9..95429b9fa 100644 --- a/deploy/infrastructure/dependencies/terraform-commons-dss/main.tf +++ b/deploy/infrastructure/dependencies/terraform-commons-dss/main.tf @@ -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" { @@ -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}" diff --git a/deploy/infrastructure/modules/terraform-aws-dss/main.tf b/deploy/infrastructure/modules/terraform-aws-dss/main.tf index 7073c7ca4..eb3cf4b42 100644 --- a/deploy/infrastructure/modules/terraform-aws-dss/main.tf +++ b/deploy/infrastructure/modules/terraform-aws-dss/main.tf @@ -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 diff --git a/deploy/infrastructure/modules/terraform-google-dss/main.tf b/deploy/infrastructure/modules/terraform-google-dss/main.tf index cfddfea38..1d58ca9d8 100644 --- a/deploy/infrastructure/modules/terraform-google-dss/main.tf +++ b/deploy/infrastructure/modules/terraform-google-dss/main.tf @@ -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 diff --git a/deploy/infrastructure/modules/terraform-google-dss/output.tf b/deploy/infrastructure/modules/terraform-google-dss/output.tf index d9df9bcd4..7be13880f 100644 --- a/deploy/infrastructure/modules/terraform-google-dss/output.tf +++ b/deploy/infrastructure/modules/terraform-google-dss/output.tf @@ -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 -} \ No newline at end of file +} + diff --git a/deploy/operations/ci/aws-1/main.tf b/deploy/operations/ci/aws-1/main.tf index 46aadff74..9358b15f2 100644 --- a/deploy/operations/ci/aws-1/main.tf +++ b/deploy/operations/ci/aws-1/main.tf @@ -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