flux2
flux2 copied to clipboard
Implement Patches update strategy for ImageUpdateAutomation resource
Since comments may not necessarily be preserved in some image pipelines, and keeping necessary configuration in comments is generally considered to be a bad code smell, Patches
should be added to the list of available options when setting spec.update.strategy
on ImageUpdateAutomation
resources, and a field added to contain the list of parameterised patches needed to update the relevant fields.
e.g.
apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageUpdateAutomation
spec:
update:
strategy: JSONPatches
path: /apps/nginx/_base
patches:
- target:
kind: Deployment
patches:
- path: /spec/containers/*/image
replace: 'nginx:$1' # implied filter of '^.+$'
- path: /metadata/labels/app.kubernetes.io~1version
select: '^v([\\d\\.]+)' # implied termplate of '$1'
These patches would work exactly like Kustomize patches, except that the value can be run through a regex beforehand, and the operation is assumed to be "replace".
I do think this is a great idea and well argued, I think we are considering which features to add in the context of separating ideas into before-GA and after-GA, I think as a new feature this sounds like one that would likely come after Flux 2.0 or GA.
Thanks for the suggestion!
Now that Flux 2.0 is pretty close to release what are the current thoughts on this? This is sorely needed for my setup and I'm happy to contribute some code.
Getting this implemented will definitely take some time and it should be initiated by an RFC. Before that happens, though, I believe it makes sense to haul in the other maintainers. @tskinner-oppfi would you like to join the next weekly meeting and bring this issue forward?