Skip to content

[flux/v2.9.x] kustomize: preserve existing image fields when merging spec.images#1267

Merged
matheuscscp merged 3 commits into
flux/v2.9.xfrom
backport-1266-to-flux/v2.9.x
Jul 22, 2026
Merged

[flux/v2.9.x] kustomize: preserve existing image fields when merging spec.images#1267
matheuscscp merged 3 commits into
flux/v2.9.xfrom
backport-1266-to-flux/v2.9.x

Conversation

@fluxcdbot

Copy link
Copy Markdown
Member

Automated backport to flux/v2.9.x, triggered by a label in #1266.

gecube and others added 3 commits July 22, 2026 11:09
When the kustomization.yaml at the Kustomization's spec.path already
contains an images entry for the same image name, the generator
replaced the whole entry with the one from spec.images, silently
dropping any field set only in the existing entry. With spec.images
setting only newName, the newTag applied by the kustomization.yaml
was lost and the build produced an untagged image reference,
diverging from how a kustomize overlay handles a partial image
override.

Merge the fields into the existing entry instead, so a partial
override preserves the remaining fields.

Fixes fluxcd/flux2#5787

Signed-off-by: Gaál György <gb12335@gmail.com>
(cherry picked from commit aee2dab)
Co-authored-by: Matheus Pimenta <matheuscscp@gmail.com>
Signed-off-by: George Gaál <gb12335@gmail.com>
(cherry picked from commit 812fbbb)
Extend the Test_Images table with the cross tag<->digest cases: an
incoming newTag clears an existing digest and vice versa, newName is
untouched by the pair update, setting both fields applies both, and an
entry carrying only a name is a no-op. Document the pairing in the
generator: it mirrors the kustomize image transformer, which replaces
both original values whenever either is overridden.

Signed-off-by: Gaál György <gb12335@gmail.com>
(cherry picked from commit 56fcba1)
@matheuscscp
matheuscscp merged commit dc9add2 into flux/v2.9.x Jul 22, 2026
11 of 12 checks passed
@matheuscscp
matheuscscp deleted the backport-1266-to-flux/v2.9.x branch July 22, 2026 11:11
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

Successfully merging this pull request may close these issues.

3 participants