Skip to content

Commit

Permalink
ci: Read Spanner processing units from GitHub environment
Browse files Browse the repository at this point in the history
Different Halo test environments have different Spanner resource needs. For example, the `head` environment tends to have much lower traffic compared to the `qa` environment. Spanner autoscaling only supports whole nodes (multiples of 1000 processing units), whereas some test environments are often idle and do not need a whole node. Spanner nodes are relatively expensive (currently $657/month for the us-central1 region).

This also removes the specification of 100 processing nodes for the example Terraform configuration, as that is far below Spanner recommendations.
  • Loading branch information
SanjayVas committed Oct 14, 2024
1 parent 19c24c8 commit 534555c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/terraform-cmms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
env:
KEY_RING: ${{ vars.KEY_RING }}
SPANNER_INSTANCE: ${{ vars.SPANNER_INSTANCE }}
SPANNER_PROCESSING_UNITS: ${{ vars.SPANNER_PROCESSING_UNITS }}
STORAGE_BUCKET: ${{ vars.STORAGE_BUCKET }}
POSTGRES_INSTANCE: ${{ vars.POSTGRES_INSTANCE }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
Expand All @@ -86,6 +87,7 @@ jobs:
-input=false
-var="key_ring_name=$KEY_RING"
-var="spanner_instance_name=$SPANNER_INSTANCE"
-var="spanner_processing_units=$SPANNER_PROCESSING_UNITS"
-var="storage_bucket_name=$STORAGE_BUCKET"
-var="postgres_instance_name=$POSTGRES_INSTANCE"
-var="postgres_password=$POSTGRES_PASSWORD"
Expand Down
7 changes: 3 additions & 4 deletions src/main/terraform/gcloud/examples/duchy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ module "common" {
}

resource "google_spanner_instance" "spanner_instance" {
name = var.spanner_instance_name
config = var.spanner_instance_config
display_name = "Halo CMMS"
processing_units = 100
name = var.spanner_instance_name
config = var.spanner_instance_config
display_name = "Halo CMMS"
}

module "storage" {
Expand Down
7 changes: 3 additions & 4 deletions src/main/terraform/gcloud/examples/kingdom/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ module "common" {
}

resource "google_spanner_instance" "spanner_instance" {
name = var.spanner_instance_name
config = var.spanner_instance_config
display_name = "Halo CMMS"
processing_units = 100
name = var.spanner_instance_name
config = var.spanner_instance_config
display_name = "Halo CMMS"
}

module "kingdom_cluster" {
Expand Down

0 comments on commit 534555c

Please sign in to comment.