This is a working example of using the ImageTagTransformer.
Given below yaml files:
# transformer_1.yaml
---
apiVersion: builtin
kind: ImageTagTransformer
metadata:
name: not-important-here
imageTag:
name: xxx
newName: new-image
newTag: tag
fieldSpecs:
- path: spec/image
kind: Application
# application.yaml
---
apiVersion: foo.example.com/v1alpha1
kind: Application
spec:
image: xxx
# kustomization.yaml
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- application.yaml
transformers:
- transformer_1.yaml
Run this command:
$ kustomize build ./ | kpt cfg grep "kind=Application"
apiVersion: foo.example.com/v1alpha1
kind: Application
spec:
image: new-image:tag
However, I still need to figure out ways to get it work with skaffold workflow.
Update
the feedback from skaffold community said it doesn't support rewriting manifests except those are in an allowlist. So the lesson learn is, skaffold doesn't support rewriting any CRDs yet.