From 51179673cea863de408d05259b4642f24b295de9 Mon Sep 17 00:00:00 2001 From: pierre geeraert Date: Sun, 11 Oct 2026 11:32:54 +0100 Subject: [PATCH] adding namespace --- core/module.tf | 17 +++++++++++++++++ core/services.tf | 4 +++- core/testing_new_storage.yaml | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 core/testing_new_storage.yaml diff --git a/core/module.tf b/core/module.tf index e618a0a..2e5c601 100644 --- a/core/module.tf +++ b/core/module.tf @@ -75,6 +75,11 @@ variable "kubernetes" { } +variable "shunt_docker" { + type = bool + default = true +} + locals { pvc_list = flatten([ @@ -144,3 +149,15 @@ resource "kubernetes_manifest" "manifest" { provider = kubernetes } +resource "kubernetes_namespace_v1" "automatic" { + for_each = { for key, value in var.kubernetes : key => value if value.enabled == true && value.connected_namespace == "" } + metadata { + annotations = { + name = coalesce(each.value.namespace, each.key) + } + labels = { + deployment_method = "Terraform" + } + name = coalesce(each.value.namespace, each.key) + } +} \ No newline at end of file diff --git a/core/services.tf b/core/services.tf index f91a950..a6e4480 100644 --- a/core/services.tf +++ b/core/services.tf @@ -88,6 +88,8 @@ resource "kubernetes_service_v1" "automatic_service_redis" { resource "docker_network" "terraform_network" { - name = "deployment_network" + #avoiding this to create if the shunt_docker is on + count = var.shunt_docker ? 0 : 1 + name = "deployment_network" } diff --git a/core/testing_new_storage.yaml b/core/testing_new_storage.yaml new file mode 100644 index 0000000..41ffa5c --- /dev/null +++ b/core/testing_new_storage.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + labels: + app: nginx +spec: + replicas: 3 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.14.2 + ports: + - containerPort: 80 + + + volumeMounts: + - name: data + mountPath: /hello + + volumes: + - name: data + hostPath: + path: /data/kubernetes/degoog/degoog-data-pvc + type: DirectoryOrCreate +