mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #45171 from ncdc/groupName-override
Automatic merge from submit-queue Use groupName comment for listers/informers If present, use the "// +groupName" doc comment as the desired group name when generating listers and informers. @kubernetes/sig-api-machinery-pr-reviews @smarterclayton @deads2k @liggitt @sttts
This commit is contained in:
commit
682f3a39a0
@ -150,6 +150,13 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
targetGroupVersions = externalGroupVersions
|
||||
}
|
||||
|
||||
// If there's a comment of the form "// +groupName=somegroup" or
|
||||
// "// +groupName=somegroup.foo.bar.io", use the first field (somegroup) as the name of the
|
||||
// group when generating.
|
||||
if override := types.ExtractCommentTags("+", p.DocComments)["groupName"]; override != nil {
|
||||
gv.Group = clientgentypes.Group(strings.SplitN(override[0], ".", 2)[0])
|
||||
}
|
||||
|
||||
var typesToGenerate []*types.Type
|
||||
for _, t := range p.Types {
|
||||
// filter out types which dont have genclient=true.
|
||||
|
@ -106,6 +106,13 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
internalGVPkg = strings.Join(parts[0:len(parts)-1], "/")
|
||||
}
|
||||
|
||||
// If there's a comment of the form "// +groupName=somegroup" or
|
||||
// "// +groupName=somegroup.foo.bar.io", use the first field (somegroup) as the name of the
|
||||
// group when generating.
|
||||
if override := types.ExtractCommentTags("+", p.DocComments)["groupName"]; override != nil {
|
||||
gv.Group = clientgentypes.Group(strings.SplitN(override[0], ".", 2)[0])
|
||||
}
|
||||
|
||||
var typesToGenerate []*types.Type
|
||||
for _, t := range p.Types {
|
||||
// filter out types which dont have genclient=true.
|
||||
|
Loading…
Reference in New Issue
Block a user