flux2 icon indicating copy to clipboard operation
flux2 copied to clipboard

Implement Patches update strategy for ImageUpdateAutomation resource

Open Tzrlk opened this issue 3 years ago • 1 comments

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".

Tzrlk avatar Feb 25 '22 02:02 Tzrlk

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!

kingdonb avatar Mar 31 '22 17:03 kingdonb

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.

tskinner-oppfi avatar Jun 07 '23 18:06 tskinner-oppfi

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?

makkes avatar Jun 08 '23 08:06 makkes