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

Avoid writing registry URL to git

Open poksiala opened this issue 3 years ago • 1 comments

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

We are using argocd-image-updater with git write back and have multiple independent clusters that deploy apps from that repository. We have a chart with multiple images and the resulting .argocd-source.yaml looks like one below.

helm:
  parameters:
  - name: myapp.image.repository
    value: myreg.io/myorg/myapp
    forcestring: true
  - name: myapp.image.tag
    value: 1.31.0
    forcestring: true

My problem is, that some of these clusters are isolated to a level where they all can't pull images from the same registry. Mirroring images to local registries is not a problem, that we have solved already. But when registry (or repository) is defined in .argocd-source.yaml as parameter it seems to be impossible to override it anywhere.

Describe the solution you'd like I would like to be able to use git write back only for image.tag. image.repository is usually anyways defined trough Helm values.

Describe alternatives you've considered As per https://argo-cd.readthedocs.io/en/stable/user-guide/parameters/#store-overrides-in-git I tried creating additional .argocd-source-<app name>.yaml files that would only contain image.repository information. This resulted in all images missing their tag information as it seems arrays are not merged but overwritten.

Additional context I could try providing a PR for this if there is no technical reason for writing registry information to git. Any ideas how to go around this are welcome if this behaviour can't be changed.

poksiala avatar Aug 01 '22 09:08 poksiala

I found a stupid solution around this issue: by changing annotation to

argocd-image-updater.argoproj.io/myapp.helm.image-name: myapp.image.devnull

Registry information will be written to parameter that is not used for anything. Then in each cluster we can overwrite registry in values.yaml.

But this feels a bit hacky and I still wonder if there is any point in writing that registry information to git in the first place.

poksiala avatar Aug 01 '22 11:08 poksiala

I have a similiar problem. My .argocd-source-<app>.yaml which has been generated looks like

helm:
  parameters:
  - name: env
    value: prod
    forcestring: false
  - name: image.name
    value: gitea/gitea
    forcestring: true
  - name: image.tag
    value: 1.17.3
    forcestring: true

env is a parameter that comes from my app-of-apps and should not appear in .argocd-source-<app>.yaml as I use the git repo also for other stages like dev and now that does not work anymore because I cannot overwrite env anymore.

windsource avatar Oct 23 '22 11:10 windsource