adding namespace

This commit is contained in:
pierre geeraert
2026-10-11 11:32:54 +01:00
parent caac327b50
commit 51179673ce
3 changed files with 53 additions and 1 deletions
+17
View File
@@ -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)
}
}
+3 -1
View File
@@ -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"
}
+33
View File
@@ -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