From 9f8be4c6f7309f7181d4de442e32d87f012e3df8 Mon Sep 17 00:00:00 2001 From: Joseph Sirianni Date: Sun, 22 Mar 2020 01:13:56 -0400 Subject: [PATCH 1/2] add option to enable vertical pod autoscaling --- modules/gke-cluster/main.tf | 4 ++++ modules/gke-cluster/variables.tf | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/gke-cluster/main.tf b/modules/gke-cluster/main.tf index 7f68546..9cfff53 100644 --- a/modules/gke-cluster/main.tf +++ b/modules/gke-cluster/main.tf @@ -93,6 +93,10 @@ resource "google_container_cluster" "cluster" { provider = "CALICO" } + vertical_pod_autoscaling { + enabled = var.enable_vertical_pod_autoscaling + } + master_auth { username = var.basic_auth_username password = var.basic_auth_password diff --git a/modules/gke-cluster/variables.tf b/modules/gke-cluster/variables.tf index 167ebec..fec621a 100644 --- a/modules/gke-cluster/variables.tf +++ b/modules/gke-cluster/variables.tf @@ -108,7 +108,6 @@ variable "master_authorized_networks_config" { display_name = "example_network" }], }] - EOF type = list(any) default = [] @@ -197,3 +196,10 @@ variable "secrets_encryption_kms_key" { type = string default = null } + +# See https://cloud.google.com/kubernetes-engine/docs/concepts/verticalpodautoscaler +variable "enable_vertical_pod_autoscaling" { + description = "Whether to enable Vertical Pod Autoscaling" + type = string + default = false +} From bd0cc7cfcf56734ae527efe470a42508c08b7c13 Mon Sep 17 00:00:00 2001 From: Joseph Sirianni Date: Sun, 22 Mar 2020 01:14:25 -0400 Subject: [PATCH 2/2] add option to enable vertical pod autoscaling to gke test clusters --- examples/gke-private-cluster/main.tf | 2 ++ examples/gke-private-cluster/variables.tf | 6 ++++++ examples/gke-public-cluster/main.tf | 2 ++ examples/gke-public-cluster/variables.tf | 6 ++++++ 4 files changed, 16 insertions(+) diff --git a/examples/gke-private-cluster/main.tf b/examples/gke-private-cluster/main.tf index ee2e7d6..eac92c5 100644 --- a/examples/gke-private-cluster/main.tf +++ b/examples/gke-private-cluster/main.tf @@ -69,6 +69,8 @@ module "gke_cluster" { ] cluster_secondary_range_name = module.vpc_network.public_subnetwork_secondary_range_name + + enable_vertical_pod_autoscaling = var.enable_vertical_pod_autoscaling } # --------------------------------------------------------------------------------------------------------------------- diff --git a/examples/gke-private-cluster/variables.tf b/examples/gke-private-cluster/variables.tf index c4d67d2..4d73a28 100644 --- a/examples/gke-private-cluster/variables.tf +++ b/examples/gke-private-cluster/variables.tf @@ -62,3 +62,9 @@ variable "vpc_secondary_cidr_block" { type = string default = "10.4.0.0/16" } + +variable "enable_vertical_pod_autoscaling" { + description = "Enable vertical pod autoscaling" + type = string + default = true +} diff --git a/examples/gke-public-cluster/main.tf b/examples/gke-public-cluster/main.tf index 69fcd8f..e1743a8 100644 --- a/examples/gke-public-cluster/main.tf +++ b/examples/gke-public-cluster/main.tf @@ -50,6 +50,8 @@ module "gke_cluster" { cluster_secondary_range_name = module.vpc_network.public_subnetwork_secondary_range_name alternative_default_service_account = var.override_default_node_pool_service_account ? module.gke_service_account.email : null + + enable_vertical_pod_autoscaling = var.enable_vertical_pod_autoscaling } # --------------------------------------------------------------------------------------------------------------------- diff --git a/examples/gke-public-cluster/variables.tf b/examples/gke-public-cluster/variables.tf index d285022..831a084 100644 --- a/examples/gke-public-cluster/variables.tf +++ b/examples/gke-public-cluster/variables.tf @@ -57,6 +57,12 @@ variable "vpc_secondary_cidr_block" { default = "10.7.0.0/16" } +variable "enable_vertical_pod_autoscaling" { + description = "Enable vertical pod autoscaling" + type = string + default = true +} + # --------------------------------------------------------------------------------------------------------------------- # TEST PARAMETERS # These parameters are only used during testing and should not be touched.