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

`write-back-target: kustomization` doesn't respect default registry prefixes

Open bcbrockway opened this issue 3 years ago • 0 comments

Describe the bug

When a kustomized image has the default registry prefix explicitly set in the base the image updater will remove the prefix when it updates the kustomization.yaml file:

# deployment-manifest.yaml
image: index.docker.io/mintel/atlassian-automator:auto-replaced
# argo-app-manifest.yaml
argocd-image-updater.argoproj.io/image-list: atlassian-automator=index.docker.io/mintel/atlassian-automator
# kustomization.yaml
images:
- name: index.docker.io/mintel/atlassian-automator # <-- What I added manually
  newTag: 0.1.0-beta.2                             # <-- What I added manually
- name: mintel/atlassian-automator                 # <-- What the image updater added
  newTag: 0.1.0                                    # <-- What the image updater added

To Reproduce

  1. Create a workload using kustomize with the default registry prefix in the image field
    image: index.docker.io/myuser/myimage:latest
    
  2. Set the appropriate annotations in the argo app manifest:
    argocd-image-updater.argoproj.io/myimage.update-strategy: latest
    argocd-image-updater.argoproj.io/git-branch: main
    argocd-image-updater.argoproj.io/image-list: myimage=index.docker.io/myuser/myimage
    argocd-image-updater.argoproj.io/write-back-method: git:secret:argocd/my-secret
    argocd-image-updater.argoproj.io/write-back-target: kustomization
    
  3. Image Updater adds a kustomization.yaml entry as follows:
    images:
    - name: myuser/myimage
      newTag: mynewtag
    

Expected behavior Image Updater respects the image-list annotation as-is and adds a kustomization.yaml entry as follows:

images:
- name: index.docker.io/myuser/myimage
  newTag: mynewtag

Version

v0.12.0

bcbrockway avatar Jul 14 '22 08:07 bcbrockway