For CI/CD purposes, the project is maintaining 2 kustomization.yaml files
To run kustomize build, a file with the name "kustomization.yaml" is required in the current directory. If the project wants to use kustomization_rollback.yaml and NOT kustomization.yaml, how is this possible? Does kustomize accept file name as an argument? Docs do not specify anything on this.
Currently there is no possibility to change the behavior of kustomize
to support other file names (by using precompiled binaries) than:
kustomization.yaml
kustomization.yml
Kustomization
All of the below cases will produce the same error output:
kubectl kustomize dir/
kubectl apply -k dir/
kustomize build dir/
Error: unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory 'FULL_PATH/dir'
Depending on the CI/CD platform/solution/tool you should try other way around like for example:
Deployment
into 2 directories kustomization_deploy
/kustomization_rollback
with kustomization.yaml
As a side note!
File names that kustomize uses are placed in the:
/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/constants/constants.go
// Package constants holds global constants for the kustomize tool. package constants // KustomizationFileNames is a list of filenames that can be recognized and consumbed // by Kustomize. // In each directory, Kustomize searches for file with the name in this list. // Only one match is allowed. var KustomizationFileNames = []string{ "kustomization.yaml", "kustomization.yml", "Kustomization", }
The logic behind choosing the
Kustomization
file is placed in:
/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/target/kusttarget.go
Additional reference:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With