Skip to content

Commit

Permalink
chore: updated iac daemon bootstrap to use statefullset
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobressan committed Oct 10, 2024
1 parent e6eb4ed commit 8fa7099
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
8 changes: 8 additions & 0 deletions bootstrap/daemon/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ variable "resources" {
cpu = string
memory = string
})
storage = object({
size = string
class = string
})
})
default = {
requests = {
Expand All @@ -119,5 +123,9 @@ variable "resources" {
cpu = "500m"
memory = "500Mi"
}
storage = {
size = "10Gi"
class = "fast"
}
}
}
27 changes: 22 additions & 5 deletions bootstrap/daemon/deployment.tf → bootstrap/daemon/sts.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ locals {
role = "fabric-daemon"
}

resource "kubernetes_deployment_v1" "daemon" {
resource "kubernetes_stateful_set_v1" "daemon" {
wait_for_rollout = false

metadata {
Expand All @@ -14,7 +14,23 @@ resource "kubernetes_deployment_v1" "daemon" {
}

spec {
replicas = var.replicas
replicas = var.replicas
service_name = "fabric-daemon"

volume_claim_template {
metadata {
name = "cache"
}
spec {
access_modes = ["ReadWriteOnce"]
resources {
requests = {
storage = var.resources.storage.size
}
}
storage_class_name = var.resources.storage.class
}
}

selector {
match_labels = {
Expand All @@ -39,13 +55,14 @@ resource "kubernetes_deployment_v1" "daemon" {
value = "/fabric/daemon.toml"
}

port {
container_port = local.port
volume_mount {
name = "cache"
mount_path = "/var/cache"
}

volume_mount {
name = "config"
mount_path = "/fabric"
mount_path = "/fabric/config"
}

resources {
Expand Down

0 comments on commit 8fa7099

Please sign in to comment.