add --resume-suspended option to 'sylvactl watch'
This MR is needed to address issue sylva-projects/sylva-core#1904 (closed) which is breaking CI for current work in main (upgrades from 1.2.1 to main).
This MR adds a --resume-suspended option to sylvactl watch: when this option is set, sylvactl watch will resume any suspended resource on when it becomes reconcilable.
This is introduced to address the issue described in sylva-projects/sylva-core#1904 (closed)
This MR does the following:
- introduce
setSuspendandDeepCopyinFluxAdapter; this is required to let us patch thespec.suspendof FluxCD resources from the informer code - modify
Reconcilable(): the old behavior was to consider that a suspended resource is not reconcilable; for--resume-suspendedwe want to unsuspend when a resource becomes reconcilable, so we need to adjust this condition to also consider a suspended resource reconcilable if--resume-suspendedis set- to make the option flag accessible from
Reconcilable()we need to make this function a method of TreeInformer and update all the places calling it, including undercheckConditions
- to make the option flag accessible from
- modify
computeStatus: before this MR a suspended resource could be considered ready, but since the rest of the code will not act on ready resources, this MR changescomputeStatusso that a suspended resources is ready==false - the
setReconcileStartedAnnotationsfunction is where the "resume" happens, it is updated to patch the spec.suspend of the resources when needed (and is renamed assetStartReconcile) - finally, introduce the CLI flag to control the new behavior and propagate it to TreeInformer
Edited by Thomas Morin