# trinodb/charts architecture

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

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

## Overview

##### Main Components
- Helm Charts Repository:
- Two primary charts are included: one for Trino (“charts/trino”) and one for Trino Gateway (“charts/gateway”).
- Each chart contains its own Chart.yaml, templated Kubernetes manifest files (e.g., deployments, services, ingress, autoscalers, configmaps, secrets), and specific configuration (values.yaml).
- CI/CD & Testing Infrastructure:
- Under .github/workflows you have the “ci-cd.yaml” manifest, which indicates an automated pipeline to build, test, and release these charts.
- The tests directory houses YAML files and shell scripts used for validating the charts in a Kubernetes cluster (via kind and chart-testing).
- Development Tools & Hooks:
- Pre-commit hooks (e.g., .pre-commit-config.yaml) and release configuration files show additional automation aspects that ensure documentation and code quality.

##### Relationships and Interactions
- For Trino: Deployment objects for the coordinator, worker, autoscaling configurations, and associated configuration (configmaps, secrets).
- For Trino Gateway: Deployment, ingress, services, and any authentication secrets.
- The flow from the Helm installation command (from the command line or CI pipeline) to the creation of Kubernetes resources.
- The testing process: how test scripts (in tests/) validate the deployments once helm templates are applied.
- CI/CD pipelines triggering build, helm lint checks, tests, and eventual deployments or chart packaging in the GitHub workflows.

##### Architectural Patterns
- That the charts follow a declarative deployment model. The chart templates use Helm’s templating engine to dynamically generate Kubernetes YAML.
- Separation of concerns is evident: each chart contains its own set of configurations and Kubernetes resources to support independent scaling and management (e.g., the Trino backend vs. Trino Gateway fronting the system).
- Use a modular approach to highlight that while both charts interact by being deployed on the same cluster, they serve different roles in the Trino ecosystem.

##### Specify Relevant Technologies and Tools
- Kubernetes: The target platform for all the deployments.
- Helm: The package manager used to install and manage these charts.
- CI/CD – GitHub Actions are used to test and release the charts.
- Testing tools: kind (for local clusters) and chart-testing for validating deployments.
- Pre-commit hooks help maintain code quality and documentation consistency.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Layer
    DevTools["Development Tools & Hooks"]:::tools
    CICD["CI/CD Pipeline (GitHub Actions)"]:::cicd
    Testing["Testing Infrastructure"]:::testing

    %% Helm Charts Repository Subgraph
    subgraph "Helm Charts Repository"
        Trino["Trino Chart"]:::helm
        Gateway["Trino Gateway Chart"]:::helm
    end

    %% Kubernetes Cluster Subgraph
    subgraph "Kubernetes Cluster"
        TC["Coordinator Deployment"]:::k8s
        TW["Worker Deployment"]:::k8s
        TA["Autoscaler Configuration"]:::k8s
        TConfig["ConfigMaps & Secrets"]:::k8s
        GD["Gateway Deployment"]:::k8s
        GI["Ingress"]:::k8s
        GS["Services"]:::k8s
        GSec["Authentication Secrets"]:::k8s
    end

    %% Connections
    DevTools --> CICD
    CICD -->|"triggers"| Trino
    CICD -->|"triggers"| Gateway
    Trino -->|"deploys"| TC
    Trino -->|"deploys"| TW
    Trino -->|"configures"| TA
    Trino -->|"configures"| TConfig
    Gateway -->|"deploys"| GD
    Gateway -->|"creates"| GI
    Gateway -->|"creates"| GS
    Gateway -->|"configures"| GSec
    CICD -->|"initiates tests"| Testing
    Testing -->|"validates deployments"| TC
    Testing -->|"validates deployments"| TW
    Testing -->|"validates deployments"| TA
    Testing -->|"validates deployments"| TConfig
    Testing -->|"validates deployments"| GD
    Testing -->|"validates deployments"| GI
    Testing -->|"validates deployments"| GS
    Testing -->|"validates deployments"| GSec

    %% Click Events
    click CICD "https://github.com/trinodb/charts/blob/main/.github/workflows/ci-cd.yaml"
    click Trino "https://github.com/trinodb/charts/tree/main/charts/trino"
    click Gateway "https://github.com/trinodb/charts/tree/main/charts/gateway"
    click Testing "https://github.com/trinodb/charts/tree/main/tests"
    click DevTools "https://github.com/trinodb/charts/blob/main/.pre-commit-config.yaml"

    %% Styles
    classDef cicd fill:#AED6F1,stroke:#1F618D,stroke-width:2px,color:#1F618D;
    classDef tools fill:#D5F5E3,stroke:#27AE60,stroke-width:2px,color:#27AE60;
    classDef helm fill:#FFF2CC,stroke:#F1C40F,stroke-width:2px,color:#875A00;
    classDef k8s fill:#FDEDEC,stroke:#CD6155,stroke-width:2px,color:#922B21;
    classDef testing fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px,color:#5B2C6F;
```
