# sysdiglabs/charts architecture

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

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

## Overview

##### Project type and purpose
- Type: This is an “infrastructure tooling” repo—specifically the official Sysdig Helm charts plus an accompanying Kubernetes Operator (rh-shield-operator).
- Purpose:
– Store and version multiple Helm charts (charts/sysdig, agent, admission-controller, etc.)
– Run chart-unit and integration tests on each change
– Automate packaging & publishing of charts to a Helm repository (gh-pages)
– Build and bundle the rh-shield Kubernetes Operator (CRDs, controller image, OLM bundle)

##### File structure
- Top-level directories:
– .github/workflows → GitHub Actions definitions (lint, unit tests, release workflows)
– charts/ → Dozens of subfolders, each a standalone Helm chart (templates, tests, values, docs)
– rh-shield-operator/ → Kubernetes operator code, CRD definitions, Dockerfiles, OLM bundle
– scripts/ → Helper scripts for version bumps, kubeconfig generation, docs-links checking
– .chglog/ → Configuration for changelog automation
- Patterns:
– Each chart subfolder follows Helm conventions (Chart.yaml, templates/, tests/)
– Tests use helm-unittest plugin + chart-testing for CI integration
– GitHub Actions drive lint → unit tests → integration tests → release
– Chart Releaser Action publishes chart packages & updates index.yaml on gh-pages

##### Key insights from README.md
- Repository hosts official Sysdig charts, automatically published when version changes
- Contribution guidelines reference .github workflows and pre-commit hooks
- Describes two test types: helm-unittest and chart-testing integration
- Outlines release process: detect new chart version → create GitHub Release → update index

##### Main components
a. Source Code Host (GitHub)
– Repo contents: charts/, rh-shield-operator/, scripts/, .chglog, .github/workflows
b. CI/CD Layer (GitHub Actions)
– Lint & Pre-commit checks
– Chart unit tests (helm-unittest)
– Integration tests (chart-testing)
– Release workflows (chart-releaser, operator image build)
c. Packaging & Repository
– Chart Releaser Action
– GitHub Releases (packaged .tgz artifacts)
– gh-pages branch hosting index.yaml & docs (charts.sysdig.com)
d. Runtime Targets
– Kubernetes clusters (end users install charts & operator via Helm/OLM)
e. External Services & Tools
– Chart-unittest plugin
– Chart-testing tool
– Helm CLI
– Docker registry (for operator images)
– OLM (Operator Lifecycle Manager)

##### Relationships & Data Flow
1. Developer pushes commits → triggers GitHub Actions
2. Workflows run lint → unit tests → integration tests
3. On chart version bump: Chart Releaser packages chart → GitHub Release → index.yaml updated on gh-pages
4. On operator change: Docker build → push image → OLM bundle packaged
5. End users add Helm repo (https://charts.sysdig.com) → helm install <chart>
6. Kubernetes cluster(s) pull charts/images → deploy components (Pods, Deployments, CRDs)

##### Architectural patterns & design principles
- Modular decomposition: Each chart is a self-contained unit with its own templates, values, tests
- GitOps/CICD: GitHub as single source of truth; workflows fully automated on push to main
- Immutable artifacts: Charts packaged as versioned tarballs; operator image versioned via Git tags
- Separation of concerns:
– charts/ for packaging only
– rh-shield-operator/ for runtime controller logic
– scripts/ for miscellaneous automation
- Declarative infrastructure: Everything expressed as YAML (Helm templates, CRDs, Kustomize in operator)

##### Essential details, avoid unnecessary zoom-in
- You don’t need to list every chart; group them as “Sysdig Helm Charts (20+ subcharts)”
- Operator’s CRDs and OLM bundle as a separate deployable

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Source Code Host
    subgraph "GitHub Repo"
        repo["GitHub Repo"]:::code
        charts["Sysdig Helm Charts (20+ subcharts)"]:::code
        rhShield["rh-shield-operator"]:::code
        scriptsComp["scripts"]:::code
        changelogComp[".chglog"]:::code
        workflowsComp[".github/workflows"]:::code
    end

    click charts "https://github.com/sysdiglabs/charts/tree/main/charts/"
    click rhShield "https://github.com/sysdiglabs/charts/tree/main/rh-shield-operator/"
    click scriptsComp "https://github.com/sysdiglabs/charts/tree/main/scripts/"
    click changelogComp "https://github.com/sysdiglabs/charts/tree/main/.chglog/"
    click workflowsComp "https://github.com/sysdiglabs/charts/tree/main/.github/workflows/"

    repo --> charts
    repo --> rhShield
    repo --> scriptsComp
    repo --> changelogComp
    repo --> workflowsComp

    %% CI/CD Layer
    repo --> CI["GitHub Actions"]:::cicd

    subgraph "CI/CD (GitHub Actions)"
        lint1["Lint Checks"]:::cicd
        lint2["PR Lint Checks"]:::cicd
        precommit[".pre-commit-config.yaml"]:::code
        unit["Helm Unit Tests"]:::cicd
        integration["Integration Tests"]:::cicd
        releaseCharts["Release: Chart Releaser"]:::cicd
        releaseOp["Release: Operator Build & Bundle"]:::cicd
    end

    click lint1 "https://github.com/sysdiglabs/charts/blob/main/.github/workflows/lint-test.yaml"
    click lint2 "https://github.com/sysdiglabs/charts/blob/main/.github/workflows/pr-lint.yaml"
    click precommit "https://github.com/sysdiglabs/charts/blob/main/.pre-commit-config.yaml"
    click unit "https://github.com/sysdiglabs/charts/blob/main/.github/workflows/helm-unit-test.yaml"
    click integration "https://github.com/sysdiglabs/charts/blob/main/.github/workflows/lint-test.yaml"
    click releaseCharts "https://github.com/sysdiglabs/charts/blob/main/.github/workflows/release.yaml"
    click releaseOp "https://github.com/sysdiglabs/charts/blob/main/.github/workflows/release-rh-shield-operator.yaml"

    CI --> lint1
    CI --> lint2
    lint1 --> unit
    lint2 --> unit
    lint1 --> integration
    precommit --> lint1
    precommit --> lint2
    unit --> integration
    integration --> releaseCharts
    integration --> releaseOp

    %% External Tools in CI
    chartUnittest["helm-unittest plugin"]:::external
    chartTesting["chart-testing tool"]:::external

    unit --> chartUnittest
    integration --> chartTesting

    %% Packaging & Repository
    releaseCharts --> ghRelease["GitHub Releases (tgz)"]:::external
    releaseCharts --> ghPages["gh-pages Helm Repo"]:::external

    %% Operator Artifact Storage
    releaseOp --> dockerRegistry["Docker Registry"]:::external
    releaseOp --> olm["OLM Bundle"]:::external

    %% End-User Consumption
    helmCLI["Helm CLI"]:::external
    helmCLI --> ghPages
    ghPages --> k8s["Kubernetes Cluster"]:::runtime
    dockerRegistry --> k8s

    %% Styles
    classDef code fill:#E8F1FF,stroke:#0366d6;
    classDef cicd fill:#FFE5B4,stroke:#FFA500;
    classDef runtime fill:#D4F7DC,stroke:#28a745;
    classDef external fill:#F0F0F0,stroke:#999;
```
