I have rather unusual issue with Kustomize and/or git.
I’m using kustomize with openshift and have following catalog structure:
├── bases
│ └── deployment.yaml
├── kustomization.yaml
└── overlays
└── kustomization.yaml
Deployment is standard kubernetes’ deployment with following values:
- name: example
image: kustomize_image
and overlays/kustomization.yaml
:
images:
- name: kustomize_image
newName: repo/image_name
newTag: tag
And when I run kustomize build ./ | oc apply --dry-run=client -o yaml -f -
to check if the values are correctly applied it looks OK, deployment’s image is replaces with repo/image_name:tag
BUT when I push those changes to remote git repository image substitution stops working. Instead of correctly assigned image:tag
it leaves image: kustomize_image
.
It works locally again when I change name of deployment and replicas: -name:
in kustomization file.
This setup works correctly for other services that use the same setup. The only way I got this to work was hardcoding image in bases/deployment.yaml
but it’s not ideal as I want those values to be changed in CI/CD pipeline.