目前不可能改变行为kustomize
以支持其他文件名(通过使用预编译的二进制文件),而不是:
kustomization.yaml
kustomization.yml
Kustomization
以下所有情况都会产生相同的错误输出:
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'
根据 CI/CD 平台/解决方案/工具,您应该尝试其他方式,例如:
- 拆分
Deployment
成 2 个目录kustomization_deploy
/kustomization_rollback
与kustomization.yaml
作为旁注!
kustomize 使用的文件名放置在:
/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",
}
选择文件背后的逻辑Kustomization
放在:
/kubernetes/vendor/sigs.k8s.io/kustomize/pkg/target/kusttarget.go
附加参考: