Fix linter, improve rabbit
This commit is contained in:
@@ -4,6 +4,11 @@ locals {
|
||||
"app.kubernetes.io/component" = "rabbitmq"
|
||||
})
|
||||
secret_name = var.cert_name != "" ? var.cert_name : "${local.app_slug}-cert"
|
||||
pvc_spec = merge({
|
||||
"storage" = var.storage.size
|
||||
}, var.storage.class != "" ? {
|
||||
"storageClassName" = var.storage.class
|
||||
} : {})
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "certificate" {
|
||||
@@ -73,6 +78,10 @@ resource "kubectl_manifest" "rabbitmq" {
|
||||
labels: ${jsonencode(local.rabbit_labels)}
|
||||
spec:
|
||||
replicas: ${var.replicas}
|
||||
image: "${var.image.registry}/${var.image.repository}:${var.image.tag}"
|
||||
imagePullPolicy: "${var.image.pull_policy}"
|
||||
persistence: ${jsonencode(local.pvc_spec)}
|
||||
resources: ${jsonencode(var.resources)}
|
||||
tls:
|
||||
secretName: ${local.secret_name}
|
||||
rabbitmq:
|
||||
@@ -85,9 +94,7 @@ resource "kubectl_manifest" "rabbitmq" {
|
||||
cluster_formation.k8s.host = kubernetes.default.svc.cluster.local
|
||||
default_user=${data.kubernetes_secret_v1.rabbit_secret.data["username"]}
|
||||
default_pass=${data.kubernetes_secret_v1.rabbit_secret.data["password"]}
|
||||
additionalPlugins:
|
||||
- rabbitmq_mqtt
|
||||
- rabbitmq_web_mqtt
|
||||
additionalPlugins: ${jsonencode(var.plugins)}
|
||||
service:
|
||||
ipFamilyPolicy: "PreferDualStack"
|
||||
EOF
|
||||
|
||||
@@ -10,19 +10,69 @@ variable "namespace" {
|
||||
variable "labels" {
|
||||
type = map(string)
|
||||
}
|
||||
variable "annotations" {
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
variable "issuer" {
|
||||
type = string
|
||||
}
|
||||
variable "replicas" {
|
||||
type = number
|
||||
type = number
|
||||
default = 1
|
||||
}
|
||||
variable "image" {
|
||||
type = object({
|
||||
registry = optional(string),
|
||||
repository = optional(string),
|
||||
tag = optional(string),
|
||||
pull_policy = optional(string)
|
||||
})
|
||||
description = "Image parameters"
|
||||
default = {
|
||||
"registry" = "docker.io"
|
||||
"repository" = "rabbitmq"
|
||||
"tag" = "3.11.28-management-alpine"
|
||||
"pull_policy" = "IfNotPresent"
|
||||
}
|
||||
}
|
||||
variable "storage" {
|
||||
description = "Storage parameters"
|
||||
type = object({
|
||||
class = optional(string),
|
||||
size = optional(string),
|
||||
})
|
||||
default = {
|
||||
class = ""
|
||||
size = "1Gi"
|
||||
}
|
||||
}
|
||||
variable "resources" {
|
||||
description = "Resources parameters"
|
||||
type = object({
|
||||
requests = optional(object({
|
||||
cpu = optional(string),
|
||||
memory = optional(string)
|
||||
})),
|
||||
limits = optional(object({
|
||||
cpu = optional(string),
|
||||
memory = optional(string)
|
||||
}))
|
||||
})
|
||||
default = {
|
||||
requests = {
|
||||
cpu = "1000m",
|
||||
memory = "2Gi"
|
||||
},
|
||||
limits = {
|
||||
cpu = "1000m",
|
||||
memory = "2Gi"
|
||||
}
|
||||
}
|
||||
}
|
||||
variable "cert_name" {
|
||||
type = string
|
||||
default = ""
|
||||
description = "Give a secret name for tls, if empty and entrypointis websecure or empty, one will be created"
|
||||
description = "Give a secret name for tls, if empty a new one will be created"
|
||||
}
|
||||
variable "plugins" {
|
||||
description = "RabitMQ plugins"
|
||||
type = list(string)
|
||||
default = ["rabbitmq_mqtt", "rabbitmq_web_mqtt"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user