Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image name gets cut off in kustomization #261

Closed
kharf opened this issue Nov 11, 2021 · 4 comments · Fixed by #262
Closed

Image name gets cut off in kustomization #261

kharf opened this issue Nov 11, 2021 · 4 comments · Fixed by #262
Labels
bug Something isn't working

Comments

@kharf
Copy link

kharf commented Nov 11, 2021

After updating to flux 0.22, our image automation does not work correctly anymore, since the image names get cut off in the kustomization. Even after fixing it, flux always renames it.

kustomization:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: v3
resources:
  - ../../bases/invoice-service
  - sealed-secret.yaml
  - config-map.yaml
  - canary.yaml
images:
  - name: invoice-service
    newName: eu.gcr.io/xxxxxxxxxxxxxxxxxxx/xxxxxx-invoice-service # {"$imagepolicy": "flux-system:invoice-service:name"}
    newTag: 2021-11-11-1015-bd0a681-dev # {"$imagepolicy": "flux-system:invoice-service:tag"}

In the example above flux removes the "e" from "service" and sets the newName in the kustomization like this:
newName: eu.gcr.io/xxxxxxxxxxxxxxxxxxx/xxxxxx-invoice-servic # {"$imagepolicy": "flux-system:invoice-service:name"}

We didn't change anything before upgrading from flux 0.21 to 0.22.

ImageRepository:

apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageRepository
metadata:
  name: invoice-service
  namespace: flux-system
spec:
  image: eu.gcr.io/xxxxxxxxxxxxxxxxxxx/xxxxxx-invoice-service
  interval: 1m0s
  secretRef:
    name: gcr-credentials

ImagePolicy:

apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImagePolicy
metadata:
  name: invoice-service
  namespace: flux-system
spec:
  filterTags:
    pattern: '^(?P<ts>.*)-[a-fA-F0-9]{7}-dev'
    extract: '$ts'
  imageRepositoryRef:
    name: invoice-service
  policy:
    alphabetical:
      order: asc

ImageUpdateAutomation:

apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageUpdateAutomation
metadata:
  name: flux-system
  namespace: flux-system
spec:
  interval: 1m0s
  sourceRef:
    kind: GitRepository
    name: flux-system
  git:
    checkout:
      ref:
        branch: master
    commit:
      author:
        email: [email protected]
        name: Flux Bot 🤖
      messageTemplate: '{{range .Updated.Images}}{{println .}}{{end}}'
    push:
      branch: master
  update:
    path: ./apps/dev
    strategy: Setters

If you need more information, I can help!

@hiddeco
Copy link
Member

hiddeco commented Nov 11, 2021

Suspect this might be related to #257 (cc: @relu)

@hiddeco hiddeco added the bug Something isn't working label Nov 11, 2021
@relu
Copy link
Member

relu commented Nov 11, 2021

Indeed, I can reproduce. I will get back with a patch: https://play.golang.org/p/hVzSWJG1--I

@hiddeco
Copy link
Member

hiddeco commented Nov 11, 2021

If you bump the image to v0.17.1 @kharf, the issue should be gone. CLI release will arrive later today.

@kharf
Copy link
Author

kharf commented Nov 11, 2021

@hiddeco awesome, thanks for the quick fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants