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

Allow global write-back defaults

Open janpieper opened this issue 3 years ago • 1 comments

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

When managing a large amount of applications (e.g. 100+) and all should use the same base configuration for write-back, you're currently forced to touch all applications and add the needed annotations although they are always the same.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app-a
  namespace: argocd
  annotations:
    argocd-image-updater.argoproj.io/write-back-method: git            # same for all apps
    argocd-image-updater.argoproj.io/write-back-target: kustomization  # same for all apps
# ...
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-app-b
  namespace: argocd
  annotations:
    argocd-image-updater.argoproj.io/write-back-method: git            # same for all apps
    argocd-image-updater.argoproj.io/write-back-target: kustomization  # same for all apps
# ...
---
# ...

It would be great to be able to configure global defaults. There already is a default for the write-back method, but it is hardcoded in the image updater.

https://github.com/argoproj-labs/argocd-image-updater/blob/226e73160ae5ac7ddf625010620e52428d610528/pkg/argocd/update.go#L404

Describe the solution you'd like

We could add two new flags to the run-command:

  • --default-write-back-method (defaults to argocd)
    • optionally configurable via ENV-variable: DEFAULT_WRITE_BACK_METHOD
  • --default-write-back-target (only needed if write-back method is not argocd)
    • optionally configurable via ENV-variable: DEFAULT_WRITE_BACK_TARGET

janpieper avatar Nov 08 '21 09:11 janpieper

That sounds like a great idea. I'd not oppose an appropriate PR :)

jannfis avatar Nov 10 '21 14:11 jannfis