From 0b2ff1c9267c49f90ce5716d03046faf98d95f5f Mon Sep 17 00:00:00 2001 From: David Mays Date: Fri, 24 Jan 2025 11:13:52 +0000 Subject: [PATCH] Add Metrics Server support, enable on non-prod... ...so that we can test it first. --- .../deployments/cluster-infrastructure/main.tf | 18 +++++++++++++----- .../cluster-infrastructure/variables.tf | 6 ++++++ .../tfc-configuration/variables-integration.tf | 2 ++ .../tfc-configuration/variables-production.tf | 2 ++ .../tfc-configuration/variables-staging.tf | 2 ++ 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/terraform/deployments/cluster-infrastructure/main.tf b/terraform/deployments/cluster-infrastructure/main.tf index 33f0756e3..831a14dd0 100644 --- a/terraform/deployments/cluster-infrastructure/main.tf +++ b/terraform/deployments/cluster-infrastructure/main.tf @@ -27,6 +27,18 @@ locals { secrets_prefix = "govuk" monitoring_namespace = "monitoring" + default_cluster_addons = { + coredns = { most_recent = true } + kube-proxy = { most_recent = true } + vpc-cni = { most_recent = true } + } + + metrics_server_addon = { + metrics-server = { most_recent = true } + } + + enabled_cluster_addons = merge(local.default_cluster_addons, var.enable_metrics_server ? local.metrics_server_addon : {}) + main_managed_node_group = { main = { name_prefix = var.cluster_name @@ -187,11 +199,7 @@ module "eks" { subnet_ids = [for s in aws_subnet.eks_control_plane : s.id] vpc_id = data.terraform_remote_state.infra_vpc.outputs.vpc_id - cluster_addons = { - coredns = { most_recent = true } - kube-proxy = { most_recent = true } - vpc-cni = { most_recent = true } - } + cluster_addons = local.enabled_cluster_addons cluster_endpoint_public_access = true cloudwatch_log_group_retention_in_days = var.cluster_log_retention_in_days diff --git a/terraform/deployments/cluster-infrastructure/variables.tf b/terraform/deployments/cluster-infrastructure/variables.tf index ed5529fd5..fb4777aeb 100644 --- a/terraform/deployments/cluster-infrastructure/variables.tf +++ b/terraform/deployments/cluster-infrastructure/variables.tf @@ -51,6 +51,12 @@ variable "force_destroy" { default = false } +variable "enable_metrics_server" { + type = bool + description = "Enable the Metrics Server EKS Add-on. For Pod Metrics and HPA support." + default = false +} + variable "enable_arm_workers" { type = bool description = "Whether to enable the ARM/Graviton-based Managed Node Group" diff --git a/terraform/deployments/tfc-configuration/variables-integration.tf b/terraform/deployments/tfc-configuration/variables-integration.tf index 1cce79442..dcddd4c5a 100644 --- a/terraform/deployments/tfc-configuration/variables-integration.tf +++ b/terraform/deployments/tfc-configuration/variables-integration.tf @@ -56,6 +56,8 @@ module "variable-set-integration" { govuk_environment = "integration" force_destroy = true + enable_metrics_server = true + enable_arm_workers = true enable_main_workers = false enable_x86_workers = true diff --git a/terraform/deployments/tfc-configuration/variables-production.tf b/terraform/deployments/tfc-configuration/variables-production.tf index e12a772d4..22971a9a8 100644 --- a/terraform/deployments/tfc-configuration/variables-production.tf +++ b/terraform/deployments/tfc-configuration/variables-production.tf @@ -55,6 +55,8 @@ module "variable-set-production" { govuk_environment = "production" + enable_metrics_server = false + enable_arm_workers = false enable_main_workers = true enable_x86_workers = false diff --git a/terraform/deployments/tfc-configuration/variables-staging.tf b/terraform/deployments/tfc-configuration/variables-staging.tf index 6cb6f74c1..d7c9e85a2 100644 --- a/terraform/deployments/tfc-configuration/variables-staging.tf +++ b/terraform/deployments/tfc-configuration/variables-staging.tf @@ -55,6 +55,8 @@ module "variable-set-staging" { govuk_environment = "staging" + enable_metrics_server = true + enable_arm_workers = true enable_main_workers = false enable_x86_workers = true