Skip to content

Commit 71237a9

Browse files
author
Mengqi Yu
committed
🐛 fix a plural name bug
1 parent e096922 commit 71237a9

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

pkg/scaffold/v2/crd/enablewebhook_patch.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
"path/filepath"
2222
"strings"
2323

24+
"github.com/markbates/inflect"
25+
2426
"sigs.k8s.io/kubebuilder/pkg/scaffold/input"
2527
"sigs.k8s.io/kubebuilder/pkg/scaffold/v1/resource"
2628
)
@@ -36,8 +38,10 @@ type EnableWebhookPatch struct {
3638
// GetInput implements input.File
3739
func (p *EnableWebhookPatch) GetInput() (input.Input, error) {
3840
if p.Path == "" {
41+
rs := inflect.NewDefaultRuleset()
42+
plural := rs.Pluralize(strings.ToLower(p.Resource.Kind))
3943
p.Path = filepath.Join("config", "crd", "patches",
40-
fmt.Sprintf("webhook_in_%s.yaml", strings.ToLower(p.Resource.Kind)))
44+
fmt.Sprintf("webhook_in_%s.yaml", plural))
4145
}
4246
p.TemplateBody = enableWebhookPatchTemplate
4347
return p.Input, nil

0 commit comments

Comments
 (0)