feat: add MariaDB flags and conf variables for custom configuration
continuous-integration/drone/push Build is passing Details

main
RaviAnand Mohabir 2 years ago
parent bfd39084e8
commit b75652e55b

@ -81,6 +81,10 @@ resource "kubernetes_stateful_set" "mariadb" {
} }
} }
} }
env {
name = "MARIADB_EXTRA_FLAGS"
value = var.mariadb_flags
}
port { port {
name = "tcp-mariadb" name = "tcp-mariadb"
container_port = local.port container_port = local.port
@ -89,6 +93,23 @@ resource "kubernetes_stateful_set" "mariadb" {
name = "data" name = "data"
mount_path = "/bitnami/mariadb" mount_path = "/bitnami/mariadb"
} }
dynamic "volume_mount" {
for_each = var.mariadb_conf != "" ? toset(["config"]) : toset([])
content {
name = volume_mount.value
mount_path = "/opt/bitnami/mariadb/conf/my_custom.cnf"
sub_path = "my_custom.cnf"
}
}
}
dynamic "volume" {
for_each = var.mariadb_conf != "" ? toset(["config"]) : toset([])
content {
name = volume.value
config_map {
name = kubernetes_config_map.mariadb_conf[volume.key].metadata.0.name
}
}
} }
} }
} }
@ -156,3 +177,14 @@ resource "kubernetes_config_map" "mariadb" {
MARIADB_DATABASE = var.mariadb_db MARIADB_DATABASE = var.mariadb_db
} }
} }
resource "kubernetes_config_map" "mariadb_conf" {
for_each = var.mariadb_conf != "" ? toset(["config"]) : toset([])
metadata {
name = "mariadb-conf"
namespace = var.namespace
}
data = {
"my_custom.cnf" = var.mariadb_conf
}
}

@ -34,6 +34,18 @@ variable "mariadb_db" {
sensitive = true sensitive = true
} }
variable "mariadb_conf" {
description = "MariaDB configuration file to enable custom configuration"
type = string
default = ""
}
variable "mariadb_flags" {
description = "Additional flags to pass to MariaDB startup"
type = string
default = ""
}
variable "stateful_set_name" { variable "stateful_set_name" {
description = "Name of StatefulSet" description = "Name of StatefulSet"
type = string type = string

Loading…
Cancel
Save