An installer controller is responsible to provide the installation and uninstallation scripts for k8s dependencies, prerequisites and components on each BYOHost.
We provide a default installer (K8sInstallerConfig) to install the supported upstream k8s.
If someone wants to implement their own installer controller then they need to follow the following contract:
- Must create a CustomResourceDefinition
InstallerConfigTemplatefor yourinstallerConfig(eg. K8sInstallerConfigTemplate) - Must create a CustomResourceDefinition
InstallerConfig(eg. K8sInstallerConfig) - Must be namespace-scoped
- Must have the standard Kubernetes
type metadataandobject metadata - Must have a
statusfield with the following:- Required fields:
Ready(boolean): indicates the installation secret has been generated and is readyInstallationSecret(ObjectReference): reference to installation secret
- Optional fields:
failureReason(string): indicates there is a fatal problem reconciling the installer configuration; meant to be suitable for programmatic interpretationfailureMessage(string): indicates there is a fatal problem reconciling the installer configuration; meant to be a more descriptive value thanfailureReason
- Required fields:
- If the resource does not have a
ByoMachineowner, exit the reconciliation - If the Cluster to which this resource belongs cannot be found, exit the reconciliation
- If
ByoMachine.status.condition.ByoHostReadyreason is not equal toInstallationSecretNotAvailableReason, exit the reconciliation - If
status.readyis true, exit the reconciliation - Deterministically generate the name for the installation secret
- Try to retrieve the Secret with the name from the previous step
- If it does not exist, generate installation/uninstallation data using
ByoMachine.status.hostinfodetails and create the Secret with the following data:install(string): contains installation bash scriptuninstall(string): contains uninstallation bash script
- Variables: need to keep these variables in the scripts to parse by the
byoh agent.{{.BundleDownloadPath}}: path on host where bundle will be downloaded bybyoh agent
- If it does not exist, generate installation/uninstallation data using
- Set
status.installationSecretto the generated secret object reference - Set
status.ready = true - Patch the resource to persist changes
ByoMachine refers to an installer template ByoMachineTemplate.spec.template.spec.installerRef.
So, ByoMachine controller will create the Installer CR using the InstallerTemplate for each ByoMachine.
