Skip to content

Commit

Permalink
Merge pull request #771 from alexbrand/fix-error-msg
Browse files Browse the repository at this point in the history
Improve error msg returned when no kustomization file is found
  • Loading branch information
k8s-ci-robot committed Feb 7, 2019
2 parents 92bd809 + 242b920 commit ce7e5ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package constants
// by Kustomize.
// In each directory, Kustomize searches for file with the name in this list.
// Only one match is allowed.
var KustomizationFileNames = [3]string{
var KustomizationFileNames = []string{
"kustomization.yaml",
"kustomization.yml",
"Kustomization",
Expand Down
5 changes: 3 additions & 2 deletions pkg/target/kusttarget.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ func loadKustFile(ldr ifc.Loader) ([]byte, error) {
}
switch match {
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:
return content, nil
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())
}
}

Expand Down

0 comments on commit ce7e5ee

Please sign in to comment.