Summary
Currently, the pageserver drain functionality in the operator uses a placeholder implementation with annotations. This needs to be replaced with actual calls to the storage-controller API to properly drain pageservers before deletion.
Current Implementation
The current implementation in crates/neon_cluster/src/controllers/pageserver/pod.rs has two TODO functions:
is_pageserver_drained() - Currently checks for a neon.io/drained annotation
trigger_pageserver_drain() - Currently only logs the drain request
Required Implementation
Based on the storage controller API (found in storcon_cli), the drain operation should:
- Trigger drain: Make a PUT request to
control/v1/node/{node_id}/drain
- Check drain status: Poll the node status to verify drain completion
API Details
// Trigger drain
storcon_client.dispatch::<(), ()>(
Method::PUT,
format\!("control/v1/node/{node_id}/drain"),
None,
).await?;
Implementation Tasks
Files to Modify
crates/neon_cluster/src/controllers/pageserver/pod.rs - Update drain functions
crates/neon_cluster/src/storage_controller/client.rs - Add drain API methods
Additional Context
The pageserver ID is available in the pod labels as neon.io/pageserver-id.
Summary
Currently, the pageserver drain functionality in the operator uses a placeholder implementation with annotations. This needs to be replaced with actual calls to the storage-controller API to properly drain pageservers before deletion.
Current Implementation
The current implementation in
crates/neon_cluster/src/controllers/pageserver/pod.rshas two TODO functions:is_pageserver_drained()- Currently checks for aneon.io/drainedannotationtrigger_pageserver_drain()- Currently only logs the drain requestRequired Implementation
Based on the storage controller API (found in storcon_cli), the drain operation should:
control/v1/node/{node_id}/drainAPI Details
Implementation Tasks
StorageControllerClientincrates/neon_cluster/src/storage_controller/client.rstrigger_pageserver_drain()to call storage controller APIis_pageserver_drained()to check actual drain status from storage controllerFiles to Modify
crates/neon_cluster/src/controllers/pageserver/pod.rs- Update drain functionscrates/neon_cluster/src/storage_controller/client.rs- Add drain API methodsAdditional Context
The pageserver ID is available in the pod labels as
neon.io/pageserver-id.