# stevesea/argocd-helm-app-of-apps-example architecture

> Architecture diagram of the GitHub repository stevesea/argocd-helm-app-of-apps-example, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stevesea/argocd-helm-app-of-apps-example
- Repository: https://github.com/stevesea/argocd-helm-app-of-apps-example

## Overview

##### Project Type & Purpose
- This is a GitOps/CD “deployment” repository containing two Helm charts (`argocd-example-apps` and `argocd-example-infra`).
- Its sole purpose is to generate Argo CD AppProject and Application CRDs for multiple environments (test, staging, production) using the “App-of-Apps” pattern.

##### Main Components
a. Git Repositories
- This repo: Helm charts + values files per environment
- Application/deployment repos for each microservice (external)
b. CI/CD Pipelines
- CI pipeline in app repo (build/push Docker image, bump SemVer)
- CD pipeline in this repo (update manifests, merge branches, helm lint & package)
c. Artifact Stores
- Docker registry (for images)
- Helm chart repository (optional)
d. Argo CD Control Plane
- Argo CD server & repo-server deployed in Kubernetes
e. Kubernetes Cluster(s)
- One cluster per environment (namespaces: test, staging, production)
f. Helm Templating Engine (CLI or library)
- Renders `applications.yaml` & `projects.yaml` into CRDs

##### Relationships & Data Flows
➀ Developer pushes code → triggers CI in app repo → builds Docker image → pushes to Docker registry → tags app repo
➁ CI triggers CD pipeline in deployment repo → updates values/manifests on `master` → merges to `test` branch
➂ Argo CD instance (test) auto-syncs this repo’s `test` branch → helm template → generates AppProject & Application CRDs → applies to `argocd` namespace
➃ Argo CD then reads those generated Application CRDs → clones each microservice deployment repo → syncs Kubernetes manifests into the `test` namespace
➄ Promotion (test→staging→prod) happens via Git merge requests in the deployment repo; Argo CD for each environment auto-syncs its corresponding branch

##### Architectural Patterns & Design Principles
- GitOps: desired state pinned in Git branches
- App-of-Apps: one “umbrella” Argo CD Application per chart, which itself creates child Applications
- Environment isolation: separate branches and k8s namespaces/clusters
- Parameterization: Helm values maps drive per-environment generation

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CI/CD & GitOps Zone
    subgraph "CI/CD & GitOps" 
        direction TB
        Dev["Developer"]:::gitCI
        GitApps["App Deployment Repo\n(argocd-example-apps)"]:::gitCI
        GitInfra["Infra Deployment Repo\n(argocd-example-infra)"]:::gitCI
        CIApp["CI Pipeline\n(app repo)"]:::gitCI
        CD["CD Pipeline\n(deployment repo)"]:::gitCI
        DockerReg["Docker Registry"]:::gitCI

        Dev -->|"push code"| CIApp
        CIApp -->|"build & push image"| DockerReg
        DockerReg -->|"image ready"| CD
        Dev -->|"merge branches"| CD
    end

    %% Helm Charts in Deployment Repo
    subgraph "Deployment Repo – Helm Charts" 
        direction TB
        subgraph "argocd-example-apps"
            direction TB
            AppsDir["argocd-example-apps"]:::gitCI
            AppsChart["Chart.yaml"]:::gitCI
            AppsValues["values.yaml"]:::gitCI
            AppsTestVals["test-values.yaml"]:::gitCI
            AppsStagingVals["staging-values.yaml"]:::gitCI
            AppsProdVals["production-values.yaml"]:::gitCI
            subgraph "templates"
                direction TB
                AppsAppsTpl["applications.yaml"]:::gitCI
                AppsProjTpl["projects.yaml"]:::gitCI
            end
        end
        subgraph "argocd-example-infra"
            direction TB
            InfraDir["argocd-example-infra"]:::gitCI
            InfraChart["Chart.yaml"]:::gitCI
            InfraValues["values.yaml"]:::gitCI
            InfraTestVals["test-values.yaml"]:::gitCI
            InfraStagingVals["staging-values.yaml"]:::gitCI
            InfraProdVals["production-values.yaml"]:::gitCI
            subgraph "templates"
                direction TB
                InfraAppsTpl["applications.yaml"]:::gitCI
                InfraProjTpl["projects.yaml"]:::gitCI
            end
        end

        CD -->|"helm lint & package\nhelm template"| AppsDir
        CD -->|"helm lint & package\nhelm template"| InfraDir
    end

    %% Argo CD Control Plane
    subgraph "Argo CD Control Plane"
        direction TB
        ArgoServer["Argo CD Server"]:::argocd
        RepoServer["Argo CD Repo-Server"]:::argocd
        AppsChart --> ArgoServer
        InfraDir --> ArgoServer
        ArgoServer --> RepoServer
    end

    %% Kubernetes Clusters Zone
    subgraph "Kubernetes Clusters"
        direction TB
        subgraph "Test Cluster"
            direction TB
            ARTest["Argo CD Application (test)"]:::cluster
            MSDeployTest["Microservice Deployments\n(test ns)"]:::cluster
        end
        subgraph "Staging Cluster"
            direction TB
            ARStage["Argo CD Application (staging)"]:::cluster
            MSDeployStage["Microservice Deployments\n(staging ns)"]:::cluster
        end
        subgraph "Production Cluster"
            direction TB
            ARProd["Argo CD Application (production)"]:::cluster
            MSDeployProd["Microservice Deployments\n(prod ns)"]:::cluster
        end

        RepoServer -->|"sync test branch"| ARTest
        ARTest -->|"deploy CRDs"| MSDeployTest

        RepoServer -->|"sync staging branch"| ARStage
        ARStage -->|"deploy CRDs"| MSDeployStage

        RepoServer -->|"sync production branch"| ARProd
        ARProd -->|"deploy CRDs"| MSDeployProd
    end

    %% Styles
    classDef gitCI fill:#D0E6FF,stroke:#0366D6,color:#0366D6;
    classDef argocd fill:#DFFFE0,stroke:#2C662D,color:#2C662D;
    classDef cluster fill:#FFE8CC,stroke:#C96300,color:#C96300;

    %% Click Events for Apps Chart
    click AppsDir "https://github.com/stevesea/argocd-helm-app-of-apps-example/tree/master/argocd-example-apps/"
    click AppsChart "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-apps/Chart.yaml"
    click AppsValues "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-apps/values.yaml"
    click AppsTestVals "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-apps/test-values.yaml"
    click AppsStagingVals "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-apps/staging-values.yaml"
    click AppsProdVals "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-apps/production-values.yaml"
    click AppsAppsTpl "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-apps/templates/applications.yaml"
    click AppsProjTpl "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-apps/templates/projects.yaml"

    %% Click Events for Infra Chart
    click InfraDir "https://github.com/stevesea/argocd-helm-app-of-apps-example/tree/master/argocd-example-infra/"
    click InfraChart "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-infra/Chart.yaml"
    click InfraValues "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-infra/values.yaml"
    click InfraTestVals "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-infra/test-values.yaml"
    click InfraStagingVals "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-infra/staging-values.yaml"
    click InfraProdVals "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-infra/production-values.yaml"
    click InfraAppsTpl "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-infra/templates/applications.yaml"
    click InfraProjTpl "https://github.com/stevesea/argocd-helm-app-of-apps-example/blob/master/argocd-example-infra/templates/projects.yaml"
```
