Skip to content

Commit ce7e5ee

Browse files
authored
Merge pull request #771 from alexbrand/fix-error-msg
Improve error msg returned when no kustomization file is found
2 parents 92bd809 + 242b920 commit ce7e5ee

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pkg/constants/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package constants
2121
// by Kustomize.
2222
// In each directory, Kustomize searches for file with the name in this list.
2323
// Only one match is allowed.
24-
var KustomizationFileNames = [3]string{
24+
var KustomizationFileNames = []string{
2525
"kustomization.yaml",
2626
"kustomization.yml",
2727
"Kustomization",

pkg/target/kusttarget.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,12 @@ func loadKustFile(ldr ifc.Loader) ([]byte, error) {
8888
}
8989
switch match {
9090
case 0:
91-
return nil, fmt.Errorf("no kustomization.yaml file under %s", ldr.Root())
91+
return nil, fmt.Errorf("No kustomization file found in %s. Kustomize supports the following kustomization files: %s",
92+
ldr.Root(), strings.Join(constants.KustomizationFileNames, ", "))
9293
case 1:
9394
return content, nil
9495
default:
95-
return nil, fmt.Errorf("Found multiple kustomization file under: %s\n", ldr.Root())
96+
return nil, fmt.Errorf("Found multiple kustomization files under: %s\n", ldr.Root())
9697
}
9798
}
9899

0 commit comments

Comments
 (0)