Skip to content

Commit

Permalink
PV implimentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Princess4ogb committed Feb 28, 2024
1 parent 23e27eb commit cde9a6e
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 126 deletions.
5 changes: 1 addition & 4 deletions src/_nebari/stages/kubernetes_ingress/template/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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
}
}
}
Expand All @@ -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"
}
}

}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 ="./"
Expand Down
15 changes: 0 additions & 15 deletions src/_nebari/stages/kubernetes_ingress/template/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit cde9a6e

Please sign in to comment.