How anticipatedd/pv-migrate works
pv-migrate is a CLI and kubectl plugin for moving Kubernetes PVC data, plus backing up PVCs to and restoring them from rclone-supported object storage. The main migration flow accepts source and destination claims, resolves their cluster and PVC details, then tries configured transfer strategies; bucket workflows run an rclone job against a mounted claim. The README documents additional strategy, push, detach, and backend capabilities. Some subsystem wiring is inferred from documented behavior and package boundaries because the excerpts are partial.
Main entry points: strategy.go Strategy selection · bucketstorage.go Bucket job setup · cmd.go rsync over SSH · migrator.go Strategy orchestrator
Components 22
CLI workflows
- CLI entry
cmd/pv-migrate/main.go - Command handlers
internal/app
PVC migration
- Migration API
pvmigrate/pvmigrate.go - Strategy orchestrator
internal/migrator/migrator.go - PVC inspection
internal/pvc/info.go
Transfer strategies
- Strategy selection
internal/strategy/strategy.go - Shared mount
internal/strategy/mount.go - ClusterIP
internal/strategy/clusterip.go - Load balancer
internal/strategy/loadbalancer.go - NodePort
internal/strategy/nodeport.go - Local tunnel
internal/strategy/local.go - rsync over SSH
internal/rsync/cmd.go
Bucket workflows
- Backup API
pvmigrate/backup.go - Restore API
pvmigrate/restore.go - Bucket job setup
internal/bucketstorage/bucketstorage.go - rclone runner
internal/rclone/cmd.go
Cluster operations
- Kubernetes client
internal/k8s/client.go - Helm integration
internal/helm/helm.go - Progress and logs
internal/narrate/handler.go
Other components
- Operator
- Object storage
- Kubernetes cluster
Connections 29
- Operator → CLI entry: runs
- CLI entry → Command handlers: builds commands
- Command handlers → Migration API: runs migration
- Command handlers → Backup API: runs backup
- Command handlers → Restore API: runs restore
- Migration API → Strategy orchestrator: starts migration
- Strategy orchestrator → Kubernetes client: gets clients
- Strategy orchestrator → PVC inspection: inspects claims
- Strategy orchestrator → Strategy selection: selects strategies
- Strategy selection → Shared mount: dispatches
- Strategy selection → ClusterIP: dispatches
- Strategy selection → Load balancer: dispatches
- Strategy selection → NodePort: dispatches
- Strategy selection → Local tunnel: dispatches
- Shared mount → rsync over SSH: runs transfer
- ClusterIP → rsync over SSH: runs transfer
- Load balancer → rsync over SSH: runs transfer
- NodePort → rsync over SSH: runs transfer
- Local tunnel → rsync over SSH: runs transfer
- rsync over SSH → Kubernetes cluster: copies PVC data
- Backup API → Bucket job setup: starts backup
- Restore API → Bucket job setup: starts restore
- Bucket job setup → Kubernetes client: gets client
- Bucket job setup → Helm integration: installs job
- Bucket job setup → rclone runner: configures mover
- rclone runner → Object storage: reads or writes
- Kubernetes client → Kubernetes cluster: accesses resources
- Strategy orchestrator → Progress and logs: reports progress
- Bucket job setup → Progress and logs: reports progress