enable variable storageclass

This commit is contained in:
2025-04-04 09:27:29 +01:00
parent 8a13ca3967
commit 6dc1f5427d
3 changed files with 26 additions and 21 deletions
+2
View File
@@ -30,6 +30,8 @@ Boolean to specify if it is a hostpath
[Example](https://gitea.tryton.geeraert.eu/pi-ux-ce/Terraform_kube#volume-as-hostpath) [Example](https://gitea.tryton.geeraert.eu/pi-ux-ce/Terraform_kube#volume-as-hostpath)
#### pvc_size = optional(string) #### pvc_size = optional(string)
#### mount_path = string #### mount_path = string
#### storage_class_name = optional(string, "nfs-storage-intelligent")
This is the storage class, by default it will use nfs-storage-intelligent but it can be changed to something more suitable
### environment = optional(map(object({ ### environment = optional(map(object({
### name = optional(string) ### name = optional(string)
### value = optional(string) ### value = optional(string)
+15 -13
View File
@@ -12,12 +12,13 @@ variable "kubernetes" {
name = optional(string) name = optional(string)
image = string image = string
pvc = optional(map(object({ pvc = optional(map(object({
name = string name = string
pvc = optional(bool, false) pvc = optional(bool, false)
config_map = optional(bool, false) config_map = optional(bool, false)
host_path = optional(string) host_path = optional(string)
pvc_size = optional(string) pvc_size = optional(string)
mount_path = string storage_class_name = optional(string, "nfs-storage-intelligent")
mount_path = string
}))) })))
environment = optional(map(object({ environment = optional(map(object({
name = optional(string) name = optional(string)
@@ -58,12 +59,13 @@ locals {
pvc_details = flatten([ pvc_details = flatten([
for key, value in var.kubernetes : [ for key, value in var.kubernetes : [
for index, pvc in value.pvc : { for index, pvc in value.pvc : {
index = index index = index
pvc = pvc.pvc pvc = pvc.pvc
name = pvc.name name = pvc.name
pvc_size = pvc.pvc_size pvc_size = pvc.pvc_size
mount_path = pvc.mount_path mount_path = pvc.mount_path
namespace = coalesce(value.namespace, key) storage_class_name = pvc.storage_class_name
namespace = coalesce(value.namespace, key)
}] if value.enabled == true && value.pvc != null }] if value.enabled == true && value.pvc != null
]) ])
} }
@@ -131,7 +133,7 @@ resource "kubernetes_persistent_volume_claim" "automatic-pvc" {
} }
spec { spec {
access_modes = ["ReadWriteMany"] access_modes = ["ReadWriteMany"]
storage_class_name = "nfs-storage-intelligent" storage_class_name = each.value.storage_class_name
resources { resources {
requests = { requests = {
storage = each.value.pvc_size storage = each.value.pvc_size
+9 -8
View File
@@ -133,7 +133,7 @@ kubernetes = {
stash = { stash = {
enabled = false # enabled = false
name = "stash" name = "stash"
image = "stashapp/stash:latest" image = "stashapp/stash:latest"
service_port = 9999 service_port = 9999
@@ -156,17 +156,18 @@ kubernetes = {
} }
} }
requirements = { requirements = {
limits-cpu = "100m" limits-cpu = "1000m"
limits-memory = "300Mi" limits-memory = "3000Mi"
requests-cpu = "50m" requests-cpu = "50m"
requests-memory = "150Mi" requests-memory = "150Mi"
} }
pvc = { pvc = {
data = { data = {
name = "data" name = "data"
pvc_size = "100Mi" pvc_size = "100Mi"
pvc = true pvc = true
mount_path = "/data" mount_path = "/data"
storage_class_name = "nfs-storage-fastaccess"
} }
metadata = { metadata = {
name = "metadata" name = "metadata"
@@ -468,7 +469,7 @@ kubernetes = {
next = { next = {
# enabled = false enabled = false
namespace = "next" namespace = "next"
replicas = 01 replicas = 01
image = "nextcloud:29.0.3-apache" image = "nextcloud:29.0.3-apache"