microceph icon indicating copy to clipboard operation
microceph copied to clipboard

Expose complete node removal process via the microcluster API

Open masnax opened this issue 1 year ago • 4 comments

Currently, node removal is coupled with the CLI here with multiple API calls: https://github.com/canonical/microceph/blob/aae9f94dd349132283b08902b23aee27795e60fe/microceph/cmd/microceph/cluster_remove.go#L49

This means anyone using the MicroCeph API (MicroCloud) must re-implement the logic here, and maintain parity going forward, which is not ideal.

MicroCluster has hooks that can be used to automatically execute these necessary bits before/after a node is removed: https://github.com/canonical/microcluster/blob/e3b7b60a4d71577f5d0f5460f71dbb33dfcb5d9c/config/hooks.go#L25-L28

If the logic in removeNode is included in the remove hooks, then the only thing the MicroCeph CLI will need to do is call DeleteClusterMember which is currently here: https://github.com/canonical/microceph/blob/aae9f94dd349132283b08902b23aee27795e60fe/microceph/cmd/microceph/cluster_remove.go#L75

Then, anyone using the MicroCeph API would also be able to just remove the node and maintain all the necessary preparations for node removal.

masnax avatar Nov 08 '23 11:11 masnax