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

[terraform] Explicitly set CRDB version in terraform examples and tooling #1080

Merged
merged 6 commits into from
Aug 29, 2024
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
locals {
rid_db_schema = var.desired_rid_db_version == "latest" ? "4.0.0" : var.desired_rid_db_version
scd_db_schema = var.desired_scd_db_version == "latest" ? "3.1.0" : var.desired_scd_db_version
image = var.image
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ resource "local_file" "helm_chart_values" {
filename = "${local.workspace_location}/helm_values.yml"
content = yamlencode({
cockroachdb = {
image = {
tag = var.crdb_image_tag
}
fullnameOverride = local.helm_crdb_statefulset_name

conf = {
Expand Down Expand Up @@ -50,7 +53,7 @@ resource "local_file" "helm_chart_values" {
}

dss = {
image = local.image
image = var.image

conf = {
pubKeys = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ resource "local_file" "tanka_config_main" {
VAR_INGRESS_NAME = var.ip_gateway
VAR_CRDB_EXTERNAL_NODES = join(",", [for a in var.crdb_external_nodes : "'${a}'"])
VAR_STORAGE_CLASS = var.kubernetes_storage_class
VAR_DOCKER_IMAGE_NAME = local.image
VAR_DOCKER_IMAGE_NAME = var.image
VAR_CRDB_DOCKER_IMAGE_NAME = "cockroachdb/cockroach:${var.crdb_image_tag}"
VAR_APP_HOSTNAME = var.app_hostname
VAR_PUBLIC_KEY_PEM_PATH = var.authorization.public_key_pem_path != null ? var.authorization.public_key_pem_path : ""
VAR_JWKS_ENDPOINT = var.authorization.jwks != null ? var.authorization.jwks.endpoint : ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local metadata = metadataBase {
single_cluster: false,
enableScd: ${VAR_ENABLE_SCD}, // <-- This boolean value is VAR_ENABLE_SCD
cockroach+: {
image: '${VAR_CRDB_DOCKER_IMAGE_NAME}',
hostnameSuffix: '${VAR_CRDB_HOSTNAME_SUFFIX}',
locality: '${VAR_CRDB_LOCALITY}',
nodeIPs: [${VAR_CRDB_NODE_IPS}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ variable "desired_scd_db_version" {
default = "latest"
}

variable "crdb_image_tag" {
type = string
description = <<-EOT
Version tag of the CockroachDB image.
Until v.16, the recommended CockroachDB version is v21.2.7.
From v.17, the recommended CockroachDB version is v24.1.3.

Example: v24.1.3
EOT
}


variable "crdb_cluster_name" {
type = string
description = <<-EOT
Expand Down
11 changes: 11 additions & 0 deletions deploy/infrastructure/modules/terraform-aws-dss/TFVARS.gen.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,17 @@ Use `latest` to use the latest schema version.
Example: `3.1.0`


### crdb_image_tag

*Type: `string`*

Version tag of the CockroachDB image.
Until v.16, the recommended CockroachDB version is v21.2.7.
From v.17, the recommended CockroachDB version is v24.1.3.

Example: v24.1.3


### crdb_cluster_name

*Type: `string`*
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 @@ -20,6 +20,7 @@ module "terraform-commons-dss" {
kubernetes_namespace = var.kubernetes_namespace
kubernetes_storage_class = var.aws_kubernetes_storage_class
app_hostname = var.app_hostname
crdb_image_tag = var.crdb_image_tag
crdb_cluster_name = var.crdb_cluster_name
crdb_hostname_suffix = var.crdb_hostname_suffix
should_init = var.should_init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ authorization = {
should_init = true

# CockroachDB
crdb_image_tag = "v21.2.7"
crdb_cluster_name = "interuss_example"
crdb_locality = "interuss_dss-aws-ew1"
crdb_external_nodes = []
12 changes: 12 additions & 0 deletions deploy/infrastructure/modules/terraform-aws-dss/variables.gen.tf
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,18 @@ variable "desired_scd_db_version" {
default = "latest"
}

variable "crdb_image_tag" {
type = string
description = <<-EOT
Version tag of the CockroachDB image.
Until v.16, the recommended CockroachDB version is v21.2.7.
From v.17, the recommended CockroachDB version is v24.1.3.

Example: v24.1.3
EOT
}


variable "crdb_cluster_name" {
type = string
description = <<-EOT
Expand Down
11 changes: 11 additions & 0 deletions deploy/infrastructure/modules/terraform-google-dss/TFVARS.gen.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,17 @@ Use `latest` to use the latest schema version.
Example: `3.1.0`


### crdb_image_tag

*Type: `string`*

Version tag of the CockroachDB image.
Until v.16, the recommended CockroachDB version is v21.2.7.
From v.17, the recommended CockroachDB version is v24.1.3.

Example: v24.1.3


### crdb_cluster_name

*Type: `string`*
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 @@ -19,6 +19,7 @@ module "terraform-commons-dss" {
kubernetes_namespace = var.kubernetes_namespace
kubernetes_storage_class = var.google_kubernetes_storage_class
app_hostname = var.app_hostname
crdb_image_tag = var.crdb_image_tag
crdb_cluster_name = var.crdb_cluster_name
crdb_hostname_suffix = var.crdb_hostname_suffix
should_init = var.should_init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ authorization = {
should_init = true

# CockroachDB
crdb_image_tag = "v21.2.7"
crdb_cluster_name = "interuss_example"
crdb_locality = "interuss_dss-dev-w6a"
crdb_external_nodes = []
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,18 @@ variable "desired_scd_db_version" {
default = "latest"
}

variable "crdb_image_tag" {
type = string
description = <<-EOT
Version tag of the CockroachDB image.
Until v.16, the recommended CockroachDB version is v21.2.7.
From v.17, the recommended CockroachDB version is v24.1.3.

Example: v24.1.3
EOT
}


variable "crdb_cluster_name" {
type = string
description = <<-EOT
Expand Down
1 change: 1 addition & 0 deletions deploy/infrastructure/utils/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"should_init",
"desired_rid_db_version",
"desired_scd_db_version",
"crdb_image_tag",
"crdb_cluster_name",
"crdb_locality",
"crdb_external_nodes",
Expand Down
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 @@ -17,6 +17,7 @@ module "terraform-aws-dss" {
aws_region = var.aws_region
aws_route53_zone_id = var.aws_route53_zone_id
cluster_name = var.cluster_name
crdb_image_tag = var.crdb_image_tag
crdb_cluster_name = var.crdb_cluster_name
crdb_hostname_suffix = var.crdb_hostname_suffix
crdb_locality = var.crdb_locality
Expand Down
1 change: 1 addition & 0 deletions deploy/operations/ci/aws-1/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ authorization = {
public_key_pem_path = "/test-certs/auth2.pem"
}
should_init = true
crdb_image_tag = "v21.2.7"
crdb_cluster_name = "interuss-ci"
crdb_locality = "interuss_dss-ci-aws-ue1"
crdb_external_nodes = []
Expand Down
12 changes: 12 additions & 0 deletions deploy/operations/ci/aws-1/variables.gen.tf
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,18 @@ variable "desired_scd_db_version" {
default = "latest"
}

variable "crdb_image_tag" {
type = string
description = <<-EOT
Version tag of the CockroachDB image.
Until v.16, the recommended CockroachDB version is v21.2.7.
From v.17, the recommended CockroachDB version is v24.1.3.

Example: v24.1.3
EOT
}


variable "crdb_cluster_name" {
type = string
description = <<-EOT
Expand Down
Loading