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

Discrepancy when handling "images" field #987

Open
artem-nefedov opened this issue Oct 9, 2023 · 1 comment
Open

Discrepancy when handling "images" field #987

artem-nefedov opened this issue Oct 9, 2023 · 1 comment

Comments

@artem-nefedov
Copy link

artem-nefedov commented Oct 9, 2023

There is a discrepancy with standalone Kustomize when "images" transformer is used.

For example, assume I have a Deployment with image: docker.io/stefanprodan/podinfo:6.0.0 in base manifest, and the following kustomization.yaml:

resources:
- deployment.yaml

images:
- name: docker.io/stefanprodan/podinfo
  newName: ghcr.io/stefanprodan/podinfo
- name: docker.io/stefanprodan/podinfo
  newName: quay.io/stefanprodan/podinfo

If I build this locally, I will get ghcr.io/stefanprodan/podinfo:6.0.0 image in the final manifest. Second list element will be ignored because it won't be able to find target image, since it was already changed in first element. Both standalone kustomize v5 executable and kustomize built into kubectl behave that way, and kustomize-controller will also apply it like that as long as "images" are specified inside kustomization.yaml.

The problem is that, if we remove "images" from kustomization.yaml, and instead specify it inside Kustomization resouce manifest, the behaiour changes.

Assume kustomization.yaml doesn't have "images" anymore, and my Kustomization resource contains the following:

spec:
  images:
  - name: docker.io/stefanprodan/podinfo
    newName: ghcr.io/stefanprodan/podinfo
  - name: docker.io/stefanprodan/podinfo
    newName: quay.io/stefanprodan/podinfo

Only the last list element will be applied, and I will get quay.io/stefanprodan/podinfo:6.0.0 image. AFAIK this is the only field that behaves differently when specified as part of Kustomization.

Tested with kustomize-controller v1.0.1 (flux 2.1.1).

@makkes
Copy link
Member

makkes commented Oct 11, 2023

This is strange because I would expect these lines to reflect the behaviour that you're describing in the first case. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants