# cassinfra/kubedoor architecture

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

- Interactive diagram: https://gitdiagram.com/cassinfra/kubedoor
- Repository: https://github.com/cassinfra/kubedoor

## Overview

Based on our analysis of both the file tree and README, KubeDoor is a full‐stack Kubernetes resource management and monitoring platform. It is built using multiple languages and components:
- The web UI is built with Vue (in the “kubedoor-web” folder) and integrates with Grafana dashboards.
- The backend is split into several distinct but related components – there’s a master service (in “kubedoor-master”), an agent (in “kubedoor-agent-go” and “kubedoor-agent”) that interacts with K8S clusters, and an alarm component (“kubedoor-alarm”) for alert aggregation and control.
- There are also installation scripts and Helm charts (under “install/helm”) used for deploying the entire application along with its dependencies (which include external systems like VictoriaMetrics, ClickHouse, Nginx, etc.).
- Documentation and deployment guides (under “docs”) further support these components.

##### And Represent the Main Components
a. Frontend (Web UI):
– Indicate integration with Grafana and how dashboards are embedded.
b. Backend/API Layer:
c. Kubernetes Infrastructure:
d. External Dependencies:
e. Deployment & Configuration:
– Include a block for “Helm Charts & Deployment Scripts” (from the “install/helm” and “install” directories) that manage the automated deployment and configuration.
f. Additional Services:
– Represent any supporting services such as the authentication layer (NGINX basic auth, LDAP) and logging/audit components which are mentioned in the README.

##### Relationships and Data Flows
– Connect the agent components to the Kubernetes clusters, indicating how they move data (e.g., resource metrics, operational commands).
– Illustrate how the “KubeDoor Master” integrates with alarm, monitoring, and configuration tasks (e.g., pushing configuration changes to K8S or triggering alerts).

##### Architectural Patterns and Technology Choices
– Emphasize the microservices-style separation (master, agent, alarm, web) and how each microservice is independently deployable.
– Note the use of Kubernetes Admission Controllers (for resource and quota enforcement) and how the agents use these mechanisms to ensure real-time monitoring/scale adjustments.
– Mark the deployment and configuration pattern using Helm charts to indicate the DevOps practices in place.

##### Being Very Detailed
– If space permits, include a zoomed-in view of the Kubernetes component interactions (showing things like the admission webhook, Pod operations, etc.) so that the operational flow—from metric collection to alerting and then to management actions—is clear.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        WebUI["KubeDoor Web UI (Vue)"]
    end

    %% Backend/API Layer
    subgraph "Backend/API Layer"
        Master["KubeDoor Master (Core Service)"]
        Agent_Go["KubeDoor Agent (Go)"]
        Agent_Python["KubeDoor Agent (Python)"]
        Alarm["KubeDoor Alarm (Alert Manager)"]
    end

    %% Infrastructure & Kubernetes
    subgraph "Infrastructure & Kubernetes"
        K8S["Multiple K8S Clusters"]
    end

    %% External Dependencies
    subgraph "External Dependencies"
        Grafana["Grafana (Dashboard)"]
        VictoriaMetrics["VictoriaMetrics (Time-Series DB)"]
        ClickHouse["ClickHouse (Analytics DB)"]
        Nginx["Nginx (Auth/Proxy)"]
    end

    %% Deployment & Configuration
    subgraph "Deployment & Configuration"
        Helm["Helm Charts & Deployment Scripts"]
    end

    %% Documentation
    subgraph "Documentation"
        Docs["Documentation & Deployment Guides"]
    end

    %% Relationships and Data Flows
    WebUI -->|"APICalls" | Master
    WebUI -->|"EmbeddedDashboards" | Grafana

    Master -->|"TriggersAlerts" | Alarm
    Master -->|"Controls" | Agent_Go
    Master -->|"Controls" | Agent_Python
    Master -->|"ManagesWebhook" | K8S
    Agent_Go -->|"InteractsWith" | K8S
    Agent_Python -->|"InteractsWith" | K8S

    Master -->|"SendsMetrics" | VictoriaMetrics
    Master -->|"SendsData" | ClickHouse

    Helm -->|"Deploys" | WebUI
    Helm -->|"Deploys" | Master
    Helm -->|"Deploys" | Agent_Go
    Helm -->|"Deploys" | Agent_Python
    Helm -->|"Deploys" | Alarm
    Helm -->|"Deploys" | Grafana
    Helm -->|"Deploys" | VictoriaMetrics
    Helm -->|"Deploys" | ClickHouse
    Helm -->|"Deploys" | Nginx

    Docs -.->|"GuidesDeployment" | Helm

    %% Styling
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef infra fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef deployment fill:#E6E6FA,stroke:#333,stroke-width:2px;
    
    class WebUI frontend;
    class Master,Agent_Go,Agent_Python,Alarm backend;
    class K8S infra;
    class Grafana,VictoriaMetrics,ClickHouse,Nginx external;
    class Helm deployment;
    class Docs deployment;

    %% Click Events
    click WebUI "https://github.com/cassinfra/kubedoor/tree/main/src/kubedoor-web"
    click Master "https://github.com/cassinfra/kubedoor/tree/main/src/kubedoor-master"
    click Agent_Go "https://github.com/cassinfra/kubedoor/tree/main/src/kubedoor-agent-go"
    click Agent_Python "https://github.com/cassinfra/kubedoor/tree/main/src/kubedoor-agent"
    click Alarm "https://github.com/cassinfra/kubedoor/tree/main/src/kubedoor-alarm"
    click Helm "https://github.com/cassinfra/kubedoor/tree/main/install/helm"
    click Docs "https://github.com/cassinfra/kubedoor/tree/main/docs"
```
