go.mod: bump client-go and api machinerie
I had to run `make generate`. Some API functions got additional parameters `Options` and `Context`. I used empty options and `context.TODO()` for now. Signed-off-by: leonnicolas <leonloechner@gmx.de>
This commit is contained in:
8
vendor/k8s.io/code-generator/cmd/informer-gen/args/args.go
generated
vendored
8
vendor/k8s.io/code-generator/cmd/informer-gen/args/args.go
generated
vendored
@@ -31,13 +31,18 @@ type CustomArgs struct {
|
||||
InternalClientSetPackage string
|
||||
ListersPackage string
|
||||
SingleDirectory bool
|
||||
|
||||
// PluralExceptions define a list of pluralizer exceptions in Type:PluralType format.
|
||||
// The default list is "Endpoints:Endpoints"
|
||||
PluralExceptions []string
|
||||
}
|
||||
|
||||
// NewDefaults returns default arguments for the generator.
|
||||
func NewDefaults() (*args.GeneratorArgs, *CustomArgs) {
|
||||
genericArgs := args.Default().WithoutDefaultFlagParsing()
|
||||
customArgs := &CustomArgs{
|
||||
SingleDirectory: false,
|
||||
SingleDirectory: false,
|
||||
PluralExceptions: []string{"Endpoints:Endpoints"},
|
||||
}
|
||||
genericArgs.CustomArgs = customArgs
|
||||
|
||||
@@ -57,6 +62,7 @@ func (ca *CustomArgs) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&ca.VersionedClientSetPackage, "versioned-clientset-package", ca.VersionedClientSetPackage, "the full package name for the versioned clientset to use")
|
||||
fs.StringVar(&ca.ListersPackage, "listers-package", ca.ListersPackage, "the full package name for the listers to use")
|
||||
fs.BoolVar(&ca.SingleDirectory, "single-directory", ca.SingleDirectory, "if true, omit the intermediate \"internalversion\" and \"externalversions\" subdirectories")
|
||||
fs.StringSliceVar(&ca.PluralExceptions, "plural-exceptions", ca.PluralExceptions, "list of comma separated plural exception definitions in Type:PluralizedType format")
|
||||
}
|
||||
|
||||
// Validate checks the given arguments.
|
||||
|
2
vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go
generated
vendored
2
vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go
generated
vendored
@@ -25,7 +25,7 @@ import (
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// factoryGenerator produces a file of listers for a given GroupVersion and
|
||||
|
2
vendor/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go
generated
vendored
2
vendor/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go
generated
vendored
@@ -23,7 +23,7 @@ import (
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// factoryInterfaceGenerator produces a file of interfaces used to break a dependency cycle for
|
||||
|
18
vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go
generated
vendored
18
vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go
generated
vendored
@@ -35,6 +35,7 @@ type genericGenerator struct {
|
||||
imports namer.ImportTracker
|
||||
groupVersions map[string]clientgentypes.GroupVersions
|
||||
groupGoNames map[string]string
|
||||
pluralExceptions map[string]string
|
||||
typesForGroupVersion map[clientgentypes.GroupVersion][]*types.Type
|
||||
filtered bool
|
||||
}
|
||||
@@ -50,14 +51,11 @@ func (g *genericGenerator) Filter(c *generator.Context, t *types.Type) bool {
|
||||
}
|
||||
|
||||
func (g *genericGenerator) Namers(c *generator.Context) namer.NameSystems {
|
||||
pluralExceptions := map[string]string{
|
||||
"Endpoints": "Endpoints",
|
||||
}
|
||||
return namer.NameSystems{
|
||||
"raw": namer.NewRawNamer(g.outputPackage, g.imports),
|
||||
"allLowercasePlural": namer.NewAllLowercasePluralNamer(pluralExceptions),
|
||||
"publicPlural": namer.NewPublicPluralNamer(pluralExceptions),
|
||||
"resource": codegennamer.NewTagOverrideNamer("resourceName", namer.NewAllLowercasePluralNamer(pluralExceptions)),
|
||||
"allLowercasePlural": namer.NewAllLowercasePluralNamer(g.pluralExceptions),
|
||||
"publicPlural": namer.NewPublicPluralNamer(g.pluralExceptions),
|
||||
"resource": codegennamer.NewTagOverrideNamer("resourceName", namer.NewAllLowercasePluralNamer(g.pluralExceptions)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +73,11 @@ type group struct {
|
||||
|
||||
type groupSort []group
|
||||
|
||||
func (g groupSort) Len() int { return len(g) }
|
||||
func (g groupSort) Less(i, j int) bool { return strings.ToLower(g[i].Name) < strings.ToLower(g[j].Name) }
|
||||
func (g groupSort) Swap(i, j int) { g[i], g[j] = g[j], g[i] }
|
||||
func (g groupSort) Len() int { return len(g) }
|
||||
func (g groupSort) Less(i, j int) bool {
|
||||
return strings.ToLower(g[i].Name) < strings.ToLower(g[j].Name)
|
||||
}
|
||||
func (g groupSort) Swap(i, j int) { g[i], g[j] = g[j], g[i] }
|
||||
|
||||
type version struct {
|
||||
Name string
|
||||
|
6
vendor/k8s.io/code-generator/cmd/informer-gen/generators/informer.go
generated
vendored
6
vendor/k8s.io/code-generator/cmd/informer-gen/generators/informer.go
generated
vendored
@@ -28,7 +28,7 @@ import (
|
||||
"k8s.io/code-generator/cmd/client-gen/generators/util"
|
||||
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
|
||||
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
// informerGenerator produces a file of listers for a given GroupVersion and
|
||||
@@ -151,13 +151,13 @@ func NewFiltered$.type|public$Informer(client $.clientSetInterface|raw$$if .name
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).List(options)
|
||||
return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options $.v1ListOptions|raw$) ($.watchInterface|raw$, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).Watch(options)
|
||||
return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&$.type|raw${},
|
||||
|
29
vendor/k8s.io/code-generator/cmd/informer-gen/generators/packages.go
generated
vendored
29
vendor/k8s.io/code-generator/cmd/informer-gen/generators/packages.go
generated
vendored
@@ -26,18 +26,16 @@ import (
|
||||
"k8s.io/gengo/generator"
|
||||
"k8s.io/gengo/namer"
|
||||
"k8s.io/gengo/types"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
"k8s.io/code-generator/cmd/client-gen/generators/util"
|
||||
clientgentypes "k8s.io/code-generator/cmd/client-gen/types"
|
||||
informergenargs "k8s.io/code-generator/cmd/informer-gen/args"
|
||||
genutil "k8s.io/code-generator/pkg/util"
|
||||
)
|
||||
|
||||
// NameSystems returns the name system used by the generators in this package.
|
||||
func NameSystems() namer.NameSystems {
|
||||
pluralExceptions := map[string]string{
|
||||
"Endpoints": "Endpoints",
|
||||
}
|
||||
func NameSystems(pluralExceptions map[string]string) namer.NameSystems {
|
||||
return namer.NameSystems{
|
||||
"public": namer.NewPublicNamer(0),
|
||||
"private": namer.NewPrivateNamer(0),
|
||||
@@ -91,13 +89,6 @@ func packageForInternalInterfaces(base string) string {
|
||||
return filepath.Join(base, "internalinterfaces")
|
||||
}
|
||||
|
||||
func vendorless(p string) string {
|
||||
if pos := strings.LastIndex(p, "/vendor/"); pos != -1 {
|
||||
return p[pos+len("/vendor/"):]
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// Packages makes the client package definition.
|
||||
func Packages(context *generator.Context, arguments *args.GeneratorArgs) generator.Packages {
|
||||
boilerplate, err := arguments.LoadGoBoilerplate()
|
||||
@@ -124,7 +115,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
internalGroupVersions := make(map[string]clientgentypes.GroupVersions)
|
||||
groupGoNames := make(map[string]string)
|
||||
for _, inputDir := range arguments.InputDirs {
|
||||
p := context.Universe.Package(vendorless(inputDir))
|
||||
p := context.Universe.Package(genutil.Vendorless(inputDir))
|
||||
|
||||
objectMeta, internal, err := objectMetaForPackage(p)
|
||||
if err != nil {
|
||||
@@ -208,7 +199,9 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
|
||||
if len(externalGroupVersions) != 0 {
|
||||
packageList = append(packageList, factoryInterfacePackage(externalVersionPackagePath, boilerplate, customArgs.VersionedClientSetPackage))
|
||||
packageList = append(packageList, factoryPackage(externalVersionPackagePath, boilerplate, groupGoNames, externalGroupVersions, customArgs.VersionedClientSetPackage, typesForGroupVersion))
|
||||
packageList = append(packageList, factoryPackage(externalVersionPackagePath, boilerplate, groupGoNames, genutil.PluralExceptionListToMapOrDie(customArgs.PluralExceptions), externalGroupVersions,
|
||||
customArgs.VersionedClientSetPackage,
|
||||
typesForGroupVersion))
|
||||
for _, gvs := range externalGroupVersions {
|
||||
packageList = append(packageList, groupPackage(externalVersionPackagePath, gvs, boilerplate))
|
||||
}
|
||||
@@ -216,7 +209,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
|
||||
if len(internalGroupVersions) != 0 {
|
||||
packageList = append(packageList, factoryInterfacePackage(internalVersionPackagePath, boilerplate, customArgs.InternalClientSetPackage))
|
||||
packageList = append(packageList, factoryPackage(internalVersionPackagePath, boilerplate, groupGoNames, internalGroupVersions, customArgs.InternalClientSetPackage, typesForGroupVersion))
|
||||
packageList = append(packageList, factoryPackage(internalVersionPackagePath, boilerplate, groupGoNames, genutil.PluralExceptionListToMapOrDie(customArgs.PluralExceptions), internalGroupVersions, customArgs.InternalClientSetPackage, typesForGroupVersion))
|
||||
for _, gvs := range internalGroupVersions {
|
||||
packageList = append(packageList, groupPackage(internalVersionPackagePath, gvs, boilerplate))
|
||||
}
|
||||
@@ -225,7 +218,8 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
return packageList
|
||||
}
|
||||
|
||||
func factoryPackage(basePackage string, boilerplate []byte, groupGoNames map[string]string, groupVersions map[string]clientgentypes.GroupVersions, clientSetPackage string, typesForGroupVersion map[clientgentypes.GroupVersion][]*types.Type) generator.Package {
|
||||
func factoryPackage(basePackage string, boilerplate []byte, groupGoNames, pluralExceptions map[string]string, groupVersions map[string]clientgentypes.GroupVersions, clientSetPackage string,
|
||||
typesForGroupVersion map[clientgentypes.GroupVersion][]*types.Type) generator.Package {
|
||||
return &generator.DefaultPackage{
|
||||
PackageName: filepath.Base(basePackage),
|
||||
PackagePath: basePackage,
|
||||
@@ -250,6 +244,7 @@ func factoryPackage(basePackage string, boilerplate []byte, groupGoNames map[str
|
||||
outputPackage: basePackage,
|
||||
imports: generator.NewImportTracker(),
|
||||
groupVersions: groupVersions,
|
||||
pluralExceptions: pluralExceptions,
|
||||
typesForGroupVersion: typesForGroupVersion,
|
||||
groupGoNames: groupGoNames,
|
||||
})
|
||||
@@ -283,7 +278,7 @@ func factoryInterfacePackage(basePackage string, boilerplate []byte, clientSetPa
|
||||
|
||||
func groupPackage(basePackage string, groupVersions clientgentypes.GroupVersions, boilerplate []byte) generator.Package {
|
||||
packagePath := filepath.Join(basePackage, groupVersions.PackageName)
|
||||
groupPkgName := strings.Split(string(groupVersions.Group), ".")[0]
|
||||
groupPkgName := strings.Split(string(groupVersions.PackageName), ".")[0]
|
||||
|
||||
return &generator.DefaultPackage{
|
||||
PackageName: groupPkgName,
|
||||
|
33
vendor/k8s.io/code-generator/cmd/informer-gen/generators/tags.go
generated
vendored
33
vendor/k8s.io/code-generator/cmd/informer-gen/generators/tags.go
generated
vendored
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package generators
|
||||
|
||||
import (
|
||||
"k8s.io/gengo/types"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
// extractBoolTagOrDie gets the comment-tags for the key and asserts that, if
|
||||
// it exists, the value is boolean. If the tag did not exist, it returns
|
||||
// false.
|
||||
func extractBoolTagOrDie(key string, lines []string) bool {
|
||||
val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines)
|
||||
if err != nil {
|
||||
klog.Fatal(err)
|
||||
}
|
||||
return val
|
||||
}
|
2
vendor/k8s.io/code-generator/cmd/informer-gen/generators/versioninterface.go
generated
vendored
2
vendor/k8s.io/code-generator/cmd/informer-gen/generators/versioninterface.go
generated
vendored
@@ -68,7 +68,7 @@ func (g *versionInterfaceGenerator) GenerateType(c *generator.Context, t *types.
|
||||
|
||||
sw.Do(versionTemplate, m)
|
||||
for _, typeDef := range g.types {
|
||||
tags, err := util.ParseClientGenTags(typeDef.SecondClosestCommentLines)
|
||||
tags, err := util.ParseClientGenTags(append(typeDef.SecondClosestCommentLines, typeDef.CommentLines...))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
4
vendor/k8s.io/code-generator/cmd/informer-gen/main.go
generated
vendored
4
vendor/k8s.io/code-generator/cmd/informer-gen/main.go
generated
vendored
@@ -24,7 +24,7 @@ import (
|
||||
"k8s.io/code-generator/cmd/informer-gen/generators"
|
||||
"k8s.io/code-generator/pkg/util"
|
||||
"k8s.io/gengo/args"
|
||||
"k8s.io/klog"
|
||||
"k8s.io/klog/v2"
|
||||
|
||||
generatorargs "k8s.io/code-generator/cmd/informer-gen/args"
|
||||
)
|
||||
@@ -53,7 +53,7 @@ func main() {
|
||||
|
||||
// Run it.
|
||||
if err := genericArgs.Execute(
|
||||
generators.NameSystems(),
|
||||
generators.NameSystems(util.PluralExceptionListToMapOrDie(customArgs.PluralExceptions)),
|
||||
generators.DefaultNameSystem(),
|
||||
generators.Packages,
|
||||
); err != nil {
|
||||
|
Reference in New Issue
Block a user