# libopenstorage/stork architecture

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

- Interactive diagram: https://gitdiagram.com/libopenstorage/stork
- Repository: https://github.com/libopenstorage/stork

## Overview

Stork is a Kubernetes storage-aware scheduler extender and operator. The primary workflow is a scheduler sending pod filter/prioritize requests to Stork, which consults a storage driver and returns placement guidance. The operator also manages snapshots and application-consistent rules, backups/restores, health-driven relocation, disaster-recovery actions, and admission-time scheduler assignment. The graph includes these documented product branches; several controller-to-driver relationships are inferred from subsystem roles and are marked unverified because the relevant implementations were not excerpted.

Main entry points: [`drivers/volume/volume.go`](https://github.com/libopenstorage/stork/blob/master/drivers/volume/volume.go) (Volume Driver), [`cmd/stork/stork.go`](https://github.com/libopenstorage/stork/blob/master/cmd/stork/stork.go) (Stork Runtime), [`pkg/extender/extender.go`](https://github.com/libopenstorage/stork/blob/master/pkg/extender/extender.go) (Scheduler Extender), [`pkg/webhookadmission/webhook.go`](https://github.com/libopenstorage/stork/blob/master/pkg/webhookadmission/webhook.go) (Admission Initializer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Scheduling Runtime"]
  node_extender["Scheduler Extender<br/>[extender.go]"]
  node_volume_driver["Volume Driver<br/>[volume.go]"]
  node_portworx["Portworx Driver<br/>[portworx.go]"]
  node_csi["CSI Driver<br/>[csi.go]"]
  node_initializer["Admission Initializer<br/>[webhook.go]"]
  node_main["Stork Runtime<br/>[stork.go]"]
end

subgraph group_controllers["Kubernetes Controllers"]
  node_app_manager["Application Manager"]
end

subgraph group_data["Data Protection"]
  node_backup["Backup Controller"]
  node_snapshot_schedule["Snapshot Scheduling"]
  node_snapshotter["CSI Snapshotter<br/>[snapshotter_csi.go]"]
  node_group_snapshot["Group Snapshots<br/>[groupsnapshot.go]"]
  node_rules["Application Rules<br/>[rule.go]"]
  node_object_store["Backup Object Store<br/>[objectstore.go]"]
end

subgraph group_recovery["Recovery and Health"]
  node_monitor["Driver Health Monitor<br/>[monitor.go]"]
  node_replica_scaling["Replica Scaling<br/>[updatereplicas.go]"]
  node_action_controller["DR Action Controller"]
end

subgraph group_interfaces["API and Operations"]
  node_api_resources["Stork API Resources"]
  node_storkctl["Stork CLI<br/>[clusterpair.go]"]
end

node_scheduler(("Kubernetes Scheduler"))
node_kubernetes(("Kubernetes API"))

node_scheduler -->|"requests placement"| node_extender
node_extender -->|"checks placement"| node_volume_driver
node_extender -.->|"returns priorities"| node_scheduler
node_main -->|"starts extender"| node_extender
node_main -->|"starts webhook"| node_initializer
node_initializer -->|"patches pod admission"| node_kubernetes
node_initializer -.->|"checks driver volumes"| node_volume_driver
node_main -->|"initializes controllers"| node_app_manager
node_app_manager -->|"initializes backup"| node_backup
node_backup -.->|"stores backup data"| node_object_store
node_backup -.->|"runs consistency rules"| node_rules
node_snapshot_schedule -.->|"runs snapshot rules"| node_rules
node_snapshot_schedule -.->|"requests snapshots"| node_snapshotter
node_group_snapshot -.->|"runs snapshot rules"| node_rules
node_snapshotter -.->|"uses CSI operations"| node_csi
node_portworx -.->|"implements driver"| node_volume_driver
node_csi -.->|"implements driver"| node_volume_driver
node_main -.->|"starts monitoring"| node_monitor
node_monitor -->|"checks driver health"| node_volume_driver
node_monitor -.->|"relocates workloads"| node_replica_scaling
node_action_controller -.->|"performs DR actions"| node_volume_driver
node_action_controller -->|"reconciles actions"| node_api_resources
node_storkctl -.->|"manages cluster pairs"| node_api_resources
node_kubernetes -.->|"stores custom resources"| node_api_resources

click node_extender "https://github.com/libopenstorage/stork/blob/master/pkg/extender/extender.go"
click node_volume_driver "https://github.com/libopenstorage/stork/blob/master/drivers/volume/volume.go"
click node_portworx "https://github.com/libopenstorage/stork/blob/master/drivers/volume/portworx/portworx.go"
click node_csi "https://github.com/libopenstorage/stork/blob/master/drivers/volume/csi/csi.go"
click node_initializer "https://github.com/libopenstorage/stork/blob/master/pkg/webhookadmission/webhook.go"
click node_main "https://github.com/libopenstorage/stork/blob/master/cmd/stork/stork.go"
click node_app_manager "https://github.com/libopenstorage/stork/blob/master/pkg/applicationmanager/applicationmanager.go"
click node_backup "https://github.com/libopenstorage/stork/blob/master/pkg/applicationmanager/controllers/applicationbackup.go"
click node_snapshot_schedule "https://github.com/libopenstorage/stork/blob/master/pkg/snapshot/controllers/snapshotschedule.go"
click node_snapshotter "https://github.com/libopenstorage/stork/blob/master/pkg/snapshotter/snapshotter_csi.go"
click node_group_snapshot "https://github.com/libopenstorage/stork/blob/master/pkg/groupsnapshot/controllers/groupsnapshot.go"
click node_rules "https://github.com/libopenstorage/stork/blob/master/pkg/rule/rule.go"
click node_object_store "https://github.com/libopenstorage/stork/blob/master/pkg/objectstore/objectstore.go"
click node_monitor "https://github.com/libopenstorage/stork/blob/master/pkg/monitor/monitor.go"
click node_replica_scaling "https://github.com/libopenstorage/stork/blob/master/pkg/resourceutils/updatereplicas.go"
click node_action_controller "https://github.com/libopenstorage/stork/blob/master/pkg/action/actioncontroller.go"
click node_api_resources "https://github.com/libopenstorage/stork/tree/master/pkg/apis/stork/v1alpha1"
click node_storkctl "https://github.com/libopenstorage/stork/blob/master/pkg/storkctl/clusterpair.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_extender,node_volume_driver,node_portworx,node_csi,node_initializer,node_main toneBlue
class node_app_manager toneAmber
class node_backup,node_snapshot_schedule,node_snapshotter,node_group_snapshot,node_rules,node_object_store,node_kubernetes toneMint
class node_monitor,node_replica_scaling,node_action_controller,node_scheduler toneRose
class node_api_resources,node_storkctl toneIndigo
```

## Components

### Scheduling Runtime

- [Scheduler Extender](https://github.com/libopenstorage/stork/blob/master/pkg/extender/extender.go): `pkg/extender/extender.go`
- [Volume Driver](https://github.com/libopenstorage/stork/blob/master/drivers/volume/volume.go): `drivers/volume/volume.go`
- [Portworx Driver](https://github.com/libopenstorage/stork/blob/master/drivers/volume/portworx/portworx.go): `drivers/volume/portworx/portworx.go`
- [CSI Driver](https://github.com/libopenstorage/stork/blob/master/drivers/volume/csi/csi.go): `drivers/volume/csi/csi.go`
- [Admission Initializer](https://github.com/libopenstorage/stork/blob/master/pkg/webhookadmission/webhook.go): `pkg/webhookadmission/webhook.go`
- [Stork Runtime](https://github.com/libopenstorage/stork/blob/master/cmd/stork/stork.go): `cmd/stork/stork.go`

### Kubernetes Controllers

- [Application Manager](https://github.com/libopenstorage/stork/blob/master/pkg/applicationmanager/applicationmanager.go): `pkg/applicationmanager/applicationmanager.go`

### Data Protection

- [Backup Controller](https://github.com/libopenstorage/stork/blob/master/pkg/applicationmanager/controllers/applicationbackup.go): `pkg/applicationmanager/controllers/applicationbackup.go`
- [Snapshot Scheduling](https://github.com/libopenstorage/stork/blob/master/pkg/snapshot/controllers/snapshotschedule.go): `pkg/snapshot/controllers/snapshotschedule.go`
- [CSI Snapshotter](https://github.com/libopenstorage/stork/blob/master/pkg/snapshotter/snapshotter_csi.go): `pkg/snapshotter/snapshotter_csi.go`
- [Group Snapshots](https://github.com/libopenstorage/stork/blob/master/pkg/groupsnapshot/controllers/groupsnapshot.go): `pkg/groupsnapshot/controllers/groupsnapshot.go`
- [Application Rules](https://github.com/libopenstorage/stork/blob/master/pkg/rule/rule.go): `pkg/rule/rule.go`
- [Backup Object Store](https://github.com/libopenstorage/stork/blob/master/pkg/objectstore/objectstore.go): `pkg/objectstore/objectstore.go`

### Recovery and Health

- [Driver Health Monitor](https://github.com/libopenstorage/stork/blob/master/pkg/monitor/monitor.go): `pkg/monitor/monitor.go`
- [Replica Scaling](https://github.com/libopenstorage/stork/blob/master/pkg/resourceutils/updatereplicas.go): `pkg/resourceutils/updatereplicas.go`
- [DR Action Controller](https://github.com/libopenstorage/stork/blob/master/pkg/action/actioncontroller.go): `pkg/action/actioncontroller.go`

### API and Operations

- [Stork API Resources](https://github.com/libopenstorage/stork/tree/master/pkg/apis/stork/v1alpha1): `pkg/apis/stork/v1alpha1`
- [Stork CLI](https://github.com/libopenstorage/stork/blob/master/pkg/storkctl/clusterpair.go): `pkg/storkctl/clusterpair.go`

### Other components

- **Kubernetes Scheduler**
- **Kubernetes API**

## Connections

- Kubernetes Scheduler → Scheduler Extender: requests placement
- Scheduler Extender → Volume Driver: checks placement
- Scheduler Extender → Kubernetes Scheduler: returns priorities
- Stork Runtime → Scheduler Extender: starts extender (evidence: `cmd/stork/stork.go`)
- Stork Runtime → Admission Initializer: starts webhook (evidence: `cmd/stork/stork.go`)
- Admission Initializer → Kubernetes API: patches pod admission (evidence: `pkg/webhookadmission/webhook.go`)
- Admission Initializer → Volume Driver: checks driver volumes
- Stork Runtime → Application Manager: initializes controllers (evidence: `cmd/stork/stork.go`)
- Application Manager → Backup Controller: initializes backup (evidence: `pkg/applicationmanager/applicationmanager.go`)
- Backup Controller → Backup Object Store: stores backup data
- Backup Controller → Application Rules: runs consistency rules
- Snapshot Scheduling → Application Rules: runs snapshot rules
- Snapshot Scheduling → CSI Snapshotter: requests snapshots
- Group Snapshots → Application Rules: runs snapshot rules
- CSI Snapshotter → CSI Driver: uses CSI operations
- Portworx Driver → Volume Driver: implements driver
- CSI Driver → Volume Driver: implements driver
- Stork Runtime → Driver Health Monitor: starts monitoring
- Driver Health Monitor → Volume Driver: checks driver health
- Driver Health Monitor → Replica Scaling: relocates workloads
- DR Action Controller → Volume Driver: performs DR actions
- DR Action Controller → Stork API Resources: reconciles actions (evidence: `pkg/action/actioncontroller.go`)
- Stork CLI → Stork API Resources: manages cluster pairs (evidence: `pkg/storkctl/clusterpair.go`)
- Kubernetes API → Stork API Resources: stores custom resources
