From a83a2a9c67b45bb7984f84268d6c102348d330b8 Mon Sep 17 00:00:00 2001 From: jarpat Date: Tue, 20 Feb 2024 14:15:52 -0500 Subject: [PATCH 1/2] update deps --- Dockerfile | 6 +++--- README.md | 6 +++--- docs/CONFIG-VARS.md | 1 + main.tf | 18 ++++++++++-------- variables.tf | 6 ++++++ versions.tf | 4 ++-- 6 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index bcd4404..c273de5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ # Copyright © 2021-2023, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 -ARG TERRAFORM_VERSION=1.7.0 -ARG GCP_CLI_VERSION=460.0.0 +ARG TERRAFORM_VERSION=1.7.3 +ARG GCP_CLI_VERSION=464.0.0 FROM hashicorp/terraform:$TERRAFORM_VERSION as terraform FROM google/cloud-sdk:$GCP_CLI_VERSION-alpine -ARG KUBECTL_VERSION=1.27.8 +ARG KUBECTL_VERSION=1.27.10 ARG ENABLE_GKE_GCLOUD_AUTH_PLUGIN=True ARG INSTALL_COMPONENTS="" diff --git a/README.md b/README.md index 30d5e4d..09c7c4d 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,10 @@ Operational knowledge of - Terraform or Docker - #### Terraform - - [Terraform](https://www.terraform.io/downloads.html) - v1.7.0 - - [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl) - v1.27.8 + - [Terraform](https://www.terraform.io/downloads.html) - v1.7.3 + - [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl) - v1.27.10 - [jq](https://stedolan.github.io/jq/) - v1.6 - - [gcloud CLI](https://cloud.google.com/sdk/gcloud) - (optional - useful as an alternative to the Google Cloud Platform Portal) - v460.0.0 + - [gcloud CLI](https://cloud.google.com/sdk/gcloud) - (optional - useful as an alternative to the Google Cloud Platform Portal) - v464.0.0 - [gke-gcloud-auth-plugin](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl#install_plugin) - (optional - only for provider based Kubernetes configuration files) - >= v1.26 - #### Docker - [Docker](https://docs.docker.com/get-docker/) diff --git a/docs/CONFIG-VARS.md b/docs/CONFIG-VARS.md index 3b33df0..625aa25 100644 --- a/docs/CONFIG-VARS.md +++ b/docs/CONFIG-VARS.md @@ -107,6 +107,7 @@ The application of a Kubernetes version in GCP has some limitations when assigni | enable_cluster_autoscaling | Per-cluster configuration of [Node Auto-Provisioning](https://cloud.google.com/kubernetes-engine/docs/how-to/node-auto-provisioning) with Cluster Autoscaler to automatically adjust the size of the cluster and create/delete node pools based on the current needs of the cluster's workload | bool | false | This is different from node autoscaling which is controlled by `max_node` & `min_node` in your [node pool definitions](#Nodepools)| | cluster_autoscaling_max_cpu_cores | MAX number of cores in the cluster | number | 500 | | | cluster_autoscaling_max_memory_gb | MAX number of gb of memory in the cluster | number | 10000 | | +| cluster_autoscaling_profile | Configuration options for the [Autoscaling profile](https://cloud.google.com/kubernetes-engine/docs/concepts/cluster-autoscaler#autoscaling_profiles) feature, which lets you choose whether the cluster autoscaler should optimize for resource utilization or resource availability when deciding to remove nodes from a cluster | string | "BALANCED" | | | create_static_kubeconfig | Allows the user to create a provider / service account based kube config file | bool | true | A value of `false` will default to using the cloud providers mechanism for generating the kubeconfig file. A value of `true` will create a static kubeconfig which utilizes a `Service Account` and `Cluster Role Binding` to provide credentials. | | regional | Create a regional GKE control plane | bool | true | If false a zonal GKE control plane is created. **WARNING: changing this after cluster creation is destructive** | | create_jump_vm | Create bastion host | bool | true | | diff --git a/main.tf b/main.tf index ece97ed..e40df88 100644 --- a/main.tf +++ b/main.tf @@ -91,7 +91,7 @@ data "google_container_engine_versions" "gke-version" { module "gke" { source = "terraform-google-modules/kubernetes-engine/google//modules/private-cluster" - version = "~> 29.0.0" + version = "~> 30.0.0" project_id = var.project name = "${var.prefix}-gke" region = local.region @@ -135,18 +135,20 @@ module "gke" { max_memory_gb : var.cluster_autoscaling_max_memory_gb, min_cpu_cores : 1, min_memory_gb : 1, - gpu_resources = [], - auto_repair = (var.kubernetes_channel == "UNSPECIFIED") ? false : true, - auto_upgrade = (var.kubernetes_channel == "UNSPECIFIED") ? false : true + gpu_resources = [], + auto_repair = (var.kubernetes_channel == "UNSPECIFIED") ? false : true, + auto_upgrade = (var.kubernetes_channel == "UNSPECIFIED") ? false : true + autoscaling_profile = "BALANCED" } : { enabled : false, max_cpu_cores : 0, max_memory_gb : 0, min_cpu_cores : 0, min_memory_gb : 0, - gpu_resources = [], - auto_repair = (var.kubernetes_channel == "UNSPECIFIED") ? false : true, - auto_upgrade = (var.kubernetes_channel == "UNSPECIFIED") ? false : true + gpu_resources = [], + auto_repair = (var.kubernetes_channel == "UNSPECIFIED") ? false : true, + auto_upgrade = (var.kubernetes_channel == "UNSPECIFIED") ? false : true + autoscaling_profile = "BALANCED" } master_authorized_networks = concat([ @@ -239,7 +241,7 @@ resource "local_file" "kubeconfig" { # Module Registry - https://registry.terraform.io/modules/GoogleCloudPlatform/sql-db/google/12.0.0/submodules/postgresql module "postgresql" { source = "GoogleCloudPlatform/sql-db/google//modules/postgresql" - version = "~> 18.2.0" + version = "~> 19.0.0" project_id = var.project for_each = local.postgres_servers != null ? length(local.postgres_servers) != 0 ? local.postgres_servers : {} : {} diff --git a/variables.tf b/variables.tf index e2884fe..4efabb3 100644 --- a/variables.tf +++ b/variables.tf @@ -344,6 +344,12 @@ variable "cluster_autoscaling_max_memory_gb" { default = 10000 } +variable "cluster_autoscaling_profile" { + description = "Configuration options for the Autoscaling profile feature, which lets you choose whether the cluster autoscaler should optimize for resource utilization or resource availability when deciding to remove nodes from a cluster" + type = string + default = "BALANCED" +} + # PostgreSQL # Defaults diff --git a/versions.tf b/versions.tf index 1f7a722..c2aba61 100644 --- a/versions.tf +++ b/versions.tf @@ -7,11 +7,11 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = "5.12.0" + version = "5.16.0" } google-beta = { source = "hashicorp/google-beta" - version = "5.12.0" + version = "5.16.0" } kubernetes = { source = "hashicorp/kubernetes" From 9c362ad23da49c06e9ff4b3d1aa97dfbfad100a1 Mon Sep 17 00:00:00 2001 From: jarpat Date: Tue, 20 Feb 2024 14:18:03 -0500 Subject: [PATCH 2/2] use var.cluster_autoscaling_profile --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index e40df88..a2e6d4a 100644 --- a/main.tf +++ b/main.tf @@ -138,7 +138,7 @@ module "gke" { gpu_resources = [], auto_repair = (var.kubernetes_channel == "UNSPECIFIED") ? false : true, auto_upgrade = (var.kubernetes_channel == "UNSPECIFIED") ? false : true - autoscaling_profile = "BALANCED" + autoscaling_profile = var.cluster_autoscaling_profile } : { enabled : false, max_cpu_cores : 0, @@ -148,7 +148,7 @@ module "gke" { gpu_resources = [], auto_repair = (var.kubernetes_channel == "UNSPECIFIED") ? false : true, auto_upgrade = (var.kubernetes_channel == "UNSPECIFIED") ? false : true - autoscaling_profile = "BALANCED" + autoscaling_profile = var.cluster_autoscaling_profile } master_authorized_networks = concat([