# broersma-forslund/homelab architecture

> Architecture diagram of the GitHub repository broersma-forslund/homelab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/broersma-forslund/homelab
- Repository: https://github.com/broersma-forslund/homelab

## Overview

##### Project type and purpose
- This is an infrastructure-as-code repository for a HomeLab Kubernetes cluster running on Talos Kubernetes OS.
- It defines cluster bootstrap (talos/…), GitOps-driven app deployment (apps/…), secrets sealing (kubeseal), and networking (udm/bgpd.conf).
- Argo CD (in apps/cluster/argocd) watches this repo and continuously applies Helm charts across “apps” sub-directories.

##### File structure
- Top-level:
- apps/ – Helm charts organized by purpose: cluster infra, connectivity, devices, home, media, monitoring, storage
- talos/ – machine-config templates, node definitions, patches, upgrade scripts
- udm/ – edge router BGP config
- apps/_base contains common Helm base charts. apps/cluster holds cluster-centric apps (Argo CD, Kyverno, Sealed-Secrets, metrics-server, descheduler, etc.).
- Each sub-directory under apps has Chart.yaml, templates/, values.yaml—indicating a micro-chart per service.
- Presence of secrets-sealed, namespace templates, Grafana dashboards, ingress definitions, PVCs, StatefulSets indicates typical Kubernetes resources.

##### Key README insights
- Describes using talosctl to generate/apply control-plane and worker configs.
- Mentions tools: talosctl, kubectl, kubeseal.

##### Detail
- Namespaces if useful
- Persistent volume provisioning by Ceph and Postgres clusters
- Secrets flow: sealed → unsealed by controller at runtime
- Don’t overthink—focus on clear separation: infrastructure (Talos, bootstrapping), orchestration (Argo CD, Kubernetes API), platform services (networking, storage, monitoring), application workloads.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% GitOps Layer
    GitRepo["GitOps Repository"]:::cloud
    ArgoCD["Argo CD"]:::orchestrator
    GitRepo -->|"polls"| ArgoCD
    click GitRepo "https://github.com/broersma-forslund/homelab/tree/main//"
    click ArgoCD "https://github.com/broersma-forslund/homelab/tree/main/apps/cluster/argocd"

    %% Bootstrap Layer
    subgraph "Bootstrap (Talos)" 
        direction TB
        CP1["Control-Plane Node 1"]:::controlplane
        CP2["Control-Plane Node 2"]:::controlplane
        CP3["Control-Plane Node 3"]:::controlplane
        WP1["Worker Node 1"]:::workernode
        WP2["Worker Node 2"]:::workernode
        WP3["Worker Node 3"]:::workernode
        WP4["Worker Node 4"]:::workernode
        WP5["Worker Node 5"]:::workernode
        Patches["Machine Patches & Scripts"]:::script
        click CP1 "https://github.com/broersma-forslund/homelab/blob/main/talos/nodes/talos-control-plane-1.yaml"
        click CP2 "https://github.com/broersma-forslund/homelab/blob/main/talos/nodes/talos-control-plane-2.yaml"
        click CP3 "https://github.com/broersma-forslund/homelab/blob/main/talos/nodes/talos-control-plane-3.yaml"
        click WP1 "https://github.com/broersma-forslund/homelab/blob/main/talos/nodes/talos-worker-1.yaml"
        click WP2 "https://github.com/broersma-forslund/homelab/blob/main/talos/nodes/talos-worker-2.yaml"
        click WP3 "https://github.com/broersma-forslund/homelab/blob/main/talos/nodes/talos-worker-3.yaml"
        click WP4 "https://github.com/broersma-forslund/homelab/blob/main/talos/nodes/talos-worker-4.yaml"
        click WP5 "https://github.com/broersma-forslund/homelab/blob/main/talos/nodes/talos-worker-5.yaml"
        click Patches "https://github.com/broersma-forslund/homelab/tree/main/talos/patches"
        click Patches "https://github.com/broersma-forslund/homelab/tree/main/talos/scripts"
    end

    %% Kubernetes Cluster Core
    subgraph "Kubernetes Cluster" 
        direction TB
        APIServer["Kubernetes API Server"]:::service
        Cilium["Cilium CNI"]:::network
        Ingress["Ingress-NGINX"]:::network
        DNS["External-DNS"]:::network
        Sealed["Sealed-Secrets Controller"]:::security
        APIServer -->|orchestrates| WP1 & WP2 & WP3 & WP4 & WP5
        ArgoCD -->|applies charts to| APIServer
        Sealed -->|unseals secrets| APIServer
        click Cilium "https://github.com/broersma-forslund/homelab/tree/main/apps/connectivity/cilium"
        click Ingress "https://github.com/broersma-forslund/homelab/tree/main/apps/connectivity/ingress-nginx"
        click DNS "https://github.com/broersma-forslund/homelab/tree/main/apps/connectivity/private-external-dns"
        click DNS "https://github.com/broersma-forslund/homelab/tree/main/apps/connectivity/public-external-dns"
        click Sealed "https://github.com/broersma-forslund/homelab/tree/main/apps/cluster/sealed-secrets"
    end

    %% Storage Layer
    subgraph "Storage & Database"
        direction TB
        Ceph["Rook-Ceph"]:::storage
        Postgres["CloudNative-Postgres"]:::database
        APIServer -->|provisions PVs| Ceph
        APIServer -->|connects to| Postgres
        click Ceph "https://github.com/broersma-forslund/homelab/tree/main/apps/storage/rook-ceph"
        click Postgres "https://github.com/broersma-forslund/homelab/tree/main/apps/storage/cloudnative-postgres"
    end

    %% Monitoring Layer
    subgraph "Monitoring"
        direction TB
        PromGraf["Prometheus & Grafana"]:::monitoring
        Gatus["Gatus"]:::monitoring
        Perfect["PerfectScale"]:::monitoring
        APIServer -->|scrapes metrics| PromGraf
        PromGraf -->|displays in| Grafana["Grafana"]:::monitoring
        APIServer -->|health checks| Gatus
        APIServer -->|scales| Perfect
        click PromGraf "https://github.com/broersma-forslund/homelab/tree/main/apps/monitoring/kube-prometheus-stack"
        click Gatus "https://github.com/broersma-forslund/homelab/tree/main/apps/monitoring/gatus"
        click Perfect "https://github.com/broersma-forslund/homelab/tree/main/apps/monitoring/perfectscale"
    end

    %% Connectivity Layer
    subgraph "Networking & DNS"
        direction TB
        EdgeRouter["Edge Router (UDM)"]:::edge
        Cilium -->|BGP Peering| EdgeRouter
        click EdgeRouter "https://github.com/broersma-forslund/homelab/blob/main/udm/bgpd.conf"
    end

    %% Application Workloads
    subgraph "Application Workloads"
        direction TB
        subgraph "Home Tier"
            HA["Home Assistant"]:::app
            NC["Nextcloud"]:::app
            IMM["Immich"]:::app
            Mealie["Mealie"]:::app
            CC["CyberChef"]:::app
            DW["Dawarich"]:::app
            click HA "https://github.com/broersma-forslund/homelab/tree/main/apps/home/home-assistant"
            click NC "https://github.com/broersma-forslund/homelab/tree/main/apps/home/nextcloud"
            click IMM "https://github.com/broersma-forslund/homelab/tree/main/apps/home/immich"
            click Mealie "https://github.com/broersma-forslund/homelab/tree/main/apps/home/mealie"
            click CC "https://github.com/broersma-forslund/homelab/tree/main/apps/home/cyberchef"
            click DW "https://github.com/broersma-forslund/homelab/tree/main/apps/home/dawarich"
        end
        subgraph "Media Tier"
            Media["Media Services"]:::app
            click Media "https://github.com/broersma-forslund/homelab/tree/main/apps/media"
        end
        subgraph "Devices Tier"
            Dev["Device Operators & Drivers"]:::app
            click Dev "https://github.com/broersma-forslund/homelab/tree/main/apps/devices"
        end
        subgraph "Connectivity Tier"
            MQTT["EMQX (MQTT)"]:::app
            Zigbee["Zigbee2MQTT"]:::app
            click MQTT "https://github.com/broersma-forslund/homelab/tree/main/apps/connectivity/emqx"
            click Zigbee "https://github.com/broersma-forslund/homelab/tree/main/apps/connectivity/zigbee2mqtt"
        end
        Ingress -->|routes| HA & NC & IMM & Mealie & CC & DW & Media & Dev & MQTT & Zigbee
        Ceph -->|provides storage to| HA & NC & IMM & Mealie & Media & Dev
        Postgres -->|DB for| NC & IMM & Media
    end

    %% Styles
    classDef cloud fill:#D0E6F8,stroke:#0366D6;
    classDef orchestrator fill:#FDE68A,stroke:#D97706;
    classDef controlplane fill:#E0F2FE,stroke:#0284C7,shape:hexagon;
    classDef workernode fill:#FEF3C7,stroke:#CA8A04,shape:rect;
    classDef script fill:#F3F4F6,stroke:#6B7280;
    classDef service fill:#E9E7FF,stroke:#7C3AED;
    classDef network fill:#ECFCCB,stroke:#4D7C0F;
    classDef security fill:#FEE2E2,stroke:#B91C1C;
    classDef storage fill:#DBEAFE,stroke:#1E3A8A,shape:cylinder;
    classDef database fill:#E0FDF4,stroke:#0D9488,shape:cylinder;
    classDef monitoring fill:#FFF7ED,stroke:#C2410C;
    classDef edge fill:#F0F9FF,stroke:#0284C7;
    classDef app fill:#F5F3FF,stroke:#5B21B6;
```
