-
Get drives from each node and identify drives for usability. DirectPV uses sysfs (/sys), udev (/run/udev/data) and procfs (/proc) on each node to collect all necessary information for this and they are stored in
directpvnodesCRD. -
Uniquely identify each drive not by drive name as it may change on node reboots/drive swaps/removal. DirectPV computes a hash using values collected for each drive to make sure it is unique across all nodes. This hash is called
IDwhich is also stored indirectpvnodesCRD. -
Add/Remove of nodes and drives. DirectPV does not monitor addition or deletion of nodes and drives instead it collects information on demand to update
directpvnodesCRD.
When discover API or command is called, below steps are performed.
- It refreshes
directpvnodesCRD to accomodate node and drive changes. A controller on each node monitors this request and refreshes respective content indirectpvnodesCRD. https://github.com/minio/directpv/blob/master/pkg/admin/refresh.go#L69 line of code triggers refresh request for the node. - We wait for refresh on each node completion by watching
directpvnodesCRD. This is done at https://github.com/minio/directpv/blob/master/cmd/kubectl-directpv/discover.go#L252 - Upon step(2) completion, it generates InitConfig data saved to passed or default
drives.yamlfile.
When init API or command is called, below steps are performed.
- DirectPV creates a
directpvinitrequestsCRD for the givenInitConfigYAML and it returnsRequestIDto monitor the completion.initcommand waits for theRequestIDfor the completion whereasinitAPI is not.
As mentioned in the Challenges, the drive name/state may change in between discovery and init. init fails in that case. init never touches wrong drive.
Feel free to ask any questions.