# k4kratik/argo-workflows architecture

> Architecture diagram of the GitHub repository k4kratik/argo-workflows, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/k4kratik/argo-workflows
- Repository: https://github.com/k4kratik/argo-workflows

## Overview

##### “Big Picture” Layers
a. Client Layer: Represent the multiple ways users interact with the system. This includes:
- The UI (the “ui” directory contains the React–based dashboard),
- CLI tools (found under “cmd/argo” and “cmd/argoexec”),
- Client libraries in multiple languages (Golang, Java, and Python under “sdks”).
c. Workflow Management Core:
- Workflow Controller(s): Represented by “cmd/workflow-controller” and its supporting packages under “workflow/controller”. This component watches Kubernetes CRDs, schedules tasks, manages node state, and enforces policies (timeouts, retries, etc.).
- Executors: These components (found in “server”, “workflow/executor”, and related OS‐specific implementations) are responsible for running individual steps within a workflow.
d. Persistence and Archival:
- Artifact and Workflow Archive: You have folders such as “persist/sqldb” for archiving past executions, along with separate servers for archived workflows (“server/workflowarchive”).
e. Plugin & Extension Services:
- Cluster Workflow Templates, Cron Workflow Servers (“server/clusterworkflowtemplate”, “server/cronworkflow”) and event/sensor components (under “server/event”, “server/sensor”) add additional orchestration and trigger support.
f. Supporting Utilities:
- Common libraries (in “util/*”, “pkg/*” and many “workflow/*” packages) that offer shared functionality like logging, authentication (in “server/auth”), configuration, and metrics (see “workflow/metrics” and “util/telemetry”).

##### Out Component Relationships
- Additionally, include an “Infrastructure & Deployment” group which represents the Kubernetes CRDs (from the “manifests” directory) that define Argo’s deployment (e.g., workflow-controller, argo-server, RBAC rules).

##### Architectural Patterns and Design Principles
- That many internal libraries (e.g., “workflow/controller/indexes”, “workflow/util”) support efficient caching, topological sorting, and graph traversal needed to orchestrate complex DAGs of tasks.

##### Detailing Essential Elements
- Every component is labeled clearly with its name and function.

- The client front end (UI, CLI, SDKs)
- The API server and authentication mechanisms
- The workflow-control plane (controllers, executors, event/sensor triggers)
- The persistence and archival layer
- The Kubernetes cluster that hosts and orchestrates all these services

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Applications Layer
    subgraph "Client Applications"
        UI["UI Dashboard (React)"]:::client
        CLI1["CLI: Argo"]:::client
        CLI2["CLI: ArgoExec"]:::client
        SDK["SDK Clients"]:::client
    end

    %% Kubernetes Cluster: Backend Services
    subgraph "Kubernetes Cluster"
        AS["Argo Server"]:::backend
        WC["Workflow Controller"]:::backend
        EX["Executors"]:::backend
        WA["Workflow Archive"]:::storage
        subgraph "Plugin & Extension Services"
            CWT["Cluster Workflow Templates"]:::plugin
            CW["Cron Workflows"]:::plugin
            ES["Event Sources"]:::plugin
            SN["Sensors"]:::plugin
        end
        CRDS["Kubernetes CRDs"]:::infra
    end

    %% Supporting Utilities outside Kubernetes Cluster
    SU["Supporting Utilities"]:::utilities

    %% Connections from Clients to Argo Server (REST/GRPC)
    UI -->|"REST/GRPC"| AS
    CLI1 -->|"REST/GRPC"| AS
    CLI2 -->|"REST/GRPC"| AS
    SDK -->|"REST/GRPC"| AS

    %% From Argo Server to Workflow Controller (API Calls)
    AS -->|"API"| WC

    %% Bidirectional communication between Workflow Controller and Executors
    WC -->|"WorkExecution"| EX
    EX -->|"Logging"| WC

    %% Workflow Controller sends completed workflows to Workflow Archive
    WC -->|"Archive"| WA

    %% Plugin & Extension Services trigger Workflow Controller
    CWT -->|"TemplateTrigger"| WC
    CW -->|"CronTrigger"| WC
    ES -->|"EventTrigger"| WC
    SN -->|"SensorTrigger"| WC

    %% Supporting Utilities provide common functions to backend services
    SU ---|"CommonLibs"| AS
    SU ---|"CommonLibs"| WC
    SU ---|"CommonLibs"| EX
    SU ---|"CommonLibs"| WA

    %% Styling
    classDef client fill:#ADD8E6,stroke:#000080,stroke-width:2px;
    classDef backend fill:#98FB98,stroke:#006400,stroke-width:2px;
    classDef storage fill:#FFE4B5,stroke:#CD853F,stroke-width:2px;
    classDef plugin fill:#FFC0CB,stroke:#FF1493,stroke-width:2px;
    classDef infra fill:#E6E6FA,stroke:#9400D3,stroke-width:2px;
    classDef utilities fill:#F5F5F5,stroke:#696969,stroke-dasharray: 5 5,stroke-width:2px;

    %% Click Events for Client Layer
    click UI "https://github.com/k4kratik/argo-workflows/tree/master/ui"
    click CLI1 "https://github.com/k4kratik/argo-workflows/tree/master/cmd/argo"
    click CLI2 "https://github.com/k4kratik/argo-workflows/tree/master/cmd/argoexec"
    click SDK "https://github.com/k4kratik/argo-workflows/tree/master/sdks"

    %% Click Events for API/Server Entry Point
    click AS "https://github.com/k4kratik/argo-workflows/tree/master/server/apiserver"

    %% Click Events for Workflow Controller (multiple mappings)
    click WC "https://github.com/k4kratik/argo-workflows/tree/master/cmd/workflow-controller"
    click WC "https://github.com/k4kratik/argo-workflows/tree/master/workflow/controller"

    %% Click Events for Executors (multiple mappings)
    click EX "https://github.com/k4kratik/argo-workflows/tree/master/server"
    click EX "https://github.com/k4kratik/argo-workflows/tree/master/workflow/executor"

    %% Click Events for Workflow Archive / Persistence (multiple mappings)
    click WA "https://github.com/k4kratik/argo-workflows/tree/master/persist/sqldb"
    click WA "https://github.com/k4kratik/argo-workflows/tree/master/server/workflowarchive"

    %% Click Events for Plugin & Extension Services
    click CWT "https://github.com/k4kratik/argo-workflows/tree/master/server/clusterworkflowtemplate"
    click CW "https://github.com/k4kratik/argo-workflows/tree/master/server/cronworkflow"
    click ES "https://github.com/k4kratik/argo-workflows/tree/master/server/eventsource"
    click ES "https://github.com/k4kratik/argo-workflows/tree/master/server/event"
    click SN "https://github.com/k4kratik/argo-workflows/tree/master/server/sensor"

    %% Click Events for Supporting Utilities
    click SU "https://github.com/k4kratik/argo-workflows/tree/master/util"
    click SU "https://github.com/k4kratik/argo-workflows/tree/master/pkg"
    click SU "https://github.com/k4kratik/argo-workflows/tree/master/workflow/util"
```
