Skip to content

Commit

Permalink
feat: Parametrization of MongoDB persistence for localhost and GCP (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ngruelaneo authored Jan 23, 2025
2 parents 1024747 + 680ed49 commit 66c82aa
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 2 deletions.
2 changes: 2 additions & 0 deletions infrastructure/quick-deploy/gcp/parameters.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ keda = {

mongodb = {
node_selector = { service = "state-database" }
# Uncomment the line below to enable persistence, comment to disable
# persistent_volume = {}
}

# Nullify to disable sharding, each nullification of subobject will result in the use of default values
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/quick-deploy/gcp/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module "mongodb" {
}
mongodb_resources = var.mongodb.mongodb_resources
arbiter_resources = var.mongodb.arbiter_resources
persistent_volume = null
persistent_volume = var.mongodb.persistent_volume
}

module "mongodb_sharded" {
Expand Down
15 changes: 15 additions & 0 deletions infrastructure/quick-deploy/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ variable "mongodb" {
limits = optional(map(string))
requests = optional(map(string))
}))

persistent_volume = optional(object({
storage_provisioner = optional(string)
volume_binding_mode = optional(string, "Immediate")
parameters = optional(map(string), {})
#Resources for PVC
resources = optional(object({
limits = optional(object({
storage = string
}))
requests = optional(object({
storage = string
}))
}))
}))
})
default = {}
}
Expand Down
3 changes: 3 additions & 0 deletions infrastructure/quick-deploy/localhost/parameters.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ mongodb = {
# "ephemeral-storage" = "500Mi"
# }
# }

# Uncomment the line below to enable persistence, comment to disable
# persistent_volume = {}
}

# Nullify to disable sharding
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/quick-deploy/localhost/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module "mongodb" {
}
mongodb_resources = var.mongodb.mongodb_resources
arbiter_resources = var.mongodb.arbiter_resources
persistent_volume = null
persistent_volume = var.mongodb.persistent_volume
}

module "mongodb_sharded" {
Expand Down
15 changes: 15 additions & 0 deletions infrastructure/quick-deploy/localhost/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,21 @@ variable "mongodb" {
limits = optional(map(string))
requests = optional(map(string))
}))

persistent_volume = optional(object({
storage_provisioner = optional(string)
volume_binding_mode = optional(string, "Immediate")
parameters = optional(map(string), {})
#Resources for PVC
resources = optional(object({
limits = optional(object({
storage = string
}))
requests = optional(object({
storage = string
}))
}))
}))
})
default = {}
}
Expand Down

0 comments on commit 66c82aa

Please sign in to comment.