The current implementation of Instascale includes logic within the Reconcile function to check and set the machine type and verify if Hypershift is enabled. This logic is placed in the reconciliation loop because the client is not able to perform calls to the Kubernetes API until after the controller's SetupWithManager method has completed. As a result, fetching the ocmClusterId and checking if Hypershift is enabled cannot be done during setup.
The machineCheck is a crucial part of the controller setup, as it dictates the behaviour of the reconciliation process by determining whether we are working with a MachinePool, or NodePool. Performing this operation in the reconcile function is not optimal.
DONE
The machine type and Hypershift checks should be refactored out of the Reconcile loop to improve the controller's efficiency and code maintainability.
WHY
The current implementation of Instascale includes logic within the Reconcile function to check and set the machine type and verify if Hypershift is enabled. This logic is placed in the reconciliation loop because the client is not able to perform calls to the Kubernetes API until after the controller's SetupWithManager method has completed. As a result, fetching the ocmClusterId and checking if Hypershift is enabled cannot be done during setup.
The machineCheck is a crucial part of the controller setup, as it dictates the behaviour of the reconciliation process by determining whether we are working with a MachinePool, or NodePool. Performing this operation in the reconcile function is not optimal.
DONE
The machine type and Hypershift checks should be refactored out of the Reconcile loop to improve the controller's efficiency and code maintainability.