Skip to content

Commit 7c5dcef

Browse files
committed
Disallow pluralized Kinds when creating resources
1 parent 999ae5a commit 7c5dcef

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/kubebuilder/create/util/util.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ package util
1818

1919
import (
2020
"log"
21+
"path/filepath"
2122
"regexp"
2223
"strings"
2324

2425
"github.com/markbates/inflect"
2526
"github.com/spf13/cobra"
2627

2728
"github.com/kubernetes-sigs/kubebuilder/cmd/kubebuilder/util"
28-
"path/filepath"
2929
)
3030

3131
var (
@@ -44,6 +44,9 @@ func ValidateResourceFlags() {
4444
log.Fatal("Must specify --kind")
4545
}
4646
if len(ResourceName) == 0 {
47+
if inflect.NewDefaultRuleset().Pluralize(KindName) == KindName {
48+
log.Fatal("Client code generation expects singular --kind.")
49+
}
4750
ResourceName = inflect.NewDefaultRuleset().Pluralize(strings.ToLower(KindName))
4851
}
4952

0 commit comments

Comments
 (0)