From c689918df959f8f43951372ad08701c3eb59d55b Mon Sep 17 00:00:00 2001 From: "David.Houck" Date: Fri, 6 Sep 2024 11:10:49 -0400 Subject: [PATCH 1/3] AWS no longer has default storage class with K8s 1.30 --- main.tf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.tf b/main.tf index 75abff58..5caa7bf7 100755 --- a/main.tf +++ b/main.tf @@ -225,6 +225,16 @@ module "kubeconfig" { depends_on = [module.eks.cluster_name] # The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready. } +# Restore the gp2 storage class as the default storage class for EKS 1.30 and later clusters +resource "terraform_data" "run_command" { + count = var.kubernetes_version >= "1.30" ? 1 : 0 + provisioner "local-exec" { + command = "kubectl --kubeconfig=${local.kubeconfig_path} patch storageclass gp2 --patch '{\"metadata\": {\"annotations\":{\"storageclass.kubernetes.io/is-default-class\":\"true\"}}}' " + } + + depends_on = [module.kubeconfig] +} + # Database Setup - https://registry.terraform.io/modules/terraform-aws-modules/rds/aws/6.2.0 module "postgresql" { source = "terraform-aws-modules/rds/aws" From 7a55678b770885a6e70492279cdeea081b6f0b50 Mon Sep 17 00:00:00 2001 From: "David.Houck" Date: Fri, 6 Sep 2024 17:04:30 -0400 Subject: [PATCH 2/3] Update patch SC comment --- main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 5caa7bf7..71662a66 100755 --- a/main.tf +++ b/main.tf @@ -225,7 +225,8 @@ module "kubeconfig" { depends_on = [module.eks.cluster_name] # The name/id of the EKS cluster. Will block on cluster creation until the cluster is really ready. } -# Restore the gp2 storage class as the default storage class for EKS 1.30 and later clusters +# Normally, the use of local-exec below is avoided. It is used here to patch the gp2 storage class as the default storage class for EKS 1.30 and later clusters. +# In the near future, adopting a newer version of the aws-ebs-csi-driver will create a new gp3-based storage class which will become the default storage class. resource "terraform_data" "run_command" { count = var.kubernetes_version >= "1.30" ? 1 : 0 provisioner "local-exec" { From 16a42205bbbd891be86c4e0ddb6250f3e43cc72d Mon Sep 17 00:00:00 2001 From: "David.Houck" Date: Mon, 9 Sep 2024 10:19:06 -0400 Subject: [PATCH 3/3] Add internal ticket reference for aws-ebs-csi-driver update work --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 71662a66..19ae41c1 100755 --- a/main.tf +++ b/main.tf @@ -226,7 +226,7 @@ module "kubeconfig" { } # Normally, the use of local-exec below is avoided. It is used here to patch the gp2 storage class as the default storage class for EKS 1.30 and later clusters. -# In the near future, adopting a newer version of the aws-ebs-csi-driver will create a new gp3-based storage class which will become the default storage class. +# PSKD-667 will track the move to a newer version of the aws-ebs-csi-driver creating a gp3 storage class which will then become the default storage class. resource "terraform_data" "run_command" { count = var.kubernetes_version >= "1.30" ? 1 : 0 provisioner "local-exec" {