@@ -56,7 +56,8 @@ func (d *controllerGenerator) Imports(c *generator.Context) []string {
56
56
func (d * controllerGenerator ) Finalize (context * generator.Context , w io.Writer ) error {
57
57
temp := template .Must (template .New ("controller-template" ).Funcs (
58
58
template.FuncMap {
59
- "title" : strings .Title ,
59
+ "title" : strings .Title ,
60
+ "plural" : inflect .NewDefaultRuleset ().Pluralize ,
60
61
},
61
62
).Parse (ControllerAPITemplate ))
62
63
return temp .Execute (w , d .controller )
@@ -95,7 +96,7 @@ func New{{.Target.Kind}}Controller(config *rest.Config, si *sharedinformers.Shar
95
96
c.Informers.WorkerQueues = map[string]*controller.QueueWorker{}
96
97
}
97
98
c.Informers.WorkerQueues["{{.Target.Kind}}"] = queue
98
- si.Factory.{{title .Target.Group}}().{{title .Target.Version}}().{{title .Resource }}().Informer().
99
+ si.Factory.{{title .Target.Group}}().{{title .Target.Version}}().{{plural .Target.Kind }}().Informer().
99
100
AddEventHandler(&controller.QueueingEventHandler{q, nil, false})
100
101
return c
101
102
}
@@ -191,7 +192,8 @@ func (d *allControllerGenerator) Imports(c *generator.Context) []string {
191
192
func (d * allControllerGenerator ) Finalize (context * generator.Context , w io.Writer ) error {
192
193
temp := template .Must (template .New ("all-controller-template" ).Funcs (
193
194
template.FuncMap {
194
- "title" : strings .Title ,
195
+ "title" : strings .Title ,
196
+ "plural" : inflect .NewDefaultRuleset ().Pluralize ,
195
197
},
196
198
).Parse (AllControllerAPITemplate ))
197
199
return temp .Execute (w , d )
0 commit comments