FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 7cb020f7 authored by Dr Rich Wareham's avatar Dr Rich Wareham
Browse files

Merge branch 'issue-12' into 'master'

Add support for minimum Cloud Run container instances (`min_scale`)

Closes #12

See merge request !14
parents 0f6fdc14 b89e30cb
No related branches found
No related tags found
1 merge request!14Add support for minimum Cloud Run container instances (`min_scale`)
Pipeline #56885 passed
......@@ -3,8 +3,9 @@ module "webapp" {
source = "git::https://gitlab.developers.cam.ac.uk/uis/devops/infra/terraform/gcp-cloud-run-app.git"
project = var.project
cloud_run_region = "europe-west1"
cloud_run_region = "europe-west2"
max_scale = 20
min_scale = 2
sql_instance_connection_name = var.sql_instance_connection_name
}
......@@ -36,6 +36,9 @@ resource "google_cloud_run_service" "webapp" {
# count for the Cloud SQL instance.
"autoscaling.knative.dev/maxScale" = var.max_scale
# Minim number of instances.
"autoscaling.knative.dev/minScale" = var.min_scale
# As mentioned at https://www.terraform.io/docs/configuration/resources.html#ignore_changes
# placeholders need to be created as the adding the key to the map is
# considered a change and not ignored by ignore_changes
......
......@@ -29,6 +29,17 @@ variable "environment_variables" {
default = {}
}
variable "min_scale" {
description = <<EOI
Minimum number of auto-scaled instances. Defaults to 0, thus, the container will stop
if it doesn't receive requests for a period of time and the following request will make
the container start from cold.
This should be carefully considered for containers that take a significant amount of
time starting from cold.
EOI
default = 0
}
variable "max_scale" {
description = "Maximum number of auto-scaled instances. For a container with N-workers, maxScale should be less than 1/N of the maximum connection count for the Cloud SQL instance."
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment