# carv-ics-forth/distort architecture

> Architecture diagram of the GitHub repository carv-ics-forth/distort, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/carv-ics-forth/distort
- Repository: https://github.com/carv-ics-forth/distort

## Overview

DISTORT is a Kubernetes-native NVMe-over-RDMA storage system. An administrator explicitly claims discovered NVMe hardware; the manager binds claims and places partitions, an agent allocates and exports them, and CSI provisions, attaches, and mounts volumes for workloads. Application I/O then travels directly over RDMA to the storage target. The graph preserves the documented kernel/SPDK backends and readiness/ownership resources; some internal wiring is shown only at the documented subsystem level because not all source was excerpted.

Main entry points: [`cmd/distort-manager/main.go`](https://github.com/carv-ics-forth/distort/blob/main/cmd/distort-manager/main.go) (Manager runtime), [`internal/controller/nvmepartition_controller.go`](https://github.com/carv-ics-forth/distort/blob/main/internal/controller/nvmepartition_controller.go) (Partition placement), [`internal/agent/partition_manager.go`](https://github.com/carv-ics-forth/distort/blob/main/internal/agent/partition_manager.go) (Partition manager), [`cmd/distort-agent/main.go`](https://github.com/carv-ics-forth/distort/blob/main/cmd/distort-agent/main.go) (Agent runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Storage API"]
  node_nvmedevice["NVMeDevice"]
  node_deviceclaim["NVMeDeviceClaim"]
  node_partition["NVMePartition"]
  node_attachment["VolumeAttachment"]
  node_rdmanode["RDMAStorageNode"]
end

subgraph group_control["Control plane"]
  node_manager["Manager runtime<br/>[main.go]"]
  node_devicecontroller["Device inventory"]
  node_claimcontroller["Claim binding"]
  node_placement["Partition placement"]
  node_readiness["RDMA readiness"]
end

subgraph group_storage["Storage agents"]
  node_agent["Agent runtime<br/>[main.go]"]
  node_discovery["Hardware discovery<br/>[nvme_discovery.go]"]
  node_reporter["Node reporter<br/>[reporter.go]"]
  node_partitionmanager["Partition manager"]
  node_kernel["Kernel NVMe-oF<br/>[backend_kernel.go]"]
  node_spdk["SPDK NVMe-oF<br/>[backend_spdk.go]"]
end

subgraph group_consumer["CSI consumer"]
  node_csi["CSI driver<br/>[main.go]"]
  node_controllercsi["Volume lifecycle"]
  node_attachmentcsi["Consumer attachment"]
  node_nodecsi["Node mount<br/>[node_server.go]"]
  node_initiator["NVMe initiator<br/>[nvme.go]"]
end

node_admin(("Administrator"))
node_workload(("Workload PVC"))
node_rdma{{"RDMA network"}}

node_admin -->|"claims device"| node_deviceclaim
node_discovery -->|"discovers hardware"| node_nvmedevice
node_agent -->|"runs discovery"| node_discovery
node_agent -->|"runs reporter"| node_reporter
node_reporter -->|"reports readiness"| node_rdmanode
node_readiness -->|"expires stale status"| node_rdmanode
node_manager -->|"registers controller"| node_devicecontroller
node_manager -->|"registers controller"| node_claimcontroller
node_manager -->|"registers controller"| node_placement
node_manager -.->|"registers controller"| node_readiness
node_claimcontroller -->|"binds claim"| node_deviceclaim
node_claimcontroller -->|"updates ownership"| node_nvmedevice
node_devicecontroller -->|"updates capacity"| node_nvmedevice
node_placement -->|"checks claim"| node_deviceclaim
node_placement -->|"checks readiness"| node_rdmanode
node_placement -->|"assigns partition"| node_partition
node_workload -->|"requests volume"| node_csi
node_csi -->|"serves lifecycle"| node_controllercsi
node_controllercsi -->|"creates partition"| node_partition
node_partitionmanager -->|"reconciles partition"| node_partition
node_agent -->|"runs manager"| node_partitionmanager
node_partitionmanager -.->|"exports via backend"| node_kernel
node_partitionmanager -.->|"exports via backend"| node_spdk
node_kernel -->|"exports over"| node_rdma
node_spdk -->|"exports over"| node_rdma
node_controllercsi -->|"publishes volume"| node_attachmentcsi
node_attachmentcsi -->|"records ownership"| node_attachment
node_attachmentcsi -.->|"provides publish context"| node_nodecsi
node_nodecsi -->|"connects device"| node_initiator
node_initiator -->|"sends application I/O"| node_rdma
node_nodecsi -->|"mounts filesystem"| node_workload

click node_nvmedevice "https://github.com/carv-ics-forth/distort/blob/main/api/v1alpha1/nvmedevice_types.go"
click node_deviceclaim "https://github.com/carv-ics-forth/distort/blob/main/api/v1alpha1/nvmedeviceclaim_types.go"
click node_partition "https://github.com/carv-ics-forth/distort/blob/main/api/v1alpha1/nvmepartition_types.go"
click node_attachment "https://github.com/carv-ics-forth/distort/blob/main/api/v1alpha1/nvmevolumeattachment_types.go"
click node_rdmanode "https://github.com/carv-ics-forth/distort/blob/main/api/v1alpha1/rdmastoragenode_types.go"
click node_manager "https://github.com/carv-ics-forth/distort/blob/main/cmd/distort-manager/main.go"
click node_devicecontroller "https://github.com/carv-ics-forth/distort/blob/main/internal/controller/nvmedevice_controller.go"
click node_claimcontroller "https://github.com/carv-ics-forth/distort/blob/main/internal/controller/nvmedeviceclaim_controller.go"
click node_placement "https://github.com/carv-ics-forth/distort/blob/main/internal/controller/nvmepartition_controller.go"
click node_readiness "https://github.com/carv-ics-forth/distort/blob/main/internal/controller/rdmastoragenode_controller.go"
click node_agent "https://github.com/carv-ics-forth/distort/blob/main/cmd/distort-agent/main.go"
click node_discovery "https://github.com/carv-ics-forth/distort/blob/main/internal/agent/nvme_discovery.go"
click node_reporter "https://github.com/carv-ics-forth/distort/blob/main/internal/agent/reporter.go"
click node_partitionmanager "https://github.com/carv-ics-forth/distort/blob/main/internal/agent/partition_manager.go"
click node_kernel "https://github.com/carv-ics-forth/distort/blob/main/internal/agent/plugins/backend_kernel.go"
click node_spdk "https://github.com/carv-ics-forth/distort/blob/main/internal/agent/plugins/backend_spdk.go"
click node_csi "https://github.com/carv-ics-forth/distort/blob/main/cmd/distort-csi/main.go"
click node_controllercsi "https://github.com/carv-ics-forth/distort/blob/main/internal/csi/controller_server.go"
click node_attachmentcsi "https://github.com/carv-ics-forth/distort/blob/main/internal/csi/controller_attachment.go"
click node_nodecsi "https://github.com/carv-ics-forth/distort/blob/main/internal/csi/node_server.go"
click node_initiator "https://github.com/carv-ics-forth/distort/blob/main/internal/csi/nvme.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_nvmedevice,node_deviceclaim,node_partition,node_attachment,node_rdmanode toneBlue
class node_manager,node_devicecontroller,node_claimcontroller,node_placement,node_readiness toneAmber
class node_agent,node_discovery,node_reporter,node_partitionmanager,node_kernel,node_spdk toneMint
class node_csi,node_controllercsi,node_attachmentcsi,node_nodecsi,node_initiator toneRose
class node_admin,node_workload,node_rdma toneIndigo
```

## Components

### Storage API

- [NVMeDevice](https://github.com/carv-ics-forth/distort/blob/main/api/v1alpha1/nvmedevice_types.go): `api/v1alpha1/nvmedevice_types.go`
- [NVMeDeviceClaim](https://github.com/carv-ics-forth/distort/blob/main/api/v1alpha1/nvmedeviceclaim_types.go): `api/v1alpha1/nvmedeviceclaim_types.go`
- [NVMePartition](https://github.com/carv-ics-forth/distort/blob/main/api/v1alpha1/nvmepartition_types.go): `api/v1alpha1/nvmepartition_types.go`
- [VolumeAttachment](https://github.com/carv-ics-forth/distort/blob/main/api/v1alpha1/nvmevolumeattachment_types.go): `api/v1alpha1/nvmevolumeattachment_types.go`
- [RDMAStorageNode](https://github.com/carv-ics-forth/distort/blob/main/api/v1alpha1/rdmastoragenode_types.go): `api/v1alpha1/rdmastoragenode_types.go`

### Control plane

- [Manager runtime](https://github.com/carv-ics-forth/distort/blob/main/cmd/distort-manager/main.go): `cmd/distort-manager/main.go`
- [Device inventory](https://github.com/carv-ics-forth/distort/blob/main/internal/controller/nvmedevice_controller.go): `internal/controller/nvmedevice_controller.go`
- [Claim binding](https://github.com/carv-ics-forth/distort/blob/main/internal/controller/nvmedeviceclaim_controller.go): `internal/controller/nvmedeviceclaim_controller.go`
- [Partition placement](https://github.com/carv-ics-forth/distort/blob/main/internal/controller/nvmepartition_controller.go): `internal/controller/nvmepartition_controller.go`
- [RDMA readiness](https://github.com/carv-ics-forth/distort/blob/main/internal/controller/rdmastoragenode_controller.go): `internal/controller/rdmastoragenode_controller.go`

### Storage agents

- [Agent runtime](https://github.com/carv-ics-forth/distort/blob/main/cmd/distort-agent/main.go): `cmd/distort-agent/main.go`
- [Hardware discovery](https://github.com/carv-ics-forth/distort/blob/main/internal/agent/nvme_discovery.go): `internal/agent/nvme_discovery.go`
- [Node reporter](https://github.com/carv-ics-forth/distort/blob/main/internal/agent/reporter.go): `internal/agent/reporter.go`
- [Partition manager](https://github.com/carv-ics-forth/distort/blob/main/internal/agent/partition_manager.go): `internal/agent/partition_manager.go`
- [Kernel NVMe-oF](https://github.com/carv-ics-forth/distort/blob/main/internal/agent/plugins/backend_kernel.go): `internal/agent/plugins/backend_kernel.go`
- [SPDK NVMe-oF](https://github.com/carv-ics-forth/distort/blob/main/internal/agent/plugins/backend_spdk.go): `internal/agent/plugins/backend_spdk.go`

### CSI consumer

- [CSI driver](https://github.com/carv-ics-forth/distort/blob/main/cmd/distort-csi/main.go): `cmd/distort-csi/main.go`
- [Volume lifecycle](https://github.com/carv-ics-forth/distort/blob/main/internal/csi/controller_server.go): `internal/csi/controller_server.go`
- [Consumer attachment](https://github.com/carv-ics-forth/distort/blob/main/internal/csi/controller_attachment.go): `internal/csi/controller_attachment.go`
- [Node mount](https://github.com/carv-ics-forth/distort/blob/main/internal/csi/node_server.go): `internal/csi/node_server.go`
- [NVMe initiator](https://github.com/carv-ics-forth/distort/blob/main/internal/csi/nvme.go): `internal/csi/nvme.go`

### Other components

- **Administrator**
- **Workload PVC**
- **RDMA network**

## Connections

- Administrator → NVMeDeviceClaim: claims device (evidence: `README.md`)
- Hardware discovery → NVMeDevice: discovers hardware (evidence: `README.md`)
- Agent runtime → Hardware discovery: runs discovery (evidence: `cmd/distort-agent/main.go`)
- Agent runtime → Node reporter: runs reporter (evidence: `cmd/distort-agent/main.go`)
- Node reporter → RDMAStorageNode: reports readiness (evidence: `README.md`)
- RDMA readiness → RDMAStorageNode: expires stale status (evidence: `internal/controller/rdmastoragenode_controller.go`)
- Manager runtime → Device inventory: registers controller (evidence: `cmd/distort-manager/main.go`)
- Manager runtime → Claim binding: registers controller (evidence: `cmd/distort-manager/main.go`)
- Manager runtime → Partition placement: registers controller (evidence: `cmd/distort-manager/main.go`)
- Manager runtime → RDMA readiness: registers controller
- Claim binding → NVMeDeviceClaim: binds claim (evidence: `README.md`)
- Claim binding → NVMeDevice: updates ownership (evidence: `internal/controller/nvmedeviceclaim_controller.go`)
- Device inventory → NVMeDevice: updates capacity (evidence: `internal/controller/nvmedevice_controller.go`)
- Partition placement → NVMeDeviceClaim: checks claim (evidence: `internal/controller/nvmepartition_controller.go`)
- Partition placement → RDMAStorageNode: checks readiness (evidence: `internal/controller/nvmepartition_controller.go`)
- Partition placement → NVMePartition: assigns partition (evidence: `README.md`)
- Workload PVC → CSI driver: requests volume (evidence: `README.md`)
- CSI driver → Volume lifecycle: serves lifecycle (evidence: `cmd/distort-csi/main.go`)
- Volume lifecycle → NVMePartition: creates partition (evidence: `internal/csi/controller_server.go`)
- Partition manager → NVMePartition: reconciles partition (evidence: `README.md`)
- Agent runtime → Partition manager: runs manager (evidence: `cmd/distort-agent/main.go`)
- Partition manager → Kernel NVMe-oF: exports via backend
- Partition manager → SPDK NVMe-oF: exports via backend
- Kernel NVMe-oF → RDMA network: exports over (evidence: `README.md`)
- SPDK NVMe-oF → RDMA network: exports over (evidence: `README.md`)
- Volume lifecycle → Consumer attachment: publishes volume (evidence: `internal/csi/controller_attachment.go`)
- Consumer attachment → VolumeAttachment: records ownership (evidence: `README.md`)
- Consumer attachment → Node mount: provides publish context
- Node mount → NVMe initiator: connects device (evidence: `README.md`)
- NVMe initiator → RDMA network: sends application I/O (evidence: `README.md`)
- Node mount → Workload PVC: mounts filesystem (evidence: `README.md`)
