# aathith/kubesort architecture

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

- Interactive diagram: https://gitdiagram.com/aathith/kubesort
- Repository: https://github.com/aathith/kubesort

## Overview

##### Main Components

a) User Interface Layer:
- Command-line interface (CLI) component
- Input parser for kubesort commands

b) Core Processing Layer:
- Command formatter
- kubectl wrapper
- Sorting logic handler

c) Integration Layer:
- kubectl interface
- Kubernetes API interaction

**┌─────────────────────────────────────────┐**
- User Terminal                │
- ┘
- ↓
**┌─────────────────────────────────────────┐**
- KUBESORT CLI Interface          │
- ┌─────────────┐      ┌─────────────┐  │
- Command Parser│      │Input Validator│ │
- ┘      └─────────────┘  │
- ┘
- ↓
**┌─────────────────────────────────────────┐**
- Core Processing Layer           │
- ┌─────────────┐      ┌─────────────┐  │
- Sort Logic   │      │Command      │  │
- Handler      │      │Formatter    │  │
- ┘      └─────────────┘  │
- ┘
- ↓
**┌─────────────────────────────────────────┐**
- Integration Layer               │
- ┌─────────────┐      ┌─────────────┐  │
- kubectl      │      │Kubernetes   │  │
- wrapper      │ →    │API         │  │
- ┘      └─────────────┘  │
- ┘

##### Important Elements to Highlight

a) Supported Resource Types:
- Pods
- Deployments
- Services

b) Sorting Options:
- Namespace filtering capabilities

##### Additional Notes

- Version compatibility information (k8s v1.18.1, kubectl v1.18.1, bash v4.4.20)

##### Technical Details

- Bash script environment requirement
- POSIX compatibility note
- Installation path (/usr/local/bin/kubesort)
- Command syntax patterns

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef terminal fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef interface fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef core fill:#90EE90,stroke:#333,stroke-width:2px
    classDef integration fill:#FFB366,stroke:#333,stroke-width:2px
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:2px
    classDef error fill:#FFB3B3,stroke:#333,stroke-width:2px

    %% User Terminal
    Terminal["User Terminal"]:::terminal

    %% CLI Interface Layer
    subgraph CLI
        Parser["Command Parser"]:::interface
        Validator["Input Validator"]:::interface
    end

    %% Core Processing Layer
    subgraph Core
        SortLogic["Sort Logic Handler"]:::core
        CmdFormat["Command Formatter"]:::core
    end

    %% Integration Layer
    subgraph Integration
        Kubectl["kubectl wrapper"]:::integration
        K8sAPI["Kubernetes API"]:::external
    end

    %% Error Handling
    ErrorHandler["Error Handler"]:::error

    %% Connections
    Terminal --> Parser
    Parser --> Validator
    Validator --> SortLogic
    Validator -- "Invalid Input" --> ErrorHandler
    SortLogic --> CmdFormat
    CmdFormat --> Kubectl
    Kubectl --> K8sAPI

    %% Resource Types
    subgraph Resources
        direction TB
        Pods["Pods"]
        Deployments["Deployments"]
        Services["Services"]
    end

    %% Legend
    subgraph Legend
        L1["User Interface"]:::interface
        L2["Core Processing"]:::core
        L3["Integration"]:::integration
        L4["External Systems"]:::external
        L5["Error Handling"]:::error
    end

    %% Click Events
    click Parser "https://github.com/AATHITH/kubesort/tree/master/kubesort"
    click SortLogic "https://github.com/AATHITH/kubesort/tree/master/kubesort"
    click CmdFormat "https://github.com/AATHITH/kubesort/tree/master/kubesort"
    click Kubectl "https://github.com/AATHITH/kubesort/tree/master/kubesort"
    click Terminal "https://github.com/AATHITH/kubesort/blob/master/README.md"
```
