Open chrisdoherty4 opened 1 year ago
After developing the initial v1alpha2 controller, @jacobweinstock and I discussed this and felt it would be quite useful long term. Implementation will be some time after the agreed functionality of v1alpha2 is implemented.
Overview
Tinkerbell defines a
Template
object that contains Actions. Actions represent an activity that contributes to the provisioning of a machine (for the primary Tinkerbell use-case). Actions are flexible as they are OCI images that can be developed and maintained by third parties. This flexibility contributes to the flexibility ofTemplates
.Template
's themselves, however, aren't particularly flexible. For use-cases such as CAPI/CAPT where the same template is used to provision the same kind of node (such as control plane nodes) where its necessary to perform different dependent on the hardware it can be difficult to model usingTemplate
's.Proposal
Provide control flow type capabilities in
Template
's that enables toggling of individual actions. This could work in a similar fashion to Github Action'sif
statement.The semantics of
if
are to run the job if theEXPRESSION
evaluates to true.We could create something similar for Tinkerbell
Template
actions (note the historical concept of a 'task' has been removed for simplicity as it will be removed in future versions of Tinkerbell).Rationale
Adding expression capabilities with
if
in TinkerbellTemplate
s adds complexity in the form of maintenance. Its non-trivial and the Go standard library doesn't offer expression evaluation. Leveraging third party libraries for evaluating expressions would be ideal.The particular CAPI/CAPT example used is quite specific to CAPI/CAPT. Its possible that a CAPT solution could be created that decouples templates from CAPT
TinkerbellMachineTemplate
objects and alleviates that specific problem as there's nothing inherently preventing a user in Tinkerbell core from creating a different template for a specific kind of machine today.