# chrishirsch/kuberhealthy-storage-check architecture

> Architecture diagram of the GitHub repository chrishirsch/kuberhealthy-storage-check, 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/chrishirsch/kuberhealthy-storage-check
- Repository: https://github.com/chrishirsch/kuberhealthy-storage-check

## Overview

##### Main Components

a) Core Components:
- Kuberhealthy Storage Check Controller
- Storage Check Job Creator
- PVC (Persistent Volume Claim) Manager
- Node Discovery Service
- Storage Initialization Job
- Storage Validation Job

b) External Dependencies:
- Kubernetes API Server
- Storage Provider (e.g., VMware vSAN)
- Parent Kuberhealthy System

**┌─────────────────────────────────────┐**
- Kuberhealthy System          │
- ┬───────────────────┘
- ↓
**┌─────────────────────────────────────┐**
- Storage Check Controller         │
- ┬───────────────────┘
- ↓
**┌─────────────────────────────────────┐**
- Execution Pipeline                  │
- ┘

**┌──────────────┐    ┌──────────────┐    ┌──────────────┐**
- Cleanup Old  │ → │Create & Bind │ → │Initialize    │
- Resources    │    │PVC          │    │Storage      │
- ┘    └──────────────┘    └──────────────┘
- ↓                                       ↓
**┌──────────────┐    ┌──────────────┐    ┌──────────────┐**
- Node Discovery│ ← │Validate      │ ← │Create Check  │
- & Filtering   │    │Storage       │    │Jobs         │
- ┘    └──────────────┘    └──────────────┘

##### Important Elements to Highlight

- Hexagons: External services

##### Specific Details

a) Configuration Options:
- Resource limits
- Security context settings

b) Integration Points:
- Kubernetes API interactions
- Storage class integration
- Node selection logic

##### Technical Details

- Default values (CPU: 15m, Memory: 20Mi)
- Timeout settings (15 minutes)
- Check interval (30 minutes)
- Container images used

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External
        KH[Kuberhealthy System]
        K8S[Kubernetes API Server]
        SP[Storage Provider]
    end

    subgraph Controller
        SC["Storage Check Controller"]:::controller
        SCJ["Storage Check Job Creator"]:::controller
        PVC["PVC Manager"]:::controller
        Config["Storage Configuration"]:::config
    end

    subgraph "Execution Pipeline"
        direction TB
        Cleanup["Cleanup Old Resources"]
        Create["Create & Bind PVC"]
        Init["Initialize Storage"]
        Discovery["Node Discovery & Filtering"]
        Validate["Validate Storage"]
        Jobs["Create Check Jobs"]
    end

    subgraph "Configuration"
        direction TB
        Generic["Generic Storage Config"]:::config
        VSphere["vSphere Storage Config"]:::config
        Container["Container Config"]:::config
        Pipeline["CI/CD Pipeline"]:::config
        Tests["Test Suite"]:::test
    end

    %% Relationships
    KH --> SC
    SC --> SCJ
    SCJ --> PVC
    PVC --> K8S
    K8S --> SP

    SC --> Cleanup
    Cleanup --> Create
    Create --> Init
    Init --> Jobs
    Jobs --> Validate
    Validate --> Discovery

    Config --> SC
    Generic --> Config
    VSphere --> Config

    %% Styling
    classDef controller fill:#f9f,stroke:#333,stroke-width:2px
    classDef config fill:#fcf,stroke:#333,stroke-width:1px
    classDef test fill:#cfc,stroke:#333,stroke-width:1px

    %% Click events
    click SC "https://github.com/ChrisHirsch/kuberhealthy-storage-check/blob/main/cmd/storage-check/main.go"
    click SCJ "https://github.com/ChrisHirsch/kuberhealthy-storage-check/blob/main/cmd/storage-check/run_check.go"
    click PVC "https://github.com/ChrisHirsch/kuberhealthy-storage-check/blob/main/cmd/storage-check/storage.go"
    click Config "https://github.com/ChrisHirsch/kuberhealthy-storage-check/blob/main/cmd/storage-check/input.go"
    click Generic "https://github.com/ChrisHirsch/kuberhealthy-storage-check/blob/main/deploy/storage-check.yaml"
    click VSphere "https://github.com/ChrisHirsch/kuberhealthy-storage-check/blob/main/deploy/storage-check-vsphere.yaml"
    click Tests "https://github.com/ChrisHirsch/kuberhealthy-storage-check/blob/main/cmd/storage-check/storage_test.go"
    click Container "https://github.com/ChrisHirsch/kuberhealthy-storage-check/tree/main/Dockerfile"
    click Pipeline "https://github.com/ChrisHirsch/kuberhealthy-storage-check/blob/main/.github/workflows/go.yml"

    %% Legend
    subgraph Legend
        L1["Controller Component"]:::controller
        L2["Configuration Component"]:::config
        L3["Test Component"]:::test
    end
```
