argocd-image-updater icon indicating copy to clipboard operation
argocd-image-updater copied to clipboard

Global filters

Open aprohorov-gd opened this issue 3 years ago • 7 comments

Is your feature request related to a problem? Please describe. I have the image-list with 21 images in total. And I want to update all of them with latest strategy, but only if tag has -dev- keyword.

Describe the solution you'd like I'd like to have global filtering annotation like argocd-image-updater.argoproj.io/<pre/post>-allow-tags: and argocd-image-updater.argoproj.io/<pre/post>-ignore-tags which will be applied pre (before) or post (after) <image_name>-allow/ignore-tags filters.

Describe alternatives you've considered Right now I have to add 21 same annotations for every image.

aprohorov-gd avatar Dec 16 '21 11:12 aprohorov-gd

I do not have 21 images in a single application and I would maybe rethink this, because I can't really come up with any idea why I should have a single application with more than 1-2 images 🤔 But maybe I am just missing something.

I already had a similar idea and I already have a PoC implemented locally 😉 But it differs a bit from your idea... I am a bit unsure if I get your idea correct 🤔 What do you want to achieve with these pre and post prefixes? I thought about having an annotation without the alias to specify one application-wide default.

  • Update strategy
    • Default: argocd-image-updater.argoproj.io/update-strategy
    • per Image: argocd-image-updater.argoproj.io/<alias>.update-strategy
# ...
  metadata:
    annotations:
      argocd-image-updater.argoproj.io/image-list: init=example.azurecr.io/backend-init backend=example.azurecr.io/backend, frontend=example.azurecr.io/frontend
      argocd-image-updater.argoproj.io/update-strategy: latest
      argocd-image-updater.argoproj.io/frontend.update-strategy: semver
Image Update Strategy
example.azurecr.io/backend-init latest
example.azurecr.io/backend latest
example.azurecr.io/frontend semver

My PoC implements this for update-strategy, ignore-tags, allow-tags and force-update.

Maybe I find some time during my xmas vacation to create a PR for this 😉

janpieper-gcx avatar Dec 17 '21 06:12 janpieper-gcx

I do not have 21 images in a single application and I would maybe rethink this, because I can't really come up with any idea why I should have a single application with more than 1-2 images 🤔 But maybe I am just missing something.

I already had a similar idea and I already have a PoC implemented locally 😉 But it differs a bit from your idea... I am a bit unsure if I get your idea correct 🤔 What do you want to achieve with these pre and post prefixes? I thought about having an annotation without the alias to specify one application-wide default.

  • Update strategy

    • Default: argocd-image-updater.argoproj.io/update-strategy
    • per Image: argocd-image-updater.argoproj.io/<alias>.update-strategy
# ...
  metadata:
    annotations:
      argocd-image-updater.argoproj.io/image-list: init=example.azurecr.io/backend-init backend=example.azurecr.io/backend, frontend=example.azurecr.io/frontend
      argocd-image-updater.argoproj.io/update-strategy: latest
      argocd-image-updater.argoproj.io/frontend.update-strategy: semver

Image Update Strategy example.azurecr.io/backend-init latest example.azurecr.io/backend latest example.azurecr.io/frontend semver My PoC implements this for update-strategy, ignore-tags, allow-tags and force-update.

Maybe I find some time during my xmas vacation to create a PR for this 😉

Thanks for replay! =)

My point for pre and post prefixes is order for applying filters: pre-allow, then .allow and after that post-allow. It gives you possibility for more complex rules.

aprohorov-gd avatar Dec 17 '21 07:12 aprohorov-gd

I thought about having an annotation without the alias to specify one application-wide default.

Sounds great. I like the idea!

Maybe I find some time during my xmas vacation to create a PR for this

This would be awesome!

I think the implementation described by @janpieper-gcx would satisfy the use-case. You could just have allow-tags: regexp:^.*-dev-.*$ to only consider those tags containing -dev- for all applications managed by that application.

jannfis avatar Dec 17 '21 09:12 jannfis

@janpieper-gcx Will you send that PR? I favor merging yours over the one I've created and will keep the one I've sent unmerged for a while.

jannfis avatar Jan 07 '22 20:01 jannfis

Sorry, I failed to work on this during my xmas vacation :sweat: I just created #338. The functionality is already implemented and should work, but tests and the documentation are still missing.

janpieper avatar Jan 10 '22 08:01 janpieper

Uff... I just realized that you already created a PR (#335) for that topic :thinking: Maaaybe we can somehow merge them.

janpieper avatar Jan 10 '22 08:01 janpieper

Hey @janpieper, thanks for coming back to it and no sweat. I was just unsure whether you'd send a PR or not, so I hacked something together because what you suggested is really useful :)

As I said, I'd prefer merging your PR over mine, so thanks a lot for submitting yours! I will close mine. Feel free to get as much code off my branch as required, e.g. for the unit tests.

jannfis avatar Jan 10 '22 09:01 jannfis