This commit is contained in:
ari committed 2025-04-07 21:55:53 -04:00
1 parent 3d5d89f8b9
commit cdddf441fe
11 files changed
+198 -33

No files matched your search

+1 -1
View File
@@ -2,4 +2,4 @@ apiVersion: v2
name: cluster
description: An infrastructure collection of manifests for homelab
type: application
version: 0.1.0
version: 0.1.1
@@ -0,0 +1,49 @@
---
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
+7
View File
@@ -0,0 +1,7 @@
# pihole:
# ip: 10.0.100.100
# image: pihole/pihole:latest
registry:
ip: 10.0.100.101
image: registry:2
+1 -2
View File
@@ -26,8 +26,7 @@ locals {
}
]
])
current_date = formatdate("YYYY-MM-DD", timestamp())
record_comment = "Updated by Terraform at ${local.current_date}"
record_comment = "Updated by Terraform"
}
output "myip" {
+50
View File
@@ -0,0 +1,50 @@
# This is the values.yaml I used on my k3s raspberrypi cluster
# if you have a problem with serviceWeb Pods not building you might need to checkout this issue:
# https://github.com/MoJo2600/pihole-kubernetes/issues/230
ingress:
enabled: true
persistentVolumeClaim:
enabled: true
serviceWeb:
loadBalancerIP: 192.168.178.201
annotations:
metallb.universe.tf/allow-shared-ip: pihole-svc
type: LoadBalancer
serviceDns:
loadBalancerIP: 192.168.178.201
annotations:
metallb.universe.tf/allow-shared-ip: pihole-svc
type: LoadBalancer
serviceDhcp:
loadBalancerIP: 192.168.178.201
annotations:
metallb.universe.tf/allow-shared-ip: pihole-svc
type: LoadBalancer
podDnsConfig:
enabled: true
policy: "None"
nameservers:
- 127.0.0.1
- 8.8.8.8
#! use an existing secret in a prod env
adminPassword: "0n4BQ2l7Dbu3ViYgd4wu"
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
extraEnvVars: {
DNSMASQ_USER: "root"
}
+21
View File
@@ -0,0 +1,21 @@
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"
}
output "ns" {
value = module.k8s-helm-charts.namespaces
}
-30
View File
@@ -1,30 +0,0 @@
resource "helm_release" "plugin-external-secrets" {
name = "external-secrets"
chart = "external-secrets"
repository = "https://charts.external-secrets.io"
version = "0.14.2"
atomic = true
namespace = "plugin-external-secrets"
create_namespace = true
}
resource "helm_release" "plugin-metallb" {
name = "metallb"
chart = "metallb"
repository = "https://metallb.github.io/metallb"
version = "0.14.9"
atomic = true
namespace = "plugin-metallb"
create_namespace = true
}
resource "helm_release" "local-chart-infrastructure" {
name = "infrastructure"
chart = "charts/infrastructure"
namespace = "default"
set = [{
name = "ns.metallb"
value = helm_release.plugin-metallb.namespace
}]
}
+25
View File
@@ -0,0 +1,25 @@
resource "helm_release" "plugins" {
for_each = var.plugins
name = each.key
chart = each.key
repository = each.value.repository
version = each.value.version
atomic = true
namespace = "plugin-${each.key}"
create_namespace = true
}
resource "helm_release" "infra" {
for_each = var.infra
name = each.key
chart = each.key
repository = each.value.repository
version = each.value.version
atomic = true
namespace = "infra-${each.key}"
create_namespace = true
}
+12
View File
@@ -0,0 +1,12 @@
output "namespaces" {
value = {
plugins = {
for k, v in helm_release.plugins :
k => v.namespace
}
infra = {
for k, v in helm_release.infra :
k => v.namespace
}
}
}
+27
View File
@@ -0,0 +1,27 @@
variable "plugins" {
type = map(object({
repository = string
version = string
values = optional(list(string), [])
}))
default = {
"external-secrets" : {
repository = "https://charts.external-secrets.io"
version = "0.14.2"
},
"metallb" : {
repository = "https://metallb.github.io/metallb"
version = "0.14.9"
}
}
}
variable "infra" {
type = map(object({
repository = string
version = string
values = optional(list(string), [])
}))
default = {}
}
+5
View File
@@ -0,0 +1,5 @@
global:
timezone: America/Toronto
nfs:
server: 10.0.10.1
rootPath: /mnt/EightTerra/k3s-cluster/direct-mounts