initial
This commit is contained in:
commit
7a7bc34ae3
32 changed files with 4857 additions and 0 deletions
85
modules/kubernetes/bind/deployment-factory/main.tf
Normal file
85
modules/kubernetes/bind/deployment-factory/main.tf
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
variable "named_conf_mounts" {}
|
||||
variable "deployment_name" {}
|
||||
|
||||
resource "kubernetes_deployment" "bind" {
|
||||
metadata {
|
||||
name = var.deployment_name
|
||||
namespace = "bind"
|
||||
labels = {
|
||||
"app" = "bind"
|
||||
"kubernetes.io/cluster-service" : "true"
|
||||
}
|
||||
}
|
||||
spec {
|
||||
replicas = "3"
|
||||
selector {
|
||||
match_labels = {
|
||||
"app" = var.deployment_name
|
||||
}
|
||||
}
|
||||
template {
|
||||
metadata {
|
||||
labels = {
|
||||
"app" = var.deployment_name
|
||||
"kubernetes.io/cluster-service" : "true"
|
||||
}
|
||||
}
|
||||
spec {
|
||||
container {
|
||||
name = "bind"
|
||||
image = "resystit/bind9:latest"
|
||||
image_pull_policy = "IfNotPresent"
|
||||
port {
|
||||
container_port = 53
|
||||
protocol = "UDP"
|
||||
}
|
||||
volume_mount {
|
||||
mount_path = "/etc/bind/named.conf"
|
||||
sub_path = "named.conf"
|
||||
name = "bindconf"
|
||||
}
|
||||
|
||||
dynamic "volume_mount" {
|
||||
for_each = [for m in var.named_conf_mounts :
|
||||
{
|
||||
name = m.name
|
||||
mount_path = m.mount_path
|
||||
sub_path = m.sub_path
|
||||
}]
|
||||
content {
|
||||
name = volume_mount.value.name
|
||||
mount_path = volume_mount.value.mount_path
|
||||
sub_path = volume_mount.value.sub_path
|
||||
}
|
||||
}
|
||||
|
||||
volume_mount {
|
||||
mount_path = "/etc/bind/db.viktorbarzin.me"
|
||||
sub_path = "db.viktorbarzin.me"
|
||||
name = "bindconf"
|
||||
}
|
||||
volume_mount {
|
||||
mount_path = "/etc/bind/db.viktorbarzin.lan"
|
||||
sub_path = "db.viktorbarzin.lan"
|
||||
name = "bindconf"
|
||||
}
|
||||
}
|
||||
container {
|
||||
name = "bind-exporter"
|
||||
image = "prometheuscommunity/bind-exporter:latest"
|
||||
image_pull_policy = "IfNotPresent"
|
||||
port {
|
||||
container_port = 9119
|
||||
}
|
||||
}
|
||||
|
||||
volume {
|
||||
name = "bindconf"
|
||||
config_map {
|
||||
name = "bind-configmap"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue