Skip to content

Commit

Permalink
👻 fix a plural name bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mengqi Yu committed Jun 4, 2019
1 parent 89a15e0 commit 86e5e18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/scaffold/v2/crd/enablewebhook_patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"path/filepath"
"strings"

"github.com/markbates/inflect"

"sigs.k8s.io/kubebuilder/pkg/scaffold/input"
"sigs.k8s.io/kubebuilder/pkg/scaffold/v1/resource"
)
Expand All @@ -36,8 +38,10 @@ type EnableWebhookPatch struct {
// GetInput implements input.File
func (p *EnableWebhookPatch) GetInput() (input.Input, error) {
if p.Path == "" {
rs := inflect.NewDefaultRuleset()
plural := rs.Pluralize(strings.ToLower(p.Resource.Kind))
p.Path = filepath.Join("config", "crd", "patches",
fmt.Sprintf("webhook_in_%s.yaml", strings.ToLower(p.Resource.Kind)))
fmt.Sprintf("webhook_in_%s.yaml", plural))
}
p.TemplateBody = enableWebhookPatchTemplate
return p.Input, nil
Expand Down

0 comments on commit 86e5e18

Please sign in to comment.