How mirantis/pelagia works
Purpose and Runtime Entry Points
Pelagia is a Go-based Kubernetes control plane for Rook-managed Ceph. It consolidates Rook configuration into CephDeployment, reports aggregate health, manages Ceph credentials, and automates OSD/node removal. Executables are the controller manager, node disk daemon, connector, and migrator: cmd/controller/main.go, cmd/disk-daemon/main.go, cmd/connector/main.go, cmd/migrator/main.go.
Kubernetes API Boundary
Pelagia defines the ceph.pelagia.lcm/v1alpha1 API: CephDeployment, health, maintenance, secret, and OSD-removal-task resources. Types and Kubernetes scheme registration form the declarative input/status boundary: pkg/apis/ceph.pelagia.lcm/v1alpha1/deployment_types.go, pkg/apis/ceph.pelagia.lcm/v1alpha1/health_types.go, pkg/apis/addtoscheme.go. Generated clients, informers, and listers let controllers watch/cache these CRs rather than directly polling them.
Controller Manager and Reconciliation
The main controller process wires several independently focused reconcilers: pkg/controller/controller.go, pkg/controller/config/controller.go, pkg/controller/deployment/controller.go. Configuration establishes controller behavior; deployment reconciliation validates a CephDeployment and materializes or updates the corresponding Rook and Kubernetes resources. This is the primary translation boundary from Pelagia’s aggregate API to Rook’s distributed CR API.
Ceph Deployment Composition
Deployment logic is decomposed by Ceph/Rook capability: cluster configuration and state, storage pools/filesystems, RGW/object storage, CSI, networking, ingress, multisite, external clusters, and OpenStack integration. Core paths include pkg/controller/deployment/cluster.go, pkg/controller/deployment/object_storage.go, and pkg/controller/deployment/csi_operator.go. It operates against Kubernetes resources and Rook CRs, with Ceph CLI/pod execution utilities providing an imperative boundary when API reconciliation alone is insufficient.
Health, Infrastructure, and Secrets
The health controller gathers Ceph CLI results and Rook-object state into CephDeploymentHealth: pkg/controller/health/controller.go, pkg/controller/health/deployment_verification.go, pkg/controller/health/rook_objects_status.go. Infrastructure reconciliation deploys/supports operational dependencies such as disk-daemon, tools box, and Rook operator configuration: pkg/controller/infra/controller.go, pkg/controller/infra/disk_daemon.go. Secret reconciliation manages deployment credential resources: pkg/controller/secret/controller.go.
OSD Lifecycle and Node Agent
CephOsdRemoveTask drives a phased, resumable OSD cleanup/removal workflow, including execution and cleanup jobs: pkg/controller/osdremove-task/controller.go, pkg/controller/osdremove-task/executor.go, pkg/controller/osdremove-task/cleanup_job.go. The disk daemon runs on nodes, exposes an API, inventories disks/OSDs, and reports this node-local state to the Kubernetes-side control plane: pkg/disk-daemon/daemon.go, pkg/disk-daemon/api_server.go, pkg/disk-daemon/disk_reporter.go. This separates privileged hardware discovery from cluster-level orchestration.
Deployment, Dependencies, and Delivery
Helm is the installation boundary. The Pelagia chart installs CRDs and controller/LCM workloads: charts/pelagia-ceph/templates/crds/lcm.mirantis.com_cephdeployments.yaml, charts/pelagia-ceph/templates/lcm/lcm-controller.yaml. Companion charts package required Rook, Ceph-CSI operator, and snapshot-controller components: charts/rook/templates/rook-operator.yaml, charts/ceph-csi-operator/templates/ceph-csi-operator.yaml, charts/snapshot-controller/templates/snapshot-controller.yaml. Material external systems are Kubernetes, Rook, Ceph, Ceph-CSI, and optionally OpenStack/Rockoon. CI builds images, Helm artifacts, documentation, E2E runs, and air-gapped bundles through .github/workflows/build.yaml and .github/workflows/airgap-bundle.yaml.
Main entry points: controller/controller.go Controller wiring · health/controller.go Health reconciler · deployment_types.go Pelagia CR API · deployment/controller.go Deployment reconciler
Components 18
Runtime entry points
- Controller manager · Wires the cluster-level reconcilers.
cmd/controller/main.go
Control plane
- Pelagia CR API · Declarative deployment, health, secret, maintenance, and OSD task resources.
pkg/apis/ceph.pelagia.lcm/v1alpha1/deployment_types.go - API scheme
pkg/apis/addtoscheme.go - Controller wiring
pkg/controller/controller.go - Deployment reconciler · Translates CephDeployment into Rook and Kubernetes resources.
pkg/controller/deployment/controller.go - Ceph deployment composition · Builds cluster, storage, object, CSI, networking, and integration resources.
pkg/controller/deployment/cluster.go - Health reconciler · Aggregates Ceph CLI and Rook state into deployment health.
pkg/controller/health/controller.go - Infrastructure reconciler · Deploys operational dependencies including the disk daemon and tools.
pkg/controller/infra/controller.go - Secret reconciler · Manages deployment credential resources.
pkg/controller/secret/controller.go
Node lifecycle
- OSD removal reconciler · Runs resumable OSD cleanup and removal jobs.
pkg/controller/osdremove-task/controller.go - Disk daemon · Privileged node-local disk and OSD inventory service.
cmd/disk-daemon/main.go - Disk reporting API · Reports node-local inventory to the control plane.
pkg/disk-daemon/disk_reporter.go
Managed platform
- Kubernetes · Hosts Pelagia CRs, workloads, jobs, and cached watch state.
- Rook · Consumes generated Rook CRs and operates Ceph resources.
- Ceph cluster
Installation and delivery
- Pelagia Helm chart · Installs CRDs and controller workloads.
charts/pelagia-ceph/templates/lcm/lcm-controller.yaml - Companion Helm charts · Packages Rook, Ceph-CSI, and snapshot controller components.
charts/rook/templates/rook-operator.yaml - Build and bundle CI · Builds images, charts, E2E artifacts, and air-gapped bundles.
.github/workflows/build.yaml
Connections 23
- Pelagia Helm chart → Kubernetes: installs CRDs and LCM
- Companion Helm charts → Kubernetes: installs operators
- Build and bundle CI → Pelagia Helm chart: builds artifacts
- Controller manager → Controller wiring: boots
- Controller wiring → Deployment reconciler: registers
- Controller wiring → Health reconciler: registers
- Controller wiring → Infrastructure reconciler: registers
- Controller wiring → Secret reconciler: registers
- Controller wiring → OSD removal reconciler: registers
- API scheme → Pelagia CR API: registers types
- Kubernetes → Pelagia CR API: stores and watches
- Deployment reconciler → Pelagia CR API: reconciles CephDeployment
- Deployment reconciler → Ceph deployment composition: materializes
- Ceph deployment composition → Rook: creates Rook CRs
- Health reconciler → Pelagia CR API: writes health status
- Health reconciler → Rook: reads object state
- Health reconciler → Ceph cluster: queries CLI
- Infrastructure reconciler → Disk daemon: deploys
- Secret reconciler → Kubernetes: manages credentials
- OSD removal reconciler → Ceph cluster: executes removal
- Disk daemon → Disk reporting API: serves inventory
- Disk reporting API → Kubernetes: reports node state
- Rook → Ceph cluster: operates