Refactor the generation of the cloud-init scripts for init control plane, join control plane and join worker nodes.
Changes
Move bash scripts out of the Go template syntax, and into testable scripts. Cloudinit runcmd section calls these scripts with the appropriate parameters
Bash scripts are added to the machine as write_files
Add a configurable runcmd and bootcmd section. In the future, this will allow us to pick up cloud-init fragments from the user for any custom setup that might be required. E.g. PreMicroK8sCommands, PostMicroK8sCommands, ExtraWriteFiles, etc.
Adds unit tests for the cloud-init generation. More unit tests are now possible for specific scripts (e.g. override paths and test that dqlite port update functions properly). These are not developed at the moment, as there is little value by itself, and they are already covered by the end to end tests.
Fixes a few typos in the error messages of the original code.
Summary
Refactor the generation of the cloud-init scripts for init control plane, join control plane and join worker nodes.
Changes
runcmd
section calls these scripts with the appropriate parameterswrite_files
runcmd
andbootcmd
section. In the future, this will allow us to pick up cloud-init fragments from the user for any custom setup that might be required. E.g.PreMicroK8sCommands
,PostMicroK8sCommands
,ExtraWriteFiles
, etc.Testing
Tested with a Jenkins run, also added unit tests.