# red-hat-storage/odf-cli architecture

> Architecture diagram of the GitHub repository red-hat-storage/odf-cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/red-hat-storage/odf-cli
- Repository: https://github.com/red-hat-storage/odf-cli

## Overview

ODF CLI is an OpenShift Data Foundation configuration and troubleshooting client. Users invoke Cobra commands that inspect or change cluster state through Kubernetes clients, Rook helpers, Ceph commands, and filesystem operations. Its principal workflow is command dispatch into a domain operation, then interaction with cluster resources or Ceph and reporting results. Major branches include health and disaster recovery diagnostics, CephFS subvolume and snapshot management, maintenance and OSD recovery, object storage, and general Ceph command passthrough. Some subsystem links below reflect README-described behavior because their implementation was not sampled.

Main entry points: [`cmd/odf/main.go`](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/main.go) (Command registration), [`cmd/odf/get`](https://github.com/red-hat-storage/odf-cli/tree/main/cmd/odf/get) (Get commands), [`cmd/odf/dr/dr.go`](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/dr/dr.go) (DR workflows), [`cmd/odf/subvolume/subvolume.go`](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/subvolume/subvolume.go) (Subvolume management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dispatch["CLI dispatch"]
  node_root["Root command<br/>[root.go]"]
  node_main["Command registration<br/>[main.go]"]
end

subgraph group_operations["Cluster operations"]
  node_set["Configuration setters"]
  node_operator["Rook operator"]
  node_maintenance["Maintenance"]
  node_purge["OSD purge<br/>[purge_osd.go]"]
  node_restore["Resource restore<br/>[crds.go]"]
end

subgraph group_diagnostics["Health and recovery"]
  node_get["Get commands"]
  node_health["Health status<br/>[cr_status.go]"]
  node_drprereq["DR prerequisites<br/>[dr.go]"]
  node_drcommands["DR workflows<br/>[dr.go]"]
end

subgraph group_storage["Ceph and object storage"]
  node_cephcmd["Ceph CLI<br/>[ceph.go]"]
  node_rados["Rados commands<br/>[rados.go]"]
  node_radosgw["RGW commands<br/>[radosgw.go]"]
  node_rbd["RBD commands<br/>[rbd.go]"]
  node_subvolume["Subvolume management<br/>[subvolume.go]"]
  node_snapshots["Snapshot management<br/>[cephfs_snap.go]"]
  node_storageclient["StorageClient resolver<br/>[storageclient.go]"]
  node_object["Object CRD controls<br/>[object.go]"]
  node_noobaacrd["NooBaa CRDs<br/>[crds.go]"]
  node_noobaa["NooBaa CLI<br/>[noobaa.go]"]
end

node_user(("Operator"))

node_user -->|"runs command"| node_root
node_main -->|"executes"| node_root
node_main -->|"registers"| node_set
node_main -->|"registers"| node_get
node_main -->|"registers"| node_maintenance
node_main -->|"registers"| node_purge
node_main -->|"registers"| node_restore
node_main -->|"registers"| node_drcommands
node_main -->|"registers"| node_cephcmd
node_main -->|"registers"| node_rados
node_main -->|"registers"| node_radosgw
node_main -->|"registers"| node_rbd
node_main -->|"registers"| node_subvolume
node_main -->|"registers"| node_snapshots
node_main -->|"registers"| node_object
node_main -->|"registers"| node_noobaa
node_get -.->|"reports status"| node_health
node_get -->|"checks prerequisites"| node_drprereq
node_drcommands -.->|"checks cluster"| node_drprereq
node_subvolume -->|"resolves config"| node_storageclient
node_snapshots -->|"resolves config"| node_storageclient
node_object -->|"installs or removes"| node_noobaacrd
node_user -.->|"restarts or configures"| node_operator
node_user -.->|"starts or stops"| node_maintenance
node_user -.->|"removes OSD"| node_purge
node_user -.->|"restores resources"| node_restore

click node_root "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/root/root.go"
click node_main "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/main.go"
click node_set "https://github.com/red-hat-storage/odf-cli/tree/main/cmd/odf/set"
click node_operator "https://github.com/red-hat-storage/odf-cli/tree/main/cmd/odf/operator"
click node_maintenance "https://github.com/red-hat-storage/odf-cli/tree/main/cmd/odf/maintenance"
click node_purge "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/purgeosd/purge_osd.go"
click node_restore "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/restore/crds.go"
click node_get "https://github.com/red-hat-storage/odf-cli/tree/main/cmd/odf/get"
click node_health "https://github.com/red-hat-storage/odf-cli/blob/main/pkg/health/cr_status.go"
click node_drprereq "https://github.com/red-hat-storage/odf-cli/blob/main/pkg/odf/dr/dr.go"
click node_drcommands "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/dr/dr.go"
click node_cephcmd "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/ceph/ceph.go"
click node_rados "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/ceph/rados.go"
click node_radosgw "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/ceph/radosgw.go"
click node_rbd "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/ceph/rbd.go"
click node_subvolume "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/subvolume/subvolume.go"
click node_snapshots "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/cephfs_snap/cephfs_snap.go"
click node_storageclient "https://github.com/red-hat-storage/odf-cli/blob/main/pkg/filesystem/storageclient.go"
click node_object "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/object/object.go"
click node_noobaacrd "https://github.com/red-hat-storage/odf-cli/blob/main/pkg/noobaa/crds.go"
click node_noobaa "https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/noobaa/noobaa.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_root,node_main toneBlue
class node_set,node_operator,node_maintenance,node_purge,node_restore toneAmber
class node_get,node_health,node_drprereq,node_drcommands toneMint
class node_cephcmd,node_rados,node_radosgw,node_rbd,node_subvolume,node_snapshots,node_storageclient,node_object,node_noobaacrd,node_noobaa toneRose
class node_user toneIndigo
```

## Components

### CLI dispatch

- [Root command](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/root/root.go): `cmd/odf/root/root.go`
- [Command registration](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/main.go): `cmd/odf/main.go`

### Cluster operations

- [Configuration setters](https://github.com/red-hat-storage/odf-cli/tree/main/cmd/odf/set): `cmd/odf/set`
- [Rook operator](https://github.com/red-hat-storage/odf-cli/tree/main/cmd/odf/operator): `cmd/odf/operator`
- [Maintenance](https://github.com/red-hat-storage/odf-cli/tree/main/cmd/odf/maintenance): `cmd/odf/maintenance`
- [OSD purge](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/purgeosd/purge_osd.go): `cmd/odf/purgeosd/purge_osd.go`
- [Resource restore](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/restore/crds.go): `cmd/odf/restore/crds.go`

### Health and recovery

- [Get commands](https://github.com/red-hat-storage/odf-cli/tree/main/cmd/odf/get): `cmd/odf/get`
- [Health status](https://github.com/red-hat-storage/odf-cli/blob/main/pkg/health/cr_status.go): `pkg/health/cr_status.go`
- [DR prerequisites](https://github.com/red-hat-storage/odf-cli/blob/main/pkg/odf/dr/dr.go): `pkg/odf/dr/dr.go`
- [DR workflows](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/dr/dr.go): `cmd/odf/dr/dr.go`

### Ceph and object storage

- [Ceph CLI](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/ceph/ceph.go): `cmd/odf/ceph/ceph.go`
- [Rados commands](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/ceph/rados.go): `cmd/odf/ceph/rados.go`
- [RGW commands](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/ceph/radosgw.go): `cmd/odf/ceph/radosgw.go`
- [RBD commands](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/ceph/rbd.go): `cmd/odf/ceph/rbd.go`
- [Subvolume management](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/subvolume/subvolume.go): `cmd/odf/subvolume/subvolume.go`
- [Snapshot management](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/cephfs_snap/cephfs_snap.go): `cmd/odf/cephfs_snap/cephfs_snap.go`
- [StorageClient resolver](https://github.com/red-hat-storage/odf-cli/blob/main/pkg/filesystem/storageclient.go): `pkg/filesystem/storageclient.go`
- [Object CRD controls](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/object/object.go): `cmd/odf/object/object.go`
- [NooBaa CRDs](https://github.com/red-hat-storage/odf-cli/blob/main/pkg/noobaa/crds.go): `pkg/noobaa/crds.go`
- [NooBaa CLI](https://github.com/red-hat-storage/odf-cli/blob/main/cmd/odf/noobaa/noobaa.go): `cmd/odf/noobaa/noobaa.go`

### Other components

- **Operator**

## Connections

- Operator → Root command: runs command (evidence: `README.md`)
- Command registration → Root command: executes (evidence: `cmd/odf/main.go`)
- Command registration → Configuration setters: registers (evidence: `cmd/odf/main.go`)
- Command registration → Get commands: registers (evidence: `cmd/odf/main.go`)
- Command registration → Maintenance: registers (evidence: `cmd/odf/main.go`)
- Command registration → OSD purge: registers (evidence: `cmd/odf/main.go`)
- Command registration → Resource restore: registers (evidence: `cmd/odf/main.go`)
- Command registration → DR workflows: registers (evidence: `cmd/odf/main.go`)
- Command registration → Ceph CLI: registers (evidence: `cmd/odf/main.go`)
- Command registration → Rados commands: registers (evidence: `cmd/odf/main.go`)
- Command registration → RGW commands: registers (evidence: `cmd/odf/main.go`)
- Command registration → RBD commands: registers (evidence: `cmd/odf/main.go`)
- Command registration → Subvolume management: registers (evidence: `cmd/odf/main.go`)
- Command registration → Snapshot management: registers (evidence: `cmd/odf/main.go`)
- Command registration → Object CRD controls: registers (evidence: `cmd/odf/main.go`)
- Command registration → NooBaa CLI: registers (evidence: `cmd/odf/main.go`)
- Get commands → Health status: reports status (evidence: `README.md`)
- Get commands → DR prerequisites: checks prerequisites (evidence: `cmd/odf/get/dr_prereq.go`)
- DR workflows → DR prerequisites: checks cluster
- Subvolume management → StorageClient resolver: resolves config (evidence: `cmd/odf/subvolume/subvolume.go`)
- Snapshot management → StorageClient resolver: resolves config (evidence: `cmd/odf/cephfs_snap/cephfs_snap.go`)
- Object CRD controls → NooBaa CRDs: installs or removes (evidence: `cmd/odf/object/object.go`)
- Operator → Rook operator: restarts or configures (evidence: `README.md`)
- Operator → Maintenance: starts or stops (evidence: `README.md`)
- Operator → OSD purge: removes OSD (evidence: `README.md`)
- Operator → Resource restore: restores resources (evidence: `README.md`)
