# mpepping/podshell architecture

> Architecture diagram of the GitHub repository mpepping/podshell, 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/mpepping/podshell
- Repository: https://github.com/mpepping/podshell

## Overview

##### Main Components Identification

a) Container Image Layer:
- User space environment (podshell user with UID 1000)
- Root access capability via sudo

b) Package Management Systems:
- Two parallel package managers:
- binenv (for GitHub releases)
- dbin (for Toolpacks repository)

c) Deployment Options:
- Kubernetes deployment paths
- Container runtime paths (Docker/Podman)

**┌─ Kubernetes ─────────┐  ┌─ Container Runtimes ─┐**
- Pod                │  │ - Docker             │
- Deployment         │  │ - Podman             │
- DaemonSet         │  └────────────────────────┘
- ┘

**┌─ Podshell Container ──────────────────────┐**
- ┌─ User Space (UID 1000) ─────────────┐   │
- Regular user environment          │   │
- Debugging tools                   │   │
- ┘ │
- ┌─ Package Managers ──────────────────┐   │
- ┌─ binenv ─┐    ┌─ dbin ────────┐  │   │
- GitHub   │    │ Toolpacks     │  │   │
- Releases │    │ Repository    │  │   │
- ┘    └──────────────┘  │   │
- ┘ │
- ┘

**┌─ Host System ────────────────────────┐**
- Host PID                           │
- Host IPC                           │
- Host Network                       │
- Host Filesystem (/host mount)      │
- ┘

##### Important Elements

- Regular user space (e.g., blue)
- Privileged components (e.g., red)
- Package management systems (e.g., green)
- Deployment options (e.g., orange)

- Container deployment flow
- Package installation paths
- Privilege escalation path (sudo)
- Host system access (for privileged mode)

##### Notes for Implementation

- Version tags for the container image
- GitHub container registry integration
- Configuration paths for sudoers and profile.d

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Deployment
        K8S[Kubernetes Deployments]
        CR[Container Runtime]
        
        subgraph K8S_Types[Kubernetes Types]
            POD[Pod Deployment]
            DS[DaemonSet Deployment]
            DEP[Standard Deployment]
        end
        
        subgraph CR_Types[Runtime Types]
            DOCKER[Docker]
            PODMAN[Podman]
        end
        
        K8S --> K8S_Types
        CR --> CR_Types
    end
    
    subgraph Configuration
        SC[Security Context]
        MP[Mount Points]
        
        subgraph Security
            UID1000[Default: UID 1000]
            UID0[Optional: UID 0]
            SUDO[Sudo Capabilities]
        end
        
        subgraph Mounts
            HFS[Host Filesystem]
            PRIV[Privileged Mode Access]
        end
        
        SC --> Security
        MP --> Mounts
    end
    
    subgraph Container
        PKG[Package Managers]
        US[User Space]
        
        subgraph Packages
            BINENV[binenv Manager]
            DBIN[dbin Manager]
            BPATH[Binary Paths]
        end
        
        subgraph UserSpace
            PUSER[podshell user]
            TOOLS[Pre-installed Tools]
        end
        
        PKG --> Packages
        US --> UserSpace
    end
    
    %% Relationships
    K8S_Types --> Configuration
    CR_Types --> Configuration
    Security --> UserSpace
    Mounts --> UserSpace
    Packages --> UserSpace
    
    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
    classDef k8s fill:#deebff,stroke:#0052cc
    classDef runtime fill:#e3fcef,stroke:#00875a
    classDef security fill:#fff0b3,stroke:#ff991f
    classDef container fill:#f4f5f7,stroke:#6b778c
    
    class K8S,K8S_Types,POD,DS,DEP k8s
    class CR,CR_Types,DOCKER,PODMAN runtime
    class SC,Security,UID0,UID1000,SUDO security
    class PKG,US,Packages,UserSpace container
    
    %% Click Events
    click DS "https://github.com/mpepping/podshell/blob/main/k8s/daemonset.yaml"
    click DEP "https://github.com/mpepping/podshell/blob/main/k8s/deployment.yaml"
    click SUDO "https://github.com/mpepping/podshell/tree/main/include/etc/sudoers.d/10-podshell"
    click BINENV "https://github.com/mpepping/podshell/tree/main/include/usr/local/bin/_add_binenv"
    click DBIN "https://github.com/mpepping/podshell/tree/main/include/usr/local/bin/_add_dbin"
    click BPATH "https://github.com/mpepping/podshell/blob/main/include/etc/profile.d/bin-paths.sh"

    %% Legend
    subgraph Legend
        L1[Kubernetes Components]:::k8s
        L2[Runtime Components]:::runtime
        L3[Security Elements]:::security
        L4[Container Components]:::container
    end
```
