diff --git a/Gopkg.lock b/Gopkg.lock index 4383fc59db4f..36421ff24d14 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1053,8 +1053,8 @@ version = "kubernetes-1.13.4" [[projects]] - branch = "master" - digest = "1:b08990af561d72cf4e0a019a1f53ba87377d29c14c6d1d181916b9b9b1f35c7b" + branch = "release-1.13" + digest = "1:2d4e25d510d99febad7145a01c6fe92037e39cae579d5fc0e23963f7a96d350c" name = "k8s.io/code-generator" packages = [ "cmd/client-gen", @@ -1073,11 +1073,10 @@ "cmd/lister-gen", "cmd/lister-gen/args", "cmd/lister-gen/generators", - "pkg/namer", "pkg/util", ] pruneopts = "UT" - revision = "3a2206dd6a78497deceb3ae058417fdeb2036c7e" + revision = "c2090bec4d9b1fb25de3812f868accc2bc9ecbae" [[projects]] branch = "master" diff --git a/Gopkg.toml b/Gopkg.toml index 1316ef39ae3b..bdb70f41c2fb 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -23,15 +23,19 @@ required = [ # STANZAS BELOW ARE GENERATED AND MAY BE WRITTEN - DO NOT MODIFY BELOW THIS LINE. [[constraint]] - name="sigs.k8s.io/controller-runtime" - version="v0.1.12" + name = "sigs.k8s.io/controller-runtime" + version = "v0.1.12" [[constraint]] - name="sigs.k8s.io/controller-tools" - version="v0.1.10" + name = "sigs.k8s.io/controller-tools" + version = "v0.1.10" + +[[constraint]] + name = "k8s.io/code-generator" + branch = "release-1.13" # For dependency below: Refer to issue https://github.com/golang/dep/issues/1799 [[override]] name = "gopkg.in/fsnotify.v1" source = "https://github.com/fsnotify/fsnotify.git" -version="v1.4.7" +version = "v1.4.7" diff --git a/pkg/controller/cluster/BUILD.bazel b/pkg/controller/cluster/BUILD.bazel index fffaf6b58992..60c81d49b42f 100644 --- a/pkg/controller/cluster/BUILD.bazel +++ b/pkg/controller/cluster/BUILD.bazel @@ -13,6 +13,7 @@ go_library( "//pkg/apis/cluster/v1alpha1:go_default_library", "//pkg/controller/error:go_default_library", "//pkg/util:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", diff --git a/pkg/controller/machine/BUILD.bazel b/pkg/controller/machine/BUILD.bazel index 814ee6908d98..2e84bb00a6de 100644 --- a/pkg/controller/machine/BUILD.bazel +++ b/pkg/controller/machine/BUILD.bazel @@ -13,6 +13,7 @@ go_library( "//pkg/apis/cluster/v1alpha1:go_default_library", "//pkg/controller/error:go_default_library", "//pkg/util:go_default_library", + "//vendor/github.com/pkg/errors:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/BUILD.bazel b/vendor/k8s.io/code-generator/cmd/client-gen/generators/BUILD.bazel index cfc1d2999e9b..3d3382a7ac35 100644 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/BUILD.bazel +++ b/vendor/k8s.io/code-generator/cmd/client-gen/generators/BUILD.bazel @@ -8,6 +8,7 @@ go_library( "generator_for_expansion.go", "generator_for_group.go", "generator_for_type.go", + "tags.go", ], importmap = "sigs.k8s.io/cluster-api/vendor/k8s.io/code-generator/cmd/client-gen/generators", importpath = "k8s.io/code-generator/cmd/client-gen/generators", @@ -19,7 +20,6 @@ go_library( "//vendor/k8s.io/code-generator/cmd/client-gen/generators/util:go_default_library", "//vendor/k8s.io/code-generator/cmd/client-gen/path:go_default_library", "//vendor/k8s.io/code-generator/cmd/client-gen/types:go_default_library", - "//vendor/k8s.io/code-generator/pkg/namer:go_default_library", "//vendor/k8s.io/gengo/args:go_default_library", "//vendor/k8s.io/gengo/generator:go_default_library", "//vendor/k8s.io/gengo/namer:go_default_library", diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go index 18980744f01d..ee6ebbcf0937 100644 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go +++ b/vendor/k8s.io/code-generator/cmd/client-gen/generators/client_generator.go @@ -27,7 +27,6 @@ import ( "k8s.io/code-generator/cmd/client-gen/generators/util" "k8s.io/code-generator/cmd/client-gen/path" clientgentypes "k8s.io/code-generator/cmd/client-gen/types" - codegennamer "k8s.io/code-generator/pkg/namer" "k8s.io/gengo/args" "k8s.io/gengo/generator" "k8s.io/gengo/namer" @@ -102,7 +101,7 @@ func NameSystems() namer.NameSystems { "publicPlural": publicPluralNamer, "privatePlural": privatePluralNamer, "allLowercasePlural": lowercaseNamer, - "resource": codegennamer.NewTagOverrideNamer("resourceName", lowercaseNamer), + "resource": NewTagOverrideNamer("resourceName", lowercaseNamer), } } @@ -401,3 +400,27 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat return generator.Packages(packageList) } + +// tagOverrideNamer is a namer which pulls names from a given tag, if specified, +// and otherwise falls back to a different namer. +type tagOverrideNamer struct { + tagName string + fallback namer.Namer +} + +func (n *tagOverrideNamer) Name(t *types.Type) string { + if nameOverride := extractTag(n.tagName, append(t.SecondClosestCommentLines, t.CommentLines...)); nameOverride != "" { + return nameOverride + } + + return n.fallback.Name(t) +} + +// NewTagOverrideNamer creates a namer.Namer which uses the contents of the given tag as +// the name, or falls back to another Namer if the tag is not present. +func NewTagOverrideNamer(tagName string, fallback namer.Namer) namer.Namer { + return &tagOverrideNamer{ + tagName: tagName, + fallback: fallback, + } +} diff --git a/vendor/k8s.io/code-generator/pkg/namer/tag-override.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/tags.go similarity index 50% rename from vendor/k8s.io/code-generator/pkg/namer/tag-override.go rename to vendor/k8s.io/code-generator/cmd/client-gen/generators/tags.go index fd8c3a8553ce..b00408103688 100644 --- a/vendor/k8s.io/code-generator/pkg/namer/tag-override.go +++ b/vendor/k8s.io/code-generator/cmd/client-gen/generators/tags.go @@ -14,38 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package namer +package generators import ( - "k8s.io/gengo/namer" "k8s.io/gengo/types" ) -// TagOverrideNamer is a namer which pulls names from a given tag, if specified, -// and otherwise falls back to a different namer. -type TagOverrideNamer struct { - tagName string - fallback namer.Namer -} - -// Name returns the tag value if it exists. It no tag was found the fallback namer will be used -func (n *TagOverrideNamer) Name(t *types.Type) string { - if nameOverride := extractTag(n.tagName, append(t.SecondClosestCommentLines, t.CommentLines...)); nameOverride != "" { - return nameOverride - } - - return n.fallback.Name(t) -} - -// NewTagOverrideNamer creates a namer.Namer which uses the contents of the given tag as -// the name, or falls back to another Namer if the tag is not present. -func NewTagOverrideNamer(tagName string, fallback namer.Namer) namer.Namer { - return &TagOverrideNamer{ - tagName: tagName, - fallback: fallback, - } -} - // extractTag gets the comment-tags for the key. If the tag did not exist, it // returns the empty string. func extractTag(key string, lines []string) string { diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/BUILD.bazel b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/BUILD.bazel index e57581ed1200..dab0695ef46d 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/BUILD.bazel +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/BUILD.bazel @@ -20,7 +20,6 @@ go_library( "//vendor/k8s.io/code-generator/cmd/client-gen/generators/util:go_default_library", "//vendor/k8s.io/code-generator/cmd/client-gen/types:go_default_library", "//vendor/k8s.io/code-generator/cmd/informer-gen/args:go_default_library", - "//vendor/k8s.io/code-generator/pkg/namer:go_default_library", "//vendor/k8s.io/gengo/args:go_default_library", "//vendor/k8s.io/gengo/generator:go_default_library", "//vendor/k8s.io/gengo/namer:go_default_library", diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go index 5ee918f17ea8..54632de05307 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go @@ -22,7 +22,6 @@ import ( "strings" clientgentypes "k8s.io/code-generator/cmd/client-gen/types" - codegennamer "k8s.io/code-generator/pkg/namer" "k8s.io/gengo/generator" "k8s.io/gengo/namer" "k8s.io/gengo/types" @@ -57,7 +56,6 @@ func (g *genericGenerator) Namers(c *generator.Context) namer.NameSystems { "raw": namer.NewRawNamer(g.outputPackage, g.imports), "allLowercasePlural": namer.NewAllLowercasePluralNamer(pluralExceptions), "publicPlural": namer.NewPublicPluralNamer(pluralExceptions), - "resource": codegennamer.NewTagOverrideNamer("resourceName", namer.NewAllLowercasePluralNamer(pluralExceptions)), } } @@ -170,7 +168,7 @@ func (f *sharedInformerFactory) ForResource(resource {{.schemaGroupVersionResour {{range $version := .Versions -}} // Group={{$group.Name}}, Version={{.Name}} {{range .Resources -}} - case {{index $.schemeGVs $version|raw}}.WithResource("{{.|resource}}"): + case {{index $.schemeGVs $version|raw}}.WithResource("{{.|allLowercasePlural}}"): return &genericInformer{resource: resource.GroupResource(), informer: f.{{$GroupGoName}}().{{$version.GoName}}().{{.|publicPlural}}().Informer()}, nil {{end}} {{end}} diff --git a/vendor/k8s.io/code-generator/pkg/namer/BUILD.bazel b/vendor/k8s.io/code-generator/pkg/namer/BUILD.bazel deleted file mode 100644 index e853a980fb24..000000000000 --- a/vendor/k8s.io/code-generator/pkg/namer/BUILD.bazel +++ /dev/null @@ -1,13 +0,0 @@ -load("@io_bazel_rules_go//go:def.bzl", "go_library") - -go_library( - name = "go_default_library", - srcs = ["tag-override.go"], - importmap = "sigs.k8s.io/cluster-api/vendor/k8s.io/code-generator/pkg/namer", - importpath = "k8s.io/code-generator/pkg/namer", - visibility = ["//visibility:public"], - deps = [ - "//vendor/k8s.io/gengo/namer:go_default_library", - "//vendor/k8s.io/gengo/types:go_default_library", - ], -)