thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
211 stars 55 forks source link

Overridable subroutines for composite builtin workflow actions #2914

Open albinsuresh opened 4 weeks ago

albinsuresh commented 4 weeks ago

Is your feature request related to a problem? Please describe.

The inbuilt workflow actions like the executing action of software update or configuration update are composite actions that involve multiple subroutines. For example, the software update execution action involves the following three steps: a prepare, update-list and finalize. Similarly, a configuration update execution involves downloading the config file, validating it when needed, applying the update and then performing any finalization step like restarting the relevant software or even the device itself. It would have been nice if some of these subroutines could be overridden individually without having to override the entire executing action, so that the rest of the reusable subroutines like downloading the file can be reused.

Describe the solution you'd like

Introduce overridable abstractions for complex/composite builtin actions so that those individual subroutines can be overridden separately. Ideally, the user should be able to separately override a step for each type of software or configuration. For example, in a configuration update workflow, one should be able to provide separate overridden logic for how a configuration is updated for different config types. For e.g: config update for certain types might just involve replacing the existing configuration with the new one on the disk, but certain other types might involve executing some commands (e.g: kubectl apply -f /path/to/new/config) to apply the updated configuration.

Describe alternatives you've considered

Breakup the single executing step of these operations into multiple steps like prepare, validate, apply, finalize etc so that the existing workflow overriding mechanism itself can be used to override those individual steps.