The --pre-provision-command for the caph controller can be used to execute a custom command before install-image starts.
This provides you a flexible way to check if the bare metal server is healthy.
Example:
The script/binary will be copied into the Hetzner Rescue System and executed.
If the exit code is zero, then all is fine.
If the exit code is non-zero, then provisioning of that machine will be stopped.
The CAPH controller runs in a Kubernetes Pod. The container of that pod needs access to the file.
There are several ways to make this command available:
In this example we use an init-container to provide the script.
In the directory images/pre-provision-command/ you see these files:
When the container image was uploaded, you need to adapt the CAPH deployment: