# supertylerc/sre-portfolio architecture

> Architecture diagram of the GitHub repository supertylerc/sre-portfolio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/supertylerc/sre-portfolio
- Repository: https://github.com/supertylerc/sre-portfolio

## Overview

##### Main Components

a. Infrastructure Layer:
- Terraform/OpenTofu Infrastructure (KVM/Libvirt virtualization)
- Packer VM Image Building
- Network Configuration

b. Kubernetes Layer:
- ArgoCD (GitOps deployment)
- Core K8s Components
- Gateway API & Networking (Cilium)

c. Observability Stack:
- Prometheus & Thanos (Metrics)
- Loki (Logging)
- Tempo (Tracing)
- OpenTelemetry Operator
- Grafana (Visualization)

d. Storage & State:
- Longhorn (Storage)
- Redis (for various components)

e. Custom Components:
- Scheduler Service
- Orchestrator (Go & Python implementations)

##### Specific Elements

a. Infrastructure Components:
- KVM/Libvirt nodes
- Network configuration
- Storage volumes
- Packer image building process

b. Kubernetes & Platform Services:
- Control plane components
- ArgoCD deployment flow
- Cert-manager and DNS configuration
- Cilium networking

c. Observability Pipeline:
- OpenTelemetry collectors
- Metrics flow (Prometheus → Thanos)
- Logging flow (→ Loki)
- Tracing flow (→ Tempo)
- Grafana as visualization layer

d. Custom Services:
- Scheduler service with its components (leader election, Redis integration)
- Orchestrator service (showing both Go and Python implementations)

##### Connection Types

- Control plane communications (double lines)

##### Additional Details

- Version/environment indicators
- High-availability configurations
- Stateful vs stateless components
- External service dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef infrastructure fill:#E6E6E6,stroke:#333
    classDef kubernetes fill:#ADD8E6,stroke:#333
    classDef observability fill:#90EE90,stroke:#333
    classDef security fill:#FFB6C1,stroke:#333
    classDef custom fill:#DDA0DD,stroke:#333
    classDef storage fill:#FFA07A,stroke:#333

    %% Infrastructure Layer
    subgraph Infrastructure
        TF["Terraform/OpenTofu"]:::infrastructure
        Packer["Packer VM Builder"]:::infrastructure
        KVM["KVM/Libvirt"]:::infrastructure
        Network["Network Config"]:::infrastructure
    end

    %% Platform Layer
    subgraph Kubernetes
        ArgoCD["ArgoCD"]:::kubernetes
        Gateway["Gateway API"]:::kubernetes
        Cilium["Cilium CNI"]:::kubernetes
        CertMgr["Cert Manager"]:::kubernetes
        ExtDNS["External DNS"]:::kubernetes
    end

    %% Storage Layer
    subgraph Storage
        Longhorn["Longhorn Storage"]:::storage
        Redis["Redis"]:::storage
    end

    %% Service Layer
    subgraph Services
        Scheduler["Scheduler Service"]:::custom
        OrchestratorGo["Orchestrator (Go)"]:::custom
        OrchestratorPy["Orchestrator (Python)"]:::custom
    end

    %% Observability Layer
    subgraph Observability
        OTEL["OpenTelemetry Operator"]:::observability
        Prometheus["Prometheus"]:::observability
        Thanos["Thanos"]:::observability
        Loki["Loki"]:::observability
        Tempo["Tempo"]:::observability
        Grafana["Grafana"]:::observability
    end

    %% Relationships
    TF --> KVM
    Packer --> KVM
    KVM --> Network
    Network --> Cilium
    ArgoCD --> Gateway
    ArgoCD --> Cilium
    ArgoCD --> CertMgr
    ArgoCD --> ExtDNS
    Cilium --> Services
    Services --> Redis
    Services --> Longhorn
    OTEL --> Prometheus
    OTEL --> Loki
    OTEL --> Tempo
    Prometheus --> Thanos
    Thanos --> Grafana
    Loki --> Grafana
    Tempo --> Grafana

    %% Click Events
    click TF "https://github.com/supertylerc/sre-portfolio/tree/main/tofu/modules/k8s-lab-libvirt"
    click Packer "https://github.com/supertylerc/sre-portfolio/tree/main/packer"
    click ArgoCD "https://github.com/supertylerc/sre-portfolio/blob/main/argo/applications/argocd.yaml"
    click Cilium "https://github.com/supertylerc/sre-portfolio/tree/main/k8s-lab/cilium"
    click CertMgr "https://github.com/supertylerc/sre-portfolio/tree/main/k8s-lab/cert-manager"
    click Prometheus "https://github.com/supertylerc/sre-portfolio/tree/main/k8s-lab/kube-prometheus-stack"
    click Thanos "https://github.com/supertylerc/sre-portfolio/tree/main/k8s-lab/thanos"
    click Loki "https://github.com/supertylerc/sre-portfolio/tree/main/k8s-lab/loki"
    click Tempo "https://github.com/supertylerc/sre-portfolio/tree/main/k8s-lab/tempo"
    click OTEL "https://github.com/supertylerc/sre-portfolio/tree/main/k8s-lab/otel-config"
    click Longhorn "https://github.com/supertylerc/sre-portfolio/tree/main/k8s-lab/longhorn"
    click Scheduler "https://github.com/supertylerc/sre-portfolio/tree/main/scheduler"
    click OrchestratorGo "https://github.com/supertylerc/sre-portfolio/tree/main/orchestrator/go"
    click OrchestratorPy "https://github.com/supertylerc/sre-portfolio/tree/main/orchestrator/python"
    click ExtDNS "https://github.com/supertylerc/sre-portfolio/tree/main/k8s-lab/external-dns"
    click Gateway "https://github.com/supertylerc/sre-portfolio/blob/main/argo/applications/gateway-api.yaml"
```
