# redhat-developer/observability-operator architecture

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

- Interactive diagram: https://gitdiagram.com/redhat-developer/observability-operator
- Repository: https://github.com/redhat-developer/observability-operator

## Overview

##### Main Components

a. Core Operator Components:
- Controller Manager (central component)
- Webhook Server (for validation/mutation)
- Custom Resource Definition (CRD) for Observability
- Reconciliation Logic Components

b. External Systems:
- Observatorium Integration
- GitHub Configuration Repository
- Authentication Systems (Red Hat SSO/Dex)

c. Managed Components:
- Prometheus Stack
- Grafana
- Promtail
- AlertManager

**┌─ Observability Operator ──────────────────────┐**
- ┌─ Controller Manager ─┐ ┌─ Webhook Server ─┐ │
- Reconcilers       │ │ - Validation     │ │
- Token Management  │ │ - Mutation       │ │
- ┘ └────────────────┘ │
- ┘

**┌─ Prometheus ─┐ ┌─ Grafana ─┐ ┌─ Promtail ─┐**
- Metrics      │ │ Dashboards│ │ Logging    │
- ┘ └──────────┘ └───────────┘

**┌─ Observatorium ─┐ ┌─ GitHub Config ─┐ ┌─ Auth ─┐**
- Central Storage │ │ Service Configs │ │ SSO    │
- ┘ └────────────────┘ └────────┘

##### Important Details

a. Reconciliation Flows:
- How the operator watches for Observability CRs
- Configuration reading from GitHub
- Token management flow

b. Monitoring Stack:
- Metric collection paths
- Log aggregation flow
- Alert routing

c. Configuration Management:
- How external configs are pulled
- Secret management
- Resource creation flow

##### Implementation Details

- Controllers package structure
- Reconciler hierarchy
- Resource management patterns
- Webhook configurations

Remember to:
- Use consistent styling
- Version information
- Document all external dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Operator[Operator Core]
        CM[Controller Manager]
        WH[Webhook Server]
        CRD[Custom Resource Definition]
        RL[Reconciliation Logic]
        TF[Token Fetcher]
        MH[Metrics Handler]
    end

    subgraph Managed[Managed Components]
        PS[Prometheus Stack]
        GF[Grafana]
        PT[Promtail]
        AM[AlertManager]
    end

    subgraph External[External Systems]
        OBS[Observatorium]
        GH[GitHub Config Repo]
        AUTH[Red Hat SSO/Dex]
    end

    %% Core Component Relationships
    CRD --> CM
    CM --> WH
    CM --> RL
    RL --> TF
    RL --> MH

    %% Managed Component Control
    RL --> PS
    RL --> GF
    RL --> PT
    RL --> AM

    %% External System Interactions
    TF --> AUTH
    RL --> OBS
    RL --> GH

    %% Data Flows
    PS -.-> OBS
    GF -.-> OBS
    PT -.-> OBS
    AM -.-> OBS

    %% Click Events
    click CRD "https://github.com/redhat-developer/observability-operator/blob/main/api/v1/observability_types.go"
    click WH "https://github.com/redhat-developer/observability-operator/blob/main/api/v1/observability_webhook.go"
    click CM "https://github.com/redhat-developer/observability-operator/blob/main/controllers/observability_controller.go"
    click RL "https://github.com/redhat-developer/observability-operator/blob/main/controllers/reconcilers/reconciler.go"
    click PS "https://github.com/redhat-developer/observability-operator/blob/main/controllers/model/prometheus_resources.go"
    click GF "https://github.com/redhat-developer/observability-operator/blob/main/controllers/model/grafana_resources.go"
    click PT "https://github.com/redhat-developer/observability-operator/blob/main/controllers/model/promtail_resources.go"
    click AM "https://github.com/redhat-developer/observability-operator/blob/main/controllers/model/alertmanager_resources.go"
    click TF "https://github.com/redhat-developer/observability-operator/blob/main/controllers/token/token_fetcher.go"
    click MH "https://github.com/redhat-developer/observability-operator/blob/main/controllers/metrics/metrics.go"

    %% Styling
    classDef operator fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef managed fill:#90EE90,stroke:#333,stroke-width:2px
    classDef external fill:#E8E8E8,stroke:#333,stroke-width:2px

    class CM,WH,CRD,RL,TF,MH operator
    class PS,GF,PT,AM managed
    class OBS,GH,AUTH external

    %% Legend
    subgraph Legend
        L1[Operator Component]:::operator
        L2[Managed Component]:::managed
        L3[External System]:::external
        L4[Control Flow]
        L5[Data Flow]
    end
```
