3

For a Kubernetes deployment, given a Kustomize Base like:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
...
images:
  - name: developmentregistry.com/myimage:v1.0

Is there a way to change only the image registry and retain the o.g. tag with an Overlay without re-declaring the image using image transformers?

For example if I use an Overlay like:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
...
images:
  - newName: productionregistry.com/myimage

The image is deployed as just productionregistry.com/myimage— which is not what I want.
How can I make it so my Overlay deployment yields productionregistry.com/myimage:v1.0? I cannot find any other posts or any issues about this.
Would I have to use Patches instead of image transformers?

David Maze
  • 130,717
  • 29
  • 175
  • 215
superNES64
  • 628
  • 5
  • 14

1 Answers1

6

Okay I figured it out — Kustomization Yamls are finnicky so you must have the right yaml structure.

This works:

Base

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
...
images:
  - name: developmentregistry.com/myimage
    newTag: v1.0

Overlay

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
...
images:
  - name: developmentregistry.com/myimage
    newName: productionregistry.com/myimage
superNES64
  • 628
  • 5
  • 14