🏭️ Refactor prepare-tf

- fix tags so that they don't contain '='
- install metrics-server only if necessary
- set a maximum size to GKE node pool
- change tags to be shorter
This commit is contained in:
Jérôme Petazzoni
2022-01-09 20:51:50 +01:00
parent 7eb90b9d6f
commit 8de9e6e868
11 changed files with 58 additions and 22 deletions

View File

@@ -3,14 +3,18 @@ resource "google_container_cluster" "_" {
project = "prepare-tf"
location = "europe-north1-a"
min_master_version = var.k8s_version
initial_node_count = var.min_nodes_per_pool
#max_size = max(var.min_nodes_per_pool, var.max_nodes_per_pool)
#autoscaling = true
#autohealing = true
node_config {
tags = var.common_tags
machine_type = local.node_type
node_pool {
name = "x86"
node_config {
tags = var.common_tags
machine_type = local.node_type
}
initial_node_count = var.min_nodes_per_pool
autoscaling {
min_node_count = var.min_nodes_per_pool
max_node_count = max(var.min_nodes_per_pool, var.max_nodes_per_pool)
}
}
# This is not strictly necessary.
@@ -23,3 +27,4 @@ resource "google_container_cluster" "_" {
}
}
}

View File

@@ -29,3 +29,7 @@ output "kubeconfig" {
output "cluster_id" {
value = google_container_cluster._.id
}
output "has_metrics_server" {
value = true
}