diff --git a/pkg/scaffold/v2/crd/enablewebhook_patch.go b/pkg/scaffold/v2/crd/enablewebhook_patch.go index c523bff4e9b..f2496c76ae3 100644 --- a/pkg/scaffold/v2/crd/enablewebhook_patch.go +++ b/pkg/scaffold/v2/crd/enablewebhook_patch.go @@ -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" ) @@ -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 diff --git a/testdata/project-v2/config/crd/patches/webhook_in_captain.yaml b/testdata/project-v2/config/crd/patches/webhook_in_captains.yaml similarity index 100% rename from testdata/project-v2/config/crd/patches/webhook_in_captain.yaml rename to testdata/project-v2/config/crd/patches/webhook_in_captains.yaml diff --git a/testdata/project-v2/config/crd/patches/webhook_in_firstmate.yaml b/testdata/project-v2/config/crd/patches/webhook_in_firstmates.yaml similarity index 100% rename from testdata/project-v2/config/crd/patches/webhook_in_firstmate.yaml rename to testdata/project-v2/config/crd/patches/webhook_in_firstmates.yaml