From 60e5b414b3da51a2706d7862a211b16b28696737 Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Tue, 2 Jul 2024 19:26:40 -0400 Subject: [PATCH] fix: allow configurable storage class for instances (#52) --- bootstrap/instance/main.tf | 4 ++++ bootstrap/instance/node.tf | 2 +- bootstrap/main.tf | 31 ++++++++++++++++--------------- bootstrap/variables.tf | 17 +++++++++-------- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/bootstrap/instance/main.tf b/bootstrap/instance/main.tf index f8c87ca..0297ccf 100644 --- a/bootstrap/instance/main.tf +++ b/bootstrap/instance/main.tf @@ -28,6 +28,10 @@ variable "node_resources" { } } +variable "storage_class_name" { + default = "gp3" +} + variable "storage_size" { default = "50Gi" } diff --git a/bootstrap/instance/node.tf b/bootstrap/instance/node.tf index 0a88455..a842103 100644 --- a/bootstrap/instance/node.tf +++ b/bootstrap/instance/node.tf @@ -73,7 +73,7 @@ resource "kubernetes_stateful_set_v1" "node" { } spec { access_modes = ["ReadWriteOnce"] - storage_class_name = "gp3" + storage_class_name = var.storage_class_name resources { requests = { storage = var.storage_size diff --git a/bootstrap/main.tf b/bootstrap/main.tf index 99ed822..73e39f7 100644 --- a/bootstrap/main.tf +++ b/bootstrap/main.tf @@ -66,20 +66,21 @@ module "instances" { "cpu" = "100m" } }) - storage_size = coalesce(each.value.storage_size, "50Gi") - node_image = each.value.node_image - node_image_tag = each.value.image_tag - release = each.value.release - network = each.value.network - magic = each.value.magic - topology_zone = each.value.topology_zone - salt = each.value.salt - compute_arch = coalesce(each.value.compute_arch, "arm64") - compute_profile = coalesce(each.value.compute_profile, "mem-intensive") - availability_sla = coalesce(each.value.availability_sla, "consistent") - node_version = each.value.node_version - restore = coalesce(each.value.restore, false) - is_custom = coalesce(each.value.is_custom, false) + storage_class_name = coalesce(each.value.storage_class_name, "gp3") + storage_size = coalesce(each.value.storage_size, "50Gi") + node_image = each.value.node_image + node_image_tag = each.value.image_tag + release = each.value.release + network = each.value.network + magic = each.value.magic + topology_zone = each.value.topology_zone + salt = each.value.salt + compute_arch = coalesce(each.value.compute_arch, "arm64") + compute_profile = coalesce(each.value.compute_profile, "mem-intensive") + availability_sla = coalesce(each.value.availability_sla, "consistent") + node_version = each.value.node_version + restore = coalesce(each.value.restore, false) + is_custom = coalesce(each.value.is_custom, false) } @@ -111,4 +112,4 @@ module "node_relay" { depends_on = [kubernetes_namespace.namespace] source = "./relay" namespace = var.namespace -} \ No newline at end of file +} diff --git a/bootstrap/variables.tf b/bootstrap/variables.tf index 0acdf2f..4762022 100644 --- a/bootstrap/variables.tf +++ b/bootstrap/variables.tf @@ -145,14 +145,15 @@ variable "instances" { memory = string }) })) - storage_size = optional(string) - node_version = string - replicas = number - restore = optional(bool) - compute_arch = optional(string) - compute_profile = optional(string) - availability_sla = optional(string) - is_custom = optional(bool) + storage_size = optional(string) + storage_class_name = optional(string, "gp3") + node_version = string + replicas = number + restore = optional(bool) + compute_arch = optional(string) + compute_profile = optional(string) + availability_sla = optional(string) + is_custom = optional(bool) })) }