argoproj-labs / argocd-image-updater

Automatic container image update for Argo CD
https://argocd-image-updater.readthedocs.io/en/stable/
Apache License 2.0
1.17k stars 241 forks source link

image updater can not rollout the deployment with error "pending spec update" #605

Open aligolestan opened 11 months ago

aligolestan commented 11 months ago

Describe the bug

I've setup image updater to update deployments based on image digest on a private image repository. I have a helm chart in which the image repository and tag are not in their default place and I've put it somewhere else in values.yaml file and its working as it should when deployed via argocd application set. Problem here is that the image updater can not update these changed specs and returns "but pending spec update" in the log.

To Reproduce

Set application's annotations to get image's digest and update the deployment base on that. Create a helm chart and instead of having:

image: 
  repository: registry.***.com/project/app-front
  tag: latest

try to mention the repository and tag somewhere else in the values.yaml file. for example:

deployment:
  spec:
    image:
      repository: registry.***.com/project/app-front
      tag: latest

Expected behavior

On normal circumstances the image updater shall update the image and its deployment base on the annotations provided.

Version

ArgoCD server version: 2.7.2 Image Updater version: 0.12.0 Kubernetes version: 1.25.6

Logs

time="2023-08-09T11:02:45Z" level=debug msg="found 1 from 1 tags eligible for consideration" image="registry.private.com/project/app-front:latest" time="2023-08-09T11:02:45Z" level=info msg="Setting new image to registry.private.com/project/app-front@sha256:8e8a57b11521dd4de100908388ad515c80bcc05ca955c6653fe68dae903fda6a" alias=app-front application=app-front image_name=project/app-front image_tag=dummy registry=registry.private.com time="2023-08-09T11:02:45Z" level=debug msg="target parameters: image-spec= image-name=image.name, image-tag=image.tag" application=app-front image=registry.private.com/project/app-front time="2023-08-09T11:02:45Z" level=info msg="Successfully updated image 'registry.private.com/project/app-front@dummy' to 'registry.private.com/project/app-front@sha256:8e8a57b11521dd4de100908388ad515c80bcc05ca955c6653fe68dae903fda6a', but pending spec update (dry run=false)" alias=app-front application=app-front image_name=project/app-front image_tag=dummy registry=registry.private.com

fwyattblake commented 7 months ago

Anyone know a workaround?

aligolestan commented 7 months ago

@fwyattblake

you just need to update your helm chart to the default values like this:

image: repository: registry.***.com/project/app tag: latest

feraudt commented 7 months ago

Hi @aligolestan

Not sure if you've found a solution yet but in case you haven't, I stumbled upon the same issue and fixed it by simply modifying my chart to look something like this:

components:
  app-front:
    image:
      name: registry.***.com/project/app-front
      tag: default-tag-to-override

And I added the following annotations to my argo Application object:

argocd-image-updater.argoproj.io/image-list: app-front=registry.***.com/project/app-front
argocd-image-updater.argoproj.io/app-front.helm.image-name: components.app-front.image.name
argocd-image-updater.argoproj.io/app-front.helm.image-tag: components.app-front.image.tag
argocd-image-updater.argoproj.io/front.update-strategy: latest

This second part is only required because my Helm chart uses several images and has a more complex structure. In your case though, my guess is renaming the repository field of your chart in a name field would fix the problem. This is because those are the parameters that argocd-image-updater is looking for by default, as you can see here in their docs.

I hope this helps.

bamaas commented 2 weeks ago

Have you found a solution? Im having the same problem.

oubaydos commented 4 days ago

same problem here