From 95c52f768df8dbc4d1d59a6691de385a959cee6d Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Fri, 11 Apr 2025 19:24:21 -0400 Subject: [PATCH] Latest stable --- charts/infrastructure/Chart.yaml | 2 +- .../templates/docker-registry.yml | 49 ------------------- charts/infrastructure/values.yaml | 4 -- dns.tf | 2 +- modules.tf | 43 +++++++++------- provider.tf | 7 +-- 6 files changed, 31 insertions(+), 76 deletions(-) delete mode 100644 charts/infrastructure/templates/docker-registry.yml diff --git a/charts/infrastructure/Chart.yaml b/charts/infrastructure/Chart.yaml index 9322196..5e14aea 100644 --- a/charts/infrastructure/Chart.yaml +++ b/charts/infrastructure/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v2 name: cluster description: An infrastructure collection of manifests for homelab type: application -version: 0.1.1 +version: 0.1.2 diff --git a/charts/infrastructure/templates/docker-registry.yml b/charts/infrastructure/templates/docker-registry.yml deleted file mode 100644 index 14a0415..0000000 --- a/charts/infrastructure/templates/docker-registry.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: registry -spec: - selector: - matchLabels: - app: registry - replicas: 1 - template: - metadata: - labels: - app: registry - spec: - containers: - - name: registry - image: "{{ .Values.registry.image }}" - ports: - - containerPort: 5000 - volumeMounts: - - name: storage - mountPath: /var/lib/registry - env: - - name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY - value: /var/lib/registry - resources: - requests: - cpu: 0.1 - memory: 250Mi - volumes: - - name: storage - nfs: - server: "{{ .Values.global.nfs.server }}" - path: "{{ .Values.global.nfs.rootPath }}/docker-registry" ---- -apiVersion: v1 -kind: Service -metadata: - name: registry - annotations: - metallb.universe.tf/loadBalancerIPs: "{{ .Values.registry.ip }}" -spec: - type: LoadBalancer - ports: - - port: 80 - targetPort: 5000 - selector: - app: registry diff --git a/charts/infrastructure/values.yaml b/charts/infrastructure/values.yaml index 3effd8f..faf814f 100644 --- a/charts/infrastructure/values.yaml +++ b/charts/infrastructure/values.yaml @@ -1,7 +1,3 @@ -# pihole: -# ip: 10.0.100.100 -# image: pihole/pihole:latest - registry: ip: 10.0.100.101 image: registry:2 \ No newline at end of file diff --git a/dns.tf b/dns.tf index 8b18898..8e5744c 100644 --- a/dns.tf +++ b/dns.tf @@ -41,7 +41,7 @@ resource "cloudflare_dns_record" "this" { zone_id = each.value.zone_id comment = local.record_comment content = each.value.ip - name = each.value.record + name = each.key type = each.value.type proxied = false ttl = 1 diff --git a/modules.tf b/modules.tf index 6035b9a..dbf95d7 100644 --- a/modules.tf +++ b/modules.tf @@ -1,21 +1,28 @@ -# resource "helm_release" "local-chart-infrastructure" { -# name = "infrastructure" -# chart = "charts/infrastructure" -# namespace = "default" -# set = [{ -# name = "ns.metallb" -# value = module.k8s-helm-charts.namespaces.plugins.metallb -# }] -# values = [file("./values.yaml")] -# timeout = 120 -# force_update = true -# }` +resource "helm_release" "local-chart-infrastructure" { + name = "infrastructure" + chart = "charts/infrastructure" + namespace = "default" + set = [{ + name = "ns.metallb" + value = module.k8s-helm-charts.namespaces.plugins.metallb + }] + values = [file("./values.yaml")] + timeout = 120 + force_update = true +} -# module "k8s-helm-charts" { -# source = "./tf-modules/k8s-helm-charts" -# } +module "k8s-helm-charts" { + source = "./tf-modules/k8s-helm-charts" +} -# output "ns" { -# value = module.k8s-helm-charts.namespaces -# } +output "ns" { + value = module.k8s-helm-charts.namespaces +} + + +resource "kubernetes_namespace" "test" { + metadata { + name = "test" + } +} diff --git a/provider.tf b/provider.tf index cc44319..9a87cdd 100644 --- a/provider.tf +++ b/provider.tf @@ -1,7 +1,8 @@ terraform { backend "kubernetes" { - secret_suffix = "homelab" - namespace = "default" + secret_suffix = "homelab" + namespace = "default" + config_context = "homelab" } } @@ -27,7 +28,7 @@ terraform { } provider "helm" { - kubernetes { + kubernetes = { config_context = "homelab" } }