# passbolt/charts-passbolt architecture

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

- Interactive diagram: https://gitdiagram.com/passbolt/charts-passbolt
- Repository: https://github.com/passbolt/charts-passbolt

## Overview

##### Main Components

a. Core Components:
- Passbolt Application Server (Main deployment)
- MariaDB/PostgreSQL Database (Primary and Secondary replicas)
- Redis Cache (with Sentinel)
- Email Processing System (CronJob)

b. Supporting Components:
- Ingress Controller
- Service Layer
- Secrets Management
- ConfigMaps
- Network Policies
- RBAC Components

**┌─ Ingress Layer ─────────────────────────────────┐**
- Ingress Controller                            │
- TLS Termination                               │
- Service Layer ──────────────────────────────────┤
- Passbolt Service (ClusterIP)                  │
- Application Layer ───────────────────────────────┤
- ┌─ Passbolt Pods ─────┐  ┌─ Sidecar ──────────┐ │
- Main Container    │  │ - Redis Proxy       │ │
- Init Containers   │  │   (HAProxy)         │ │
- ┘  └──────────────────────┤
- Data Layer ────────────────────────────────────┤
- ┌─ Database ─────┐  ┌─ Cache ──────┐           │
- MariaDB/       │  │ Redis +      │           │
- PostgreSQL     │  │ Sentinel     │           │
- ┘  └────────────────┘           │
- ┘

##### Key Relationships to Highlight

a. Data Flow:
- Database connections from Pods → Database
- Cache interactions between Pods → Redis
- Email processing flow for the CronJob

b. Configuration Flow:
- How ConfigMaps and Secrets are mounted into Pods
- GPG and JWT key management
- Environment variable injection points

##### Implementation Notes

- Use standard Kubernetes iconography
- Keep component sizes proportional to importance
- Related components visually
- Version information for major components
- Scaling indicators

- Proper Kubernetes iconography
- Layer management
- Export to common formats
- Collaboration features

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Ingress Layer"
        IC["Ingress Controller"]:::ingress
        TLS["TLS Termination"]:::security
    end

    subgraph "Service Layer"
        SVC["Passbolt Service"]:::service
    end

    subgraph "Application Layer"
        subgraph "Passbolt Pods"
            APP["Main Container"]:::app
            INIT["Init Containers"]:::app
        end
        
        subgraph "Sidecar"
            REDIS_PROXY["Redis Proxy (HAProxy)"]:::cache
        end
        
        HPA["Horizontal Pod Autoscaling"]:::config
        EMAIL["Email Processing CronJob"]:::app
    end

    subgraph "Data Layer"
        subgraph "Database"
            DB_PRIMARY["MariaDB/PostgreSQL Primary"]:::database
            DB_SECONDARY["MariaDB/PostgreSQL Secondary"]:::database
        end
        
        subgraph "Cache"
            REDIS["Redis"]:::cache
            SENTINEL["Redis Sentinel"]:::cache
        end
    end

    subgraph "Configuration"
        CM_APP["App Config"]:::config
        CM_ENV["Environment Config"]:::config
        
        subgraph "Secrets"
            SEC_ENV["Environment Secrets"]:::security
            SEC_GPG["GPG Keys"]:::security
            SEC_JWT["JWT Keys"]:::security
            SEC_REDIS["Redis Proxy Secrets"]:::security
            SEC_TLS["TLS Secrets"]:::security
        end
    end

    subgraph "Security"
        NETPOL["Network Policies"]:::security
        RBAC["RBAC"]:::security
        SA["Service Account"]:::security
    end

    subgraph "Key Management"
        GPG_JOB["GPG Key Creation Job"]:::security
        JWT_JOB["JWT Key Creation Job"]:::security
    end

    IC --> SVC
    SVC --> APP
    APP --> DB_PRIMARY
    DB_PRIMARY --> DB_SECONDARY
    APP --> REDIS_PROXY
    REDIS_PROXY --> REDIS
    REDIS --> SENTINEL
    
    CM_APP --> APP
    CM_ENV --> APP
    SEC_ENV --> APP
    SEC_GPG --> APP
    SEC_JWT --> APP
    SEC_REDIS --> REDIS_PROXY
    SEC_TLS --> IC
    
    NETPOL --> APP
    RBAC --> SA
    SA --> APP
    
    GPG_JOB --> SEC_GPG
    JWT_JOB --> SEC_JWT
    
    HPA --> APP
    EMAIL --> DB_PRIMARY

    %% Component Mappings
    click APP "https://github.com/passbolt/charts-passbolt/blob/main/templates/deployment.yaml"
    click EMAIL "https://github.com/passbolt/charts-passbolt/blob/main/templates/cronjob-proc-email.yaml"
    click SVC "https://github.com/passbolt/charts-passbolt/blob/main/templates/service.yaml"
    click IC "https://github.com/passbolt/charts-passbolt/blob/main/templates/ingress.yaml"
    click NETPOL "https://github.com/passbolt/charts-passbolt/blob/main/templates/networkpolicy.yaml"
    click RBAC "https://github.com/passbolt/charts-passbolt/blob/main/templates/rbac.yaml"
    click CM_APP "https://github.com/passbolt/charts-passbolt/blob/main/templates/configmap-app-config.yaml"
    click CM_ENV "https://github.com/passbolt/charts-passbolt/blob/main/templates/configmap-env.yaml"
    click SEC_ENV "https://github.com/passbolt/charts-passbolt/blob/main/templates/secret-env.yaml"
    click SEC_GPG "https://github.com/passbolt/charts-passbolt/blob/main/templates/secret-gpg.yaml"
    click SEC_JWT "https://github.com/passbolt/charts-passbolt/blob/main/templates/secret-jwt.yaml"
    click SEC_REDIS "https://github.com/passbolt/charts-passbolt/blob/main/templates/secret-redis-proxy.yaml"
    click SEC_TLS "https://github.com/passbolt/charts-passbolt/blob/main/templates/secret-tls-ingress.yaml"
    click HPA "https://github.com/passbolt/charts-passbolt/blob/main/templates/hpa.yaml"
    click SA "https://github.com/passbolt/charts-passbolt/blob/main/templates/serviceaccount.yaml"
    click GPG_JOB "https://github.com/passbolt/charts-passbolt/blob/main/templates/job-create-gpg.yaml"
    click JWT_JOB "https://github.com/passbolt/charts-passbolt/blob/main/templates/job-create-jwt.yaml"

    %% Styling
    classDef ingress fill:#808080,stroke:#000,stroke-width:2px
    classDef service fill:#808080,stroke:#000,stroke-width:2px
    classDef app fill:#3498db,stroke:#000,stroke-width:2px
    classDef database fill:#2ecc71,stroke:#000,stroke-width:2px
    classDef cache fill:#2ecc71,stroke:#000,stroke-width:2px
    classDef config fill:#f1c40f,stroke:#000,stroke-width:2px
    classDef security fill:#e74c3c,stroke:#000,stroke-width:2px
```
