Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not merge - traefik persistent volume #4

Closed
wants to merge 12 commits into from
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" {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"persistent-volume-claim" - use _ and specify a bit more in the name, traefik_ingress_pvc should work

metadata {
name = "persistent-volume-claim"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use name to ensure uniqueness

"${var.name}-traefik-ingress"

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" {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to _

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"
}
Loading