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

fix: RPC is now a STS #79

Merged
merged 2 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bootstrap/rpc/config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "kubernetes_config_map_v1" "fabric_rpc_config" {
"${path.module}/rpc.toml.tftpl",
{
port = local.port,
db_path = "cache.db",
db_path = "/var/cache/cache.db",
broker_urls = var.broker_urls
consumer_name = var.consumer_name
kafka_username = var.kafka_username
Expand Down
8 changes: 8 additions & 0 deletions bootstrap/rpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ variable "resources" {
cpu = string
memory = string
})
storage = object({
size = string
class = string
})
})
default = {
requests = {
Expand All @@ -93,5 +97,9 @@ variable "resources" {
cpu = "500m"
memory = "500Mi"
}
storage = {
size = "10Gi"
class = "fast"
}
}
}
25 changes: 23 additions & 2 deletions bootstrap/rpc/deployment.tf → bootstrap/rpc/sts.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ locals {
role = "fabric-rpc"
}

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

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

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

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 Down Expand Up @@ -43,6 +59,11 @@ resource "kubernetes_deployment_v1" "rpc" {
container_port = local.port
}

volume_mount {
name = "cache"
mount_path = "/var/cache"
}

volume_mount {
name = "config"
mount_path = "/fabric/config"
Expand Down
Loading