support different filenames for kustomization file

This commit is contained in:
Jingfang Liu
2019-01-24 12:26:59 -08:00
parent 028724df08
commit f7a59178a8
10 changed files with 50 additions and 38 deletions

View File

@@ -67,7 +67,7 @@ func NewCmdBuild(
cmd := &cobra.Command{
Use: "build [path]",
Short: "Print current configuration per contents of " + constants.KustomizationFileName,
Short: "Print current configuration per contents of " + constants.KustomizationFileNames[0],
Example: examples,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -88,7 +88,7 @@ func NewCmdBuild(
// Validate validates build command.
func (o *BuildOptions) Validate(args []string) error {
if len(args) > 1 {
return errors.New("specify one path to " + constants.KustomizationFileName)
return errors.New("specify one path to " + constants.KustomizationFileNames[0])
}
if len(args) == 0 {
o.kustomizationPath = "./"

View File

@@ -33,7 +33,7 @@ func TestBuildValidate(t *testing.T) {
{"file", []string{"beans"}, "beans", ""},
{"path", []string{"a/b/c"}, "a/b/c", ""},
{"path", []string{"too", "many"},
"", "specify one path to " + constants.KustomizationFileName},
"", "specify one path to " + constants.KustomizationFileNames[0]},
}
for _, mycase := range cases {
opts := BuildOptions{}