fluxcd/image-reflector-controller

Image update automation appending instead of replacing

freefood89 opened this issue · 3 comments

Hello, I'm experiencing issues with image update automation where the latest tag is being appended to the image tag instead of replacing it.

version: ghcr.io/fluxcd/image-automation-controller:v0.22.1

The tag in the original manifest is gcr.io/xyz/crasample:develop-deadbeef-0, the latest tag is gcr.io/xyz/crasample:develop-deadbeef-3 and the automation result is gcr.io/xyz/crasample:develop-deadbeef-0:develop-deadbeef-3

When the manifest was gcr.io/xyz/crasample:5.0.0 the result was gcr.io/xyz/crasample:5.0.0:develop-deadbeef-3

apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImagePolicy
metadata:
  name: crasample-crasample
  namespace: some-namespace
spec:
  filterTags:
    extract: $ts
    pattern: ^develop-[a-fA-F0-9]+-(?P<ts>.*)
  imageRepositoryRef:
    name: crasample-crasample
    namespace: convai
  policy:
    numerical:
      order: asc

apiVersion: apps/v1
kind: Deployment
spec:
  ...
      containers:
      - image: gcr.io/nosidelines/crasample:develop-deadbeef-0 # {"$imagepolicy": "some-namespace:crasample-crasample"}
~ flux get all -n some-namespace
NAME                               	LAST SCAN                	SUSPENDED	READY	MESSAGE                        
imagerepository/crasample-crasample	2022-06-07T13:57:16-10:00	False    	True 	successful scan, found 61 tags	

NAME                           	LATEST IMAGE                                                      	READY	MESSAGE                                                                                                
imagepolicy/crasample-crasample	gcr.io/xyz/crasample:develop-deadbeef-0:develop-deadbeef-3	True 	Latest image tag for 'gcr.io/xyz/crasample:develop-deadbeef-0' resolved to: develop-deadbeef-3	

NAME                                	LAST RUN                 	SUSPENDED	READY	MESSAGE                                                                                                                                                                                           
imageupdateautomation/team-manifests	2022-05-19T13:41:00-10:00	False    	False	encountered invalid image ref "gcr.io/xyz/crasample:develop-deadbeef-0:develop-deadbeef-3": could not parse reference: gcr.io/xyz/crasample:develop-deadbeef-0:develop-deadbeef-3	

Can you post here your ImageRepository YAML please.

I've managed to reproduce this, the issue comes from setting a tag in the ImageRepository, starting with next version we'll error out when tags are used in .spec.image.

thank you. you were right about the tag in the ImageRepository