diff --git a/src/_nebari/stages/kubernetes_ingress/template/main.tf b/src/_nebari/stages/kubernetes_ingress/template/main.tf index f1df788bf7..988ba6121b 100644 --- a/src/_nebari/stages/kubernetes_ingress/template/main.tf +++ b/src/_nebari/stages/kubernetes_ingress/template/main.tf @@ -15,9 +15,6 @@ module "kubernetes-ingress" { load-balancer-ip = var.load-balancer-ip additional-arguments = var.additional-arguments - storage_size = var.storage_size access_modes = var.access_modes - storage_type = var.storage_type - iops = var.iops - reclaim_policy = var.reclaim_policy + } diff --git a/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/main.tf b/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/main.tf index 1de6a8d564..c09ea8d4ab 100644 --- a/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/main.tf +++ b/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/main.tf @@ -171,6 +171,46 @@ resource "kubernetes_service" "traefik_internal" { } } + + + +resource "kubernetes_persistent_volume_claim" "persistent-volume-claim" { + metadata { + name = "persistent-volume-claim" + namespace = var.namespace + } + spec { + access_modes = ["ReadWriteMany"] + storage_class_name="standard" + resources { + requests = { + storage = "5Gi" + } + } + volume_name = "${kubernetes_persistent_volume.traefik-persistent-volume.metadata.0.name}" + } +} + +resource "kubernetes_persistent_volume" "traefik-persistent-volume" { + metadata { + name = "traefik-persistent-volume" + } + spec { + capacity = { + storage = "10Gi" + } + storage_class_name="standard" + access_modes = ["ReadWriteMany"] + + persistent_volume_source { + vsphere_volume { + volume_path = "/tmp/acme-certificates" + } + } + } +} + + resource "kubernetes_deployment" "main" { metadata { name = "${var.name}-traefik-ingress" @@ -214,10 +254,6 @@ resource "kubernetes_deployment" "main" { container { image = "${var.traefik-image.image}:${var.traefik-image.tag}" name = var.name - volume_mount { - name = "traefik-certs" - mount_path = "/tmp/acme-certificates" - } security_context { capabilities { drop = ["ALL"] @@ -332,7 +368,7 @@ resource "kubernetes_deployment" "main" { volume { name = "traefik-certs" persistent_volume_claim { - claim_name = kubernetes_persistent_volume_claim.persistent-volume-claim.name + claim_name = kubernetes_persistent_volume_claim.persistent-volume-claim.metadata.0.name } } } @@ -359,61 +395,3 @@ resource "kubernetes_manifest" "tlsstore_default" { } - -resource "kubernetes_storage_class" "traefik_certs_storage_class" { - metadata { - name = "traefik-certs-storage-class" - - } - - storage_provisioner = "kubernetes.io/aws-ebs" - parameters = { - type = var.storage_type - iops = var.iops - } - reclaim_policy = var.reclaim_policy -} - -resource "kubernetes_manifest" "traefik-persistent-volume" { - manifest = { - "apiVersion"= "v1", - "kind"= "PersistentVolume", - "metadata"= { - "name"= "traefik-persistent-volume" - - }, - "spec"= { - "accessModes"= ["ReadWriteOnce"], - "capacity"= { - "storage"= "1Gi" - }, - "storageClassName"= "standard", - "hostPath"= { - "path"= "/tmp/acme-certificates" - } - } -} - -} - -resource "kubernetes_manifest" "persistent-volume-claim" { - manifest = { - "apiVersion"= "v1", - "kind"= "PersistentVolumeClaim", - "metadata"= { - "name"= "persistent-volume-claim" - "namespace" = var.namespace - }, - "spec"= { - "accessModes"= ["ReadWriteOnce"], - "resources"= { - "requests"= { - "storage"= "1Gi" - } - }, - "storageClassName"= "standard", - "volumeName"= "traefik-persistent-volume" - } -} - -} diff --git a/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/pv.yaml b/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/pv.yaml deleted file mode 100644 index d6bb1be8aa..0000000000 --- a/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/pv.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: traefik-persistent-volume-2 - namespace: playground-prince -spec: - accessModes: - - ReadWriteOnce - capacity: - storage: 10Gi - storageClassName: standard - hostPath: - path: /tmp/acme-certificates \ No newline at end of file diff --git a/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/pv_claim.yaml b/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/pv_claim.yaml deleted file mode 100644 index 6a0f1cfda5..0000000000 --- a/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/pv_claim.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: persistent-volume-claim-2 - namespace: playground-prince -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 10Gi - storageClassName: standard - volumeName: traefik-persistent-volume-2 \ No newline at end of file diff --git a/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/variables.tf b/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/variables.tf index 061708b972..2d73c435ac 100644 --- a/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/variables.tf +++ b/src/_nebari/stages/kubernetes_ingress/template/modules/kubernetes/ingress/variables.tf @@ -74,30 +74,13 @@ variable "additional-arguments" { default = [] } -variable "storage_size" { - type = string - default = "1Gi" -} + variable "access_modes" { type = list(string) default = ["ReadWriteOnce"] } -variable "storage_type" { - type = string - default = "gp2" -} - -variable "iops" { - type = number - default = 100 -} - -variable "reclaim_policy" { - type = string - default = "Retain" -} variable "path" { type = string default ="./" diff --git a/src/_nebari/stages/kubernetes_ingress/template/variables.tf b/src/_nebari/stages/kubernetes_ingress/template/variables.tf index 77a3a351b2..6a3ce37742 100644 --- a/src/_nebari/stages/kubernetes_ingress/template/variables.tf +++ b/src/_nebari/stages/kubernetes_ingress/template/variables.tf @@ -80,18 +80,3 @@ variable "access_modes" { type = list(string) default = ["ReadWriteOnce"] } - -variable "storage_type" { - type = string - default = "gp2" -} - -variable "iops" { - type = number - default = 100 -} - -variable "reclaim_policy" { - type = string - default = "Retain" -} \ No newline at end of file