# winsonsou/lazarus-cluster-gitops-pro architecture

> Architecture diagram of the GitHub repository winsonsou/lazarus-cluster-gitops-pro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/winsonsou/lazarus-cluster-gitops-pro
- Repository: https://github.com/winsonsou/lazarus-cluster-gitops-pro

## Overview

This project is a GitOps repository designed to manage NKP Management Cluster resources using Kustomize and FluxCD. It orchestrates both workspace configurations (e.g., RBAC, projects) and cluster-level resources, including handling secrets via sealed secrets. The repository provides a GitOps workflow that applies configuration updates to a management cluster, with detailed instructions and scripts (the .sh files) to create sealed secrets for secure credential management.

##### And Label Main Components
- Top-Level Manifests: Include the primary Kustomization files (kustomization.yaml, workspace-kustomization.yaml, clusters-kustomization.yaml) as the entry points.
- Cluster Resources: Emphasize the structure under resources/workspaces/lazarus/cluster where various cluster configs and sealed secret scripts reside.
- External Tools & Services: Represent integrations with FluxCD (e.g., GitRepository, Kustomization CRDs), HelmRepository, and HelmRelease for installing the sealed secrets controller.
- Sealed Secrets Management: Mark the components (scripts and sealed YAML files) used to manage sensitive configuration information.

##### Relationships and Data Flow
- How the workspace kustomization splits into workspaces (directories like lazarus and phoenix) and then connects to the underlying workspace resource files (like lazarus-workspace.yaml).
- Dependency where the clusters kustomization “dependsOn” the workspace configuration.

##### Architectural Patterns and Design Principles
- GitOps Workflow: Clearly illustrate the continuous reconciliation loop provided by FluxCD and how it pulls configuration from Git.
- Separation of Concerns: Show the separation between workspace management and cluster-level management.
- Security via Sealed Secrets: Indicate the use of sealed secrets to manage sensitive credential data and include connections to the HelmRelease that installs the sealed secrets controller.

##### Specify Relevant Technologies & Frameworks
- Kustomize (for manifest management)
- FluxCD (GitOps controller managing the deployment, including GitRepository and Kustomization CRDs)
- Helm (via HelmRelease and HelmRepository for deploying sealed secrets)
- Sealed Secrets (for secure secret handling)
- Kubernetes (as the target environment for these resources)

## Diagram (Mermaid)

```mermaid
graph TD
    %% Top-Level Manifests
    MainK["kustomization.yaml"]:::kustomization
    WSK["workspace-kustomization.yaml"]:::kustomization
    CLSK["clusters-kustomization.yaml"]:::kustomization

    MainK -->|"triggers"| WSK
    MainK -->|"triggers"| CLSK

    %% Workspace Management
    subgraph "Workspace Management"
        WSK_DIR["kustomizations/workspaces/kustomization.yaml"]:::kustomization
        WS_RES["resources/workspaces/kustomization.yaml"]:::resource
        LAZ_WS["resources/workspaces/lazarus/lazarus-workspace.yaml"]:::resource
    end

    WSK --> WSK_DIR
    WSK_DIR --> WS_RES
    WS_RES --> LAZ_WS

    %% Cluster Management
    subgraph "Cluster Management"
        CLUST_K["resources/workspaces/lazarus/cluster/kustomization.yaml"]:::kustomization
        Sealed_YAML1["lazarus-workload-image-registry-mirror-credentials-sealed.yaml"]:::resource
        Sealed_YAML2["lazarus-workload-pc-credentials-for-csi-sealed.yaml"]:::resource
        Sealed_YAML3["lazarus-workload-pc-credentials-sealed.yaml"]:::resource
        Sealed_Script1["lazarus-workload-image-registry-mirror-credentials.sh"]:::resource
        Sealed_Script2["lazarus-workload-pc-credentials-for-csi.sh"]:::resource
        Sealed_Script3["lazarus-workload-pc-credentials.sh"]:::resource
        Cluster_Workload["lazarus-workload.yaml"]:::resource
    end

    CLSK --> CLUST_K
    CLUST_K --> Sealed_YAML1
    CLUST_K --> Sealed_YAML2
    CLUST_K --> Sealed_YAML3
    CLUST_K --> Sealed_Script1
    CLUST_K --> Sealed_Script2
    CLUST_K --> Sealed_Script3
    CLUST_K --> Cluster_Workload

    %% Dependency from Workspace to Cluster Management
    LAZ_WS -->|"dependsOn"| CLUST_K

    %% External GitOps Tools
    subgraph "External GitOps Tools"
        FluxRepo["FluxCD GitRepository"]:::external
        SealedController["SealedSecrets Controller (HelmRelease)"]:::external
    end

    FluxRepo -->|"appliesConfig"| MainK
    SealedController -->|"deploysSealedSecrets"| CLUST_K

    %% Click Events
    click MainK "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/kustomization.yaml"
    click WSK "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/workspace-kustomization.yaml"
    click CLSK "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/clusters-kustomization.yaml"
    click WSK_DIR "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/kustomizations/workspaces/kustomization.yaml"
    click WS_RES "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/resources/workspaces/kustomization.yaml"
    click LAZ_WS "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/resources/workspaces/lazarus/lazarus-workspace.yaml"
    click CLUST_K "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/resources/workspaces/lazarus/cluster/kustomization.yaml"
    click Sealed_YAML1 "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/resources/workspaces/lazarus/cluster/lazarus-workload-image-registry-mirror-credentials-sealed.yaml"
    click Sealed_YAML2 "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/resources/workspaces/lazarus/cluster/lazarus-workload-pc-credentials-for-csi-sealed.yaml"
    click Sealed_YAML3 "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/resources/workspaces/lazarus/cluster/lazarus-workload-pc-credentials-sealed.yaml"
    click Sealed_Script1 "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/resources/workspaces/lazarus/cluster/lazarus-workload-image-registry-mirror-credentials.sh"
    click Sealed_Script2 "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/resources/workspaces/lazarus/cluster/lazarus-workload-pc-credentials-for-csi.sh"
    click Sealed_Script3 "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/resources/workspaces/lazarus/cluster/lazarus-workload-pc-credentials.sh"
    click Cluster_Workload "https://github.com/winsonsou/lazarus-cluster-gitops-pro/blob/main/resources/workspaces/lazarus/cluster/lazarus-workload.yaml"

    %% Styles
    classDef kustomization fill:#f9f,stroke:#333,stroke-width:2px;
    classDef resource fill:#bbf,stroke:#333,stroke-width:2px;
    classDef external fill:#fdd,stroke:#333,stroke-width:2px;
```
