From dc10f10e48bf445d0c510c1fc35e6bd85cd286f5 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Wed, 15 Jun 2016 23:43:13 -0700 Subject: [PATCH] Recreate the opt-in/opt-out logic for deepcopy This is the last piece of Clayton's #26179 to be implemented with file tags. All diffs are accounted for. Followup will use this to streamline some packages. Also add some V(5) debugging - it was helpful in diagnosing various issues, it may be helpful again. --- cmd/libs/go2idl/args/args.go | 5 +- .../deepcopy-gen/generators/deepcopy.go | 165 +++++++++++++++--- .../deepcopy-gen/generators/deepcopy_test.go | 77 ++++++++ .../go2idl/deepcopy-gen/generators/tags.go | 33 ---- cmd/libs/go2idl/deepcopy-gen/main.go | 23 ++- docs/devel/adding-an-APIGroup.md | 4 +- federation/apis/federation/doc.go | 2 +- federation/apis/federation/v1beta1/doc.go | 2 +- pkg/api/doc.go | 2 +- pkg/api/unversioned/doc.go | 2 +- pkg/api/v1/doc.go | 2 +- pkg/apis/apps/doc.go | 2 +- pkg/apis/apps/v1alpha1/doc.go | 2 +- pkg/apis/authentication.k8s.io/doc.go | 2 +- pkg/apis/authentication.k8s.io/v1beta1/doc.go | 2 +- pkg/apis/authorization/doc.go | 2 +- pkg/apis/authorization/v1beta1/doc.go | 2 +- pkg/apis/autoscaling/doc.go | 2 +- pkg/apis/autoscaling/v1/doc.go | 2 +- pkg/apis/batch/doc.go | 2 +- pkg/apis/batch/v1/doc.go | 2 +- pkg/apis/batch/v2alpha1/doc.go | 2 +- pkg/apis/certificates/doc.go | 2 +- pkg/apis/certificates/v1alpha1/doc.go | 2 +- pkg/apis/componentconfig/doc.go | 2 +- pkg/apis/componentconfig/v1alpha1/doc.go | 2 +- pkg/apis/extensions/doc.go | 2 +- pkg/apis/extensions/v1beta1/doc.go | 2 +- pkg/apis/policy/doc.go | 2 +- pkg/apis/policy/v1alpha1/doc.go | 2 +- pkg/apis/rbac/doc.go | 2 +- pkg/apis/rbac/v1alpha1/doc.go | 2 +- pkg/conversion/doc.go | 2 +- pkg/runtime/doc.go | 2 +- 34 files changed, 266 insertions(+), 97 deletions(-) delete mode 100644 cmd/libs/go2idl/deepcopy-gen/generators/tags.go diff --git a/cmd/libs/go2idl/args/args.go b/cmd/libs/go2idl/args/args.go index 58bdf932ee9..a5bee69b434 100644 --- a/cmd/libs/go2idl/args/args.go +++ b/cmd/libs/go2idl/args/args.go @@ -31,6 +31,8 @@ import ( "k8s.io/kubernetes/cmd/libs/go2idl/namer" "k8s.io/kubernetes/cmd/libs/go2idl/parser" "k8s.io/kubernetes/cmd/libs/go2idl/types" + "k8s.io/kubernetes/pkg/util" + utilflag "k8s.io/kubernetes/pkg/util/flag" "github.com/spf13/pflag" ) @@ -147,7 +149,8 @@ func DefaultSourceTree() string { // If you don't need any non-default behavior, use as: // args.Default().Execute(...) func (g *GeneratorArgs) Execute(nameSystems namer.NameSystems, defaultSystem string, pkgs func(*generator.Context, *GeneratorArgs) generator.Packages) error { - pflag.Parse() + utilflag.InitFlags() + util.InitLogs() b, err := g.NewBuilder() if err != nil { diff --git a/cmd/libs/go2idl/deepcopy-gen/generators/deepcopy.go b/cmd/libs/go2idl/deepcopy-gen/generators/deepcopy.go index d28396c0c35..5c34d18177e 100644 --- a/cmd/libs/go2idl/deepcopy-gen/generators/deepcopy.go +++ b/cmd/libs/go2idl/deepcopy-gen/generators/deepcopy.go @@ -37,6 +37,59 @@ type CustomArgs struct { BoundingDirs []string // Only deal with types rooted under these dirs. } +// This is the comment tag that carries parameters for deep-copy generation. +const tagName = "k8s:deepcopy-gen" + +// Known values for the comment tag. +const tagValuePackage = "package" + +// tagValue holds parameters from a tagName tag. +type tagValue struct { + value string + register bool +} + +func extractTag(comments []string) *tagValue { + tagVals := types.ExtractCommentTags("+", comments)[tagName] + if tagVals == nil { + // No match for the tag. + return nil + } + // If there are multiple values, abort. + if len(tagVals) > 1 { + glog.Fatalf("Found %d %s tags: %q", len(tagVals), tagName, tagVals) + } + + // If we got here we are returning something. + tag := &tagValue{} + + // Get the primary value. + parts := strings.Split(tagVals[0], ",") + if len(parts) >= 1 { + tag.value = parts[0] + } + + // Parse extra arguments. + parts = parts[1:] + for i := range parts { + kv := strings.SplitN(parts[i], "=", 2) + k := kv[0] + v := "" + if len(kv) == 2 { + v = kv[1] + } + switch k { + case "register": + if v != "false" { + tag.register = true + } + default: + glog.Fatalf("Unsupported %s param: %q", tagName, parts[i]) + } + } + return tag +} + // TODO: This is created only to reduce number of changes in a single PR. // Remove it and use PublicNamer instead. func deepCopyNamer() *namer.NameStrategy { @@ -86,38 +139,61 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat } } - for _, p := range context.Universe { - // Short-circuit if this package has not opted in. - if tagvals := types.ExtractCommentTags("+", p.Comments)["k8s:deepcopy-gen"]; tagvals == nil { - // No tag for this package. - continue - } else if tagvals[0] != "generate" && tagvals[0] != "register" { - // Unknown tag. - glog.Errorf("Uknown tag value '+k8s:deepcopy-gen=%s'", tagvals[0]) + for i := range inputs { + glog.V(5).Infof("considering pkg %q", i) + pkg := context.Universe[i] + if pkg == nil { + // If the input had no Go files, for example. continue } - needsGeneration := false - for _, t := range p.Types { - if copyableWithinPackage(t, boundingDirs) && inputs.Has(t.Name.Package) { - needsGeneration = true - break + + ptag := extractTag(pkg.Comments) + ptagValue := "" + ptagRegister := false + if ptag != nil { + ptagValue = ptag.value + if ptagValue != tagValuePackage { + glog.Fatalf("Package %v: unsupported %s value: %q", i, tagName, ptagValue) + } + ptagRegister = ptag.register + glog.V(5).Infof(" tag.value: %q, tag.register: %t", ptagValue, ptagRegister) + } else { + glog.V(5).Infof(" no tag") + } + + // If the pkg-scoped tag says to generate, we can skip scanning types. + pkgNeedsGeneration := (ptagValue == tagValuePackage) + if !pkgNeedsGeneration { + // If the pkg-scoped tag did not exist, scan all types for one that + // explicitly wants generation. + for _, t := range pkg.Types { + glog.V(5).Infof(" considering type %q", t.Name.String()) + ttag := extractTag(t.CommentLines) + if ttag != nil && ttag.value == "true" { + glog.V(5).Infof(" tag=true") + if !copyableWithinPackage(t, boundingDirs) { + glog.Fatalf("Type %v requests deepcopy generation but is not copyable", t) + } + pkgNeedsGeneration = true + break + } } } - if needsGeneration { - path := p.Path + + if pkgNeedsGeneration { packages = append(packages, &generator.DefaultPackage{ - PackageName: strings.Split(filepath.Base(path), ".")[0], - PackagePath: path, + PackageName: strings.Split(filepath.Base(pkg.Path), ".")[0], + PackagePath: pkg.Path, HeaderText: header, GeneratorFunc: func(c *generator.Context) (generators []generator.Generator) { generators = []generator.Generator{} generators = append( - generators, NewGenDeepCopy(arguments.OutputFileBaseName, path, boundingDirs)) + generators, NewGenDeepCopy(arguments.OutputFileBaseName, pkg.Path, boundingDirs, (ptagValue == tagValuePackage), ptagRegister)) return generators }, FilterFunc: func(c *generator.Context, t *types.Type) bool { - return t.Name.Package == path + return t.Name.Package == pkg.Path }, }) } @@ -135,19 +211,23 @@ type genDeepCopy struct { generator.DefaultGen targetPackage string boundingDirs []string + allTypes bool + registerTypes bool imports namer.ImportTracker typesForInit []*types.Type globalVariables map[string]interface{} } -func NewGenDeepCopy(sanitizedName, targetPackage string, boundingDirs []string) generator.Generator { +func NewGenDeepCopy(sanitizedName, targetPackage string, boundingDirs []string, allTypes, registerTypes bool) generator.Generator { return &genDeepCopy{ DefaultGen: generator.DefaultGen{ OptionalName: sanitizedName, }, targetPackage: targetPackage, boundingDirs: boundingDirs, + allTypes: allTypes, + registerTypes: registerTypes, imports: generator.NewImportTracker(), typesForInit: make([]*types.Type, 0), } @@ -159,8 +239,15 @@ func (g *genDeepCopy) Namers(c *generator.Context) namer.NameSystems { } func (g *genDeepCopy) Filter(c *generator.Context, t *types.Type) bool { - // Filter out all types not copyable within the package. - copyable := g.copyableWithinPackage(t) + // Filter out types not being processed or not copyable within the package. + enabled := g.allTypes + if !enabled { + ttag := extractTag(t.CommentLines) + if ttag != nil && ttag.value == "true" { + enabled = true + } + } + copyable := enabled && g.copyableWithinPackage(t) if copyable { g.typesForInit = append(g.typesForInit, t) } @@ -208,7 +295,8 @@ func isRootedUnder(pkg string, roots []string) bool { func copyableWithinPackage(t *types.Type, boundingDirs []string) bool { // If the type opts out of copy-generation, stop. - if extractBoolTagOrDie("k8s:deepcopy-gen", true, t.CommentLines) == false { + ttag := extractTag(t.CommentLines) + if ttag != nil && ttag.value == "false" { return false } // Only packages within the restricted range can be processed. @@ -276,12 +364,14 @@ func (g *genDeepCopy) Init(c *generator.Context, w io.Writer) error { g.globalVariables = map[string]interface{}{ "Cloner": cloner, } - if tagvals := types.ExtractCommentTags("+", c.Universe[g.targetPackage].Comments)["k8s:deepcopy-gen"]; tagvals != nil && tagvals[0] != "register" { + if !g.registerTypes { // TODO: We should come up with a solution to register all generated // deep-copy functions. However, for now, to avoid import cycles // we register only those explicitly requested. return nil } + glog.V(5).Infof("registering types in pkg %q", g.targetPackage) + scheme := c.Universe.Variable(types.Name{Package: apiPackagePath, Name: "Scheme"}) g.imports.AddType(scheme) g.globalVariables["scheme"] = scheme @@ -302,7 +392,34 @@ func (g *genDeepCopy) Init(c *generator.Context, w io.Writer) error { return sw.Error() } +func (g *genDeepCopy) needsGeneration(t *types.Type) bool { + tag := extractTag(t.CommentLines) + tv := "" + if tag != nil { + tv = tag.value + if tv != "true" && tv != "false" { + glog.Fatalf("Type %v: unsupported %s value: %q", t, tagName, tag.value) + } + } + if g.allTypes && tv == "false" { + // The whole package is being generated, but this type has opted out. + glog.V(5).Infof("not generating for type %v because type opted out", t) + return false + } + if !g.allTypes && tv != "true" { + // The whole package is NOT being generated, and this type has NOT opted in. + glog.V(5).Infof("not generating for type %v because type did not opt in", t) + return false + } + return true +} + func (g *genDeepCopy) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error { + if !g.needsGeneration(t) { + return nil + } + glog.V(5).Infof("generating for type %v", t) + sw := generator.NewSnippetWriter(w, c, "$", "$") funcName := g.funcNameTmpl(t) sw.Do(fmt.Sprintf("func %s(in $.type|raw$, out *$.type|raw$, c *$.Cloner|raw$) error {\n", funcName), g.withGlobals(argsFromType(t))) diff --git a/cmd/libs/go2idl/deepcopy-gen/generators/deepcopy_test.go b/cmd/libs/go2idl/deepcopy-gen/generators/deepcopy_test.go index f6d33837e1b..cafab0db656 100644 --- a/cmd/libs/go2idl/deepcopy-gen/generators/deepcopy_test.go +++ b/cmd/libs/go2idl/deepcopy-gen/generators/deepcopy_test.go @@ -265,3 +265,80 @@ func Test_hasDeepCopyMethod(t *testing.T) { } } } + +func Test_extractTagParams(t *testing.T) { + testCases := []struct { + comments []string + expect *tagValue + }{ + { + comments: []string{ + "Human comment", + }, + expect: nil, + }, + { + comments: []string{ + "Human comment", + "+k8s:deepcopy-gen", + }, + expect: &tagValue{ + value: "", + register: false, + }, + }, + { + comments: []string{ + "Human comment", + "+k8s:deepcopy-gen=package", + }, + expect: &tagValue{ + value: "package", + register: false, + }, + }, + { + comments: []string{ + "Human comment", + "+k8s:deepcopy-gen=package,register", + }, + expect: &tagValue{ + value: "package", + register: true, + }, + }, + { + comments: []string{ + "Human comment", + "+k8s:deepcopy-gen=package,register=true", + }, + expect: &tagValue{ + value: "package", + register: true, + }, + }, + { + comments: []string{ + "Human comment", + "+k8s:deepcopy-gen=package,register=false", + }, + expect: &tagValue{ + value: "package", + register: false, + }, + }, + } + + for i, tc := range testCases { + r := extractTag(tc.comments) + if r == nil && tc.expect != nil { + t.Errorf("case[%d]: expected non-nil", i) + } + if r != nil && tc.expect == nil { + t.Errorf("case[%d]: expected nil, got %v", i, *r) + } + if r != nil && *r != *tc.expect { + t.Errorf("case[%d]: expected %v, got %v", i, *tc.expect, *r) + } + } +} diff --git a/cmd/libs/go2idl/deepcopy-gen/generators/tags.go b/cmd/libs/go2idl/deepcopy-gen/generators/tags.go deleted file mode 100644 index 032c501e3de..00000000000 --- a/cmd/libs/go2idl/deepcopy-gen/generators/tags.go +++ /dev/null @@ -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 ( - "github.com/golang/glog" - "k8s.io/kubernetes/cmd/libs/go2idl/types" -) - -// 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 -// defaultVal. -func extractBoolTagOrDie(key string, defaultVal bool, lines []string) bool { - val, err := types.ExtractSingleBoolCommentTag("+", key, defaultVal, lines) - if err != nil { - glog.Fatalf(err.Error()) - } - return val -} diff --git a/cmd/libs/go2idl/deepcopy-gen/main.go b/cmd/libs/go2idl/deepcopy-gen/main.go index dd584ce811b..39927b8a655 100644 --- a/cmd/libs/go2idl/deepcopy-gen/main.go +++ b/cmd/libs/go2idl/deepcopy-gen/main.go @@ -28,18 +28,23 @@ limitations under the License. // Generation is governed by comment tags in the source. Any package may // request DeepCopy generation by including a comment in the file-comments of // one file, of the form: -// // +k8s:deepcopy-gen=generate -// or: -// // +k8s:deepcopy-gen=register +// // +k8s:deepcopy-gen=package // -// Packages which specify `=generate` will have DeepCopy functions generated -// into them. Packages which specify `=register` will have DeepCopy functions -// generated and registered with in `init()` function call to -// `Scheme.AddGeneratedDeepCopyFuncs()`. +// Packages can request that the generated DeepCopy functions be registered +// with an `init()` function call to `Scheme.AddGeneratedDeepCopyFuncs()` by +// changing the tag to: +// // +k8s:deepcopy-gen=package,register // -// Individual types may opt out of DeepCopy generation by specifying a comment -// of the form: +// DeepCopy functions can be generated for individual types, rather than the +// entire package by specifying a comment on the type definion of the form: +// // +k8s:deepcopy-gen=true +// +// When generating for a whole package, individual types may opt out of +// DeepCopy generation by specifying a comment on the of the form: // // +k8s:deepcopy-gen=false +// +// Note that registration is a whole-package option, and is not available for +// individual types. package main import ( diff --git a/docs/devel/adding-an-APIGroup.md b/docs/devel/adding-an-APIGroup.md index 6026cc2e45d..63c4e2a2d69 100644 --- a/docs/devel/adding-an-APIGroup.md +++ b/docs/devel/adding-an-APIGroup.md @@ -77,8 +77,8 @@ cmd/libs/go2idl/ tool. 1. Add your "group/" or "group/version" into cmd/libs/go2idl/conversion-gen/main.go; 2. Make sure your pkg/apis/``/`` directory has a doc.go file - with the comment `// +k8s:deepcopy-gen=register`, to catch the attention - of our generation tools. + with the comment `// +k8s:deepcopy-gen=package,register`, to catch the + attention of our generation tools. 3. Make sure your pkg/apis/``/`` directory has a doc.go file with the comment `// +genconversion=true`, to catch the attention of our gen-conversion script. diff --git a/federation/apis/federation/doc.go b/federation/apis/federation/doc.go index d3eb70de2df..7a45fb7bb8c 100644 --- a/federation/apis/federation/doc.go +++ b/federation/apis/federation/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register package federation diff --git a/federation/apis/federation/v1beta1/doc.go b/federation/apis/federation/v1beta1/doc.go index 0dc068a3494..8eebd4e8795 100644 --- a/federation/apis/federation/v1beta1/doc.go +++ b/federation/apis/federation/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v1beta1 diff --git a/pkg/api/doc.go b/pkg/api/doc.go index 23fea0579da..1507a8823b4 100644 --- a/pkg/api/doc.go +++ b/pkg/api/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // Package api contains the latest (or "internal") version of the // Kubernetes API objects. This is the API objects as represented in memory. diff --git a/pkg/api/unversioned/doc.go b/pkg/api/unversioned/doc.go index e18a6675fd2..d0ffc33275f 100644 --- a/pkg/api/unversioned/doc.go +++ b/pkg/api/unversioned/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=generate +// +k8s:deepcopy-gen=package package unversioned diff --git a/pkg/api/v1/doc.go b/pkg/api/v1/doc.go index b9c15641bce..0d81e264a06 100644 --- a/pkg/api/v1/doc.go +++ b/pkg/api/v1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // Package v1 is the v1 version of the API. // +genconversion=true diff --git a/pkg/apis/apps/doc.go b/pkg/apis/apps/doc.go index 9943700e451..bca1ff4ef01 100644 --- a/pkg/apis/apps/doc.go +++ b/pkg/apis/apps/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register package apps diff --git a/pkg/apis/apps/v1alpha1/doc.go b/pkg/apis/apps/v1alpha1/doc.go index 06dafc4f96b..97c790d9da3 100644 --- a/pkg/apis/apps/v1alpha1/doc.go +++ b/pkg/apis/apps/v1alpha1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v1alpha1 diff --git a/pkg/apis/authentication.k8s.io/doc.go b/pkg/apis/authentication.k8s.io/doc.go index 084447ac6fe..66c5ae720c0 100644 --- a/pkg/apis/authentication.k8s.io/doc.go +++ b/pkg/apis/authentication.k8s.io/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register package authentication diff --git a/pkg/apis/authentication.k8s.io/v1beta1/doc.go b/pkg/apis/authentication.k8s.io/v1beta1/doc.go index 0dc068a3494..8eebd4e8795 100644 --- a/pkg/apis/authentication.k8s.io/v1beta1/doc.go +++ b/pkg/apis/authentication.k8s.io/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v1beta1 diff --git a/pkg/apis/authorization/doc.go b/pkg/apis/authorization/doc.go index 47877fadc02..9660e5eacf9 100644 --- a/pkg/apis/authorization/doc.go +++ b/pkg/apis/authorization/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register package authorization diff --git a/pkg/apis/authorization/v1beta1/doc.go b/pkg/apis/authorization/v1beta1/doc.go index 0dc068a3494..8eebd4e8795 100644 --- a/pkg/apis/authorization/v1beta1/doc.go +++ b/pkg/apis/authorization/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v1beta1 diff --git a/pkg/apis/autoscaling/doc.go b/pkg/apis/autoscaling/doc.go index 601be4361c9..2c770186ba7 100644 --- a/pkg/apis/autoscaling/doc.go +++ b/pkg/apis/autoscaling/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register package autoscaling diff --git a/pkg/apis/autoscaling/v1/doc.go b/pkg/apis/autoscaling/v1/doc.go index d41a7fb76f7..0dc08faf0a7 100644 --- a/pkg/apis/autoscaling/v1/doc.go +++ b/pkg/apis/autoscaling/v1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v1 diff --git a/pkg/apis/batch/doc.go b/pkg/apis/batch/doc.go index bac88a93b16..c6b203cd8eb 100644 --- a/pkg/apis/batch/doc.go +++ b/pkg/apis/batch/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register package batch diff --git a/pkg/apis/batch/v1/doc.go b/pkg/apis/batch/v1/doc.go index d41a7fb76f7..0dc08faf0a7 100644 --- a/pkg/apis/batch/v1/doc.go +++ b/pkg/apis/batch/v1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v1 diff --git a/pkg/apis/batch/v2alpha1/doc.go b/pkg/apis/batch/v2alpha1/doc.go index 7a5c3bce461..c7cf93b9f98 100644 --- a/pkg/apis/batch/v2alpha1/doc.go +++ b/pkg/apis/batch/v2alpha1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v2alpha1 diff --git a/pkg/apis/certificates/doc.go b/pkg/apis/certificates/doc.go index f045cee7da8..d2897cb87d7 100644 --- a/pkg/apis/certificates/doc.go +++ b/pkg/apis/certificates/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register package certificates diff --git a/pkg/apis/certificates/v1alpha1/doc.go b/pkg/apis/certificates/v1alpha1/doc.go index 06dafc4f96b..97c790d9da3 100644 --- a/pkg/apis/certificates/v1alpha1/doc.go +++ b/pkg/apis/certificates/v1alpha1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v1alpha1 diff --git a/pkg/apis/componentconfig/doc.go b/pkg/apis/componentconfig/doc.go index bdbbbbd5ddf..d044b16db39 100644 --- a/pkg/apis/componentconfig/doc.go +++ b/pkg/apis/componentconfig/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register package componentconfig diff --git a/pkg/apis/componentconfig/v1alpha1/doc.go b/pkg/apis/componentconfig/v1alpha1/doc.go index 06dafc4f96b..97c790d9da3 100644 --- a/pkg/apis/componentconfig/v1alpha1/doc.go +++ b/pkg/apis/componentconfig/v1alpha1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v1alpha1 diff --git a/pkg/apis/extensions/doc.go b/pkg/apis/extensions/doc.go index e2d73e9daf9..2bbb71d0571 100644 --- a/pkg/apis/extensions/doc.go +++ b/pkg/apis/extensions/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register package extensions diff --git a/pkg/apis/extensions/v1beta1/doc.go b/pkg/apis/extensions/v1beta1/doc.go index 0dc068a3494..8eebd4e8795 100644 --- a/pkg/apis/extensions/v1beta1/doc.go +++ b/pkg/apis/extensions/v1beta1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v1beta1 diff --git a/pkg/apis/policy/doc.go b/pkg/apis/policy/doc.go index e7584c0fc2a..876858cd9a7 100644 --- a/pkg/apis/policy/doc.go +++ b/pkg/apis/policy/doc.go @@ -14,6 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register package policy diff --git a/pkg/apis/policy/v1alpha1/doc.go b/pkg/apis/policy/v1alpha1/doc.go index f4ed6878b30..37d78e29170 100644 --- a/pkg/apis/policy/v1alpha1/doc.go +++ b/pkg/apis/policy/v1alpha1/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // Package policy is for any kind of policy object. Suitable examples, even if // they aren't all here, are PodDisruptionBudget, PodSecurityPolicy, diff --git a/pkg/apis/rbac/doc.go b/pkg/apis/rbac/doc.go index 6836fde7b1b..e4ce69b40b9 100644 --- a/pkg/apis/rbac/doc.go +++ b/pkg/apis/rbac/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +groupName=rbac.authorization.k8s.io package rbac diff --git a/pkg/apis/rbac/v1alpha1/doc.go b/pkg/apis/rbac/v1alpha1/doc.go index 9446f85afe2..35aef40894f 100644 --- a/pkg/apis/rbac/v1alpha1/doc.go +++ b/pkg/apis/rbac/v1alpha1/doc.go @@ -15,7 +15,7 @@ limitations under the License. */ // +groupName=rbac.authorization.k8s.io -// +k8s:deepcopy-gen=register +// +k8s:deepcopy-gen=package,register // +genconversion=true package v1alpha1 diff --git a/pkg/conversion/doc.go b/pkg/conversion/doc.go index c3866ff46a2..6aadeef7de8 100644 --- a/pkg/conversion/doc.go +++ b/pkg/conversion/doc.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// +k8s:deepcopy-gen=generate +// +k8s:deepcopy-gen=package // Package conversion provides go object versioning. // diff --git a/pkg/runtime/doc.go b/pkg/runtime/doc.go index 120cd6d90db..89425b8a7d5 100644 --- a/pkg/runtime/doc.go +++ b/pkg/runtime/doc.go @@ -42,6 +42,6 @@ limitations under the License. // As a bonus, a few common types useful from all api objects and versions // are provided in types.go. -// +k8s:deepcopy-gen=generate +// +k8s:deepcopy-gen=package package runtime