How do you add a custom kustomize transformer?

Viewed 2333

I'd like to add a transformer to my kustomize setup, one that includes a dynamic value for the case where the local tag needs to override the production tag. If there's a simpler and better way to do this that would be great. I've looked through the list of transformers and generators to see if there was a way to provide this value at runtime (though I think specifically kustomize is designed to never use runtime values).

I can specify something like this:

images:
  - name: my-image
    newTag: my-sha1

The problem is to change the my-sha1 value after each new local build to then pick that image when I go to apply the local deployment.

How can I set newTag after I run a build locally to match a tag for the image I made locally? I can easily obtain the latest build tag and provide with to kubectl apply -f, but I'm not seeing a flag or environment variable, or something to do so.

0 Answers
Related