mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Improve error msg returned when no kustomization file is found
Signed-off-by: Alexander Brand <alexbrand09@gmail.com>
This commit is contained in:
@@ -21,7 +21,7 @@ package constants
|
|||||||
// by Kustomize.
|
// by Kustomize.
|
||||||
// In each directory, Kustomize searches for file with the name in this list.
|
// In each directory, Kustomize searches for file with the name in this list.
|
||||||
// Only one match is allowed.
|
// Only one match is allowed.
|
||||||
var KustomizationFileNames = [3]string{
|
var KustomizationFileNames = []string{
|
||||||
"kustomization.yaml",
|
"kustomization.yaml",
|
||||||
"kustomization.yml",
|
"kustomization.yml",
|
||||||
"Kustomization",
|
"Kustomization",
|
||||||
|
|||||||
@@ -88,11 +88,12 @@ func loadKustFile(ldr ifc.Loader) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
switch match {
|
switch match {
|
||||||
case 0:
|
case 0:
|
||||||
return nil, fmt.Errorf("no kustomization.yaml file under %s", ldr.Root())
|
return nil, fmt.Errorf("No kustomization file found in %s. Kustomize supports the following kustomization files: %s",
|
||||||
|
ldr.Root(), strings.Join(constants.KustomizationFileNames, ", "))
|
||||||
case 1:
|
case 1:
|
||||||
return content, nil
|
return content, nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("Found multiple kustomization file under: %s\n", ldr.Root())
|
return nil, fmt.Errorf("Found multiple kustomization files under: %s\n", ldr.Root())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user