Commit 42805f53 authored by k8s-merge-robot's avatar k8s-merge-robot Committed by GitHub

Merge pull request #28578 from thockin/dont-checkin-generated-code-prep-1

Automatic merge from submit-queue Prep for not checking in generated, part 1/2 This PR is extracted from #25978 - it is just the deep-copy related parts. All the Makefile and conversion stuff is excluded. @wojtek-t this is literally branched, a bunch of commits deleted, and a very small number of manual fixups applied. If you think this is easier to review (and if it passes CI) you can feel free to go over it again. I will follow this with a conversion-related PR to build on this. Or if you prefer, just close this and let the mega-PR ride. @lavalamp
parents 1c898516 82b2d2c8
......@@ -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"
)
......@@ -52,15 +54,15 @@ type GeneratorArgs struct {
// Which directories to parse.
InputDirs []string
// If true, recurse into all children of InputDirs
Recursive bool
// Source tree to write results to.
OutputBase string
// Package path within the source tree.
OutputPackagePath string
// Output file name.
OutputFileBaseName string
// Where to get copyright header text.
GoHeaderFilePath string
......@@ -81,9 +83,9 @@ func (g *GeneratorArgs) AddFlags(fs *pflag.FlagSet) {
fs.StringSliceVarP(&g.InputDirs, "input-dirs", "i", g.InputDirs, "Comma-separated list of import paths to get input types from.")
fs.StringVarP(&g.OutputBase, "output-base", "o", g.OutputBase, "Output base; defaults to $GOPATH/src/ or ./ if $GOPATH is not set.")
fs.StringVarP(&g.OutputPackagePath, "output-package", "p", g.OutputPackagePath, "Base package path.")
fs.StringVarP(&g.OutputFileBaseName, "output-file-base", "O", g.OutputFileBaseName, "Base name (without .go suffix) for output files.")
fs.StringVarP(&g.GoHeaderFilePath, "go-header-file", "h", g.GoHeaderFilePath, "File containing boilerplate header text. The string YEAR will be replaced with the current 4-digit year.")
fs.BoolVar(&g.VerifyOnly, "verify-only", g.VerifyOnly, "If true, only verify existing output, do not write anything.")
fs.BoolVar(&g.Recursive, "recursive", g.VerifyOnly, "If true, recurse into all children of input directories.")
fs.StringVar(&g.GeneratedBuildTag, "build-tag", g.GeneratedBuildTag, "A Go build tag to use to identify files generated by this command. Should be unique.")
}
......@@ -105,15 +107,14 @@ func (g *GeneratorArgs) NewBuilder() (*parser.Builder, error) {
b.AddBuildTags(g.GeneratedBuildTag)
for _, d := range g.InputDirs {
d = strings.TrimLeft(d, "+-*")
if g.Recursive {
if err := b.AddDirRecursive(d); err != nil {
return nil, fmt.Errorf("unable to add directory %q: %v", d, err)
}
var err error
if strings.HasSuffix(d, "/...") {
err = b.AddDirRecursive(strings.TrimSuffix(d, "/..."))
} else {
if err := b.AddDir(d); err != nil {
return nil, fmt.Errorf("unable to add directory %q: %v", d, err)
}
err = b.AddDir(d)
}
if err != nil {
return nil, fmt.Errorf("unable to add directory %q: %v", d, err)
}
}
return b, nil
......@@ -144,7 +145,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 {
......
......@@ -120,7 +120,7 @@ func packageForGroup(gv unversioned.GroupVersion, typeList []*types.Type, packag
return generators
},
FilterFunc: func(c *generator.Context, t *types.Type) bool {
return types.ExtractCommentTags("+", t.SecondClosestCommentLines)["genclient"] == "true"
return extractBoolTagOrDie("genclient", t.SecondClosestCommentLines) == true
},
}
}
......@@ -190,7 +190,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
} else {
// User has not specified any override for this group version.
// filter out types which dont have genclient=true.
if types.ExtractCommentTags("+", t.SecondClosestCommentLines)["genclient"] != "true" {
if extractBoolTagOrDie("genclient", t.SecondClosestCommentLines) == false {
continue
}
}
......
......@@ -20,6 +20,8 @@ import (
"path/filepath"
"strings"
"github.com/golang/glog"
clientgenargs "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/args"
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/normalization"
"k8s.io/kubernetes/cmd/libs/go2idl/generator"
......@@ -75,11 +77,19 @@ func PackageForGroup(gv unversioned.GroupVersion, typeList []*types.Type, packag
return generators
},
FilterFunc: func(c *generator.Context, t *types.Type) bool {
return types.ExtractCommentTags("+", t.SecondClosestCommentLines)["genclient"] == "true"
return extractBoolTagOrDie("genclient", t.SecondClosestCommentLines) == true
},
}
}
func extractBoolTagOrDie(key string, lines []string) bool {
val, err := types.ExtractSingleBoolCommentTag("+", key, false, lines)
if err != nil {
glog.Fatalf(err.Error())
}
return val
}
func PackageForClientset(customArgs clientgenargs.Args, typedClientBasePath string, boilerplate []byte, generatedBy string) generator.Package {
return &generator.DefaultPackage{
// TODO: we'll generate fake clientset for different release in the future.
......
......@@ -72,7 +72,7 @@ func (g *genFakeForGroup) GenerateType(c *generator.Context, t *types.Type, w io
"Group": namer.IC(g.group),
"realClientPackage": filepath.Base(g.realClientPath),
}
namespaced := !(types.ExtractCommentTags("+", t.SecondClosestCommentLines)["nonNamespaced"] == "true")
namespaced := !extractBoolTagOrDie("nonNamespaced", t.SecondClosestCommentLines)
if namespaced {
sw.Do(getterImplNamespaced, wrapper)
} else {
......
......@@ -79,7 +79,7 @@ func (g *genFakeForType) GenerateType(c *generator.Context, t *types.Type, w io.
sw := generator.NewSnippetWriter(w, c, "$", "$")
pkg := filepath.Base(t.Name.Package)
const pkgTestingCore = "k8s.io/kubernetes/pkg/client/testing/core"
namespaced := !(types.ExtractCommentTags("+", t.SecondClosestCommentLines)["nonNamespaced"] == "true")
namespaced := !extractBoolTagOrDie("nonNamespaced", t.SecondClosestCommentLines)
canonicalGroup := g.group
if canonicalGroup == "core" {
canonicalGroup = ""
......@@ -95,11 +95,9 @@ func (g *genFakeForType) GenerateType(c *generator.Context, t *types.Type, w io.
}
// allow user to define a group name that's different from the one parsed from the directory.
for _, comment := range c.Universe.Package(g.inputPackage).DocComments {
comment = strings.TrimLeft(comment, "//")
if override, ok := types.ExtractCommentTags("+", comment)["groupName"]; ok {
groupName = override
}
p := c.Universe.Package(g.inputPackage)
if override := types.ExtractCommentTags("+", p.DocComments)["groupName"]; override != nil {
groupName = override[0]
}
m := map[string]interface{}{
......@@ -138,7 +136,7 @@ func (g *genFakeForType) GenerateType(c *generator.Context, t *types.Type, w io.
"NewPatchAction": c.Universe.Function(types.Name{Package: pkgTestingCore, Name: "NewPatchAction"}),
}
noMethods := types.ExtractCommentTags("+", t.SecondClosestCommentLines)["noMethods"] == "true"
noMethods := extractBoolTagOrDie("noMethods", t.SecondClosestCommentLines) == true
if namespaced {
sw.Do(structNamespaced, m)
......
......@@ -18,7 +18,6 @@ package generators
import (
"io"
"strings"
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/normalization"
"k8s.io/kubernetes/cmd/libs/go2idl/generator"
......@@ -74,11 +73,9 @@ func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer
groupName = ""
}
// allow user to define a group name that's different from the one parsed from the directory.
for _, comment := range c.Universe.Package(g.inputPacakge).DocComments {
comment = strings.TrimLeft(comment, "//")
if override, ok := types.ExtractCommentTags("+", comment)["groupName"]; ok && override != "" {
groupName = override
}
p := c.Universe.Package(g.inputPacakge)
if override := types.ExtractCommentTags("+", p.DocComments)["groupName"]; override != nil {
groupName = override[0]
}
m := map[string]interface{}{
......@@ -104,7 +101,7 @@ func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer
"type": t,
"Group": namer.IC(normalization.BeforeFirstDot(g.group)),
}
namespaced := !(types.ExtractCommentTags("+", t.SecondClosestCommentLines)["nonNamespaced"] == "true")
namespaced := !extractBoolTagOrDie("nonNamespaced", t.SecondClosestCommentLines)
if namespaced {
sw.Do(getterImplNamespaced, wrapper)
} else {
......
......@@ -66,7 +66,7 @@ func hasStatus(t *types.Type) bool {
func (g *genClientForType) GenerateType(c *generator.Context, t *types.Type, w io.Writer) error {
sw := generator.NewSnippetWriter(w, c, "$", "$")
pkg := filepath.Base(t.Name.Package)
namespaced := !(types.ExtractCommentTags("+", t.SecondClosestCommentLines)["nonNamespaced"] == "true")
namespaced := !extractBoolTagOrDie("nonNamespaced", t.SecondClosestCommentLines)
m := map[string]interface{}{
"type": t,
"package": pkg,
......@@ -86,7 +86,7 @@ func (g *genClientForType) GenerateType(c *generator.Context, t *types.Type, w i
} else {
sw.Do(getterNonNamesapced, m)
}
noMethods := types.ExtractCommentTags("+", t.SecondClosestCommentLines)["noMethods"] == "true"
noMethods := extractBoolTagOrDie("noMethods", t.SecondClosestCommentLines) == true
sw.Do(interfaceTemplate1, m)
if !noMethods {
......
......@@ -14,19 +14,20 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package resource
package generators
import (
inf "gopkg.in/inf.v0"
conversion "k8s.io/kubernetes/pkg/conversion"
"github.com/golang/glog"
"k8s.io/kubernetes/cmd/libs/go2idl/types"
)
func DeepCopy_resource_Quantity(in Quantity, out *Quantity, c *conversion.Cloner) error {
*out = in
if in.d.Dec != nil {
tmp := &inf.Dec{}
out.d.Dec = tmp.Set(in.d.Dec)
// 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 {
glog.Fatalf(err.Error())
}
return nil
return val
}
......@@ -232,11 +232,8 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
// Only generate conversions for package which explicitly requested it
// byt setting "+genversion=true" in their doc.go file.
filtered := false
for _, comment := range p.DocComments {
comment := strings.Trim(comment, "//")
if types.ExtractCommentTags("+", comment)["genconversion"] == "true" {
filtered = true
}
if extractBoolTagOrDie("genconversion", false, p.DocComments) == true {
filtered = true
}
if !filtered {
continue
......@@ -345,7 +342,7 @@ func isDirectlyConvertible(in, out *types.Type, preexisting conversions) bool {
// "+ genconversion=false"
// comment to ignore this field for conversion.
// TODO: Switch to SecondClosestCommentLines.
if types.ExtractCommentTags("+", inMember.CommentLines)["genconversion"] == "false" {
if extractBoolTagOrDie("genconversion", true, inMember.CommentLines) == false {
continue
}
return false
......@@ -431,7 +428,7 @@ func (g *genConversion) convertibleOnlyWithinPackage(inType, outType *types.Type
if t.Name.Package != g.targetPackage {
return false
}
if types.ExtractCommentTags("+", t.CommentLines)["genconversion"] == "false" {
if extractBoolTagOrDie("genconversion", true, t.CommentLines) == false {
return false
}
// TODO: Consider generating functions for other kinds too.
......@@ -613,9 +610,9 @@ func (g *genConversion) doBuiltin(inType, outType *types.Type, sw *generator.Sni
func (g *genConversion) doMap(inType, outType *types.Type, sw *generator.SnippetWriter) {
sw.Do("*out = make($.|raw$, len(*in))\n", outType)
if outType.Key.IsAssignable() {
if isDirectlyAssignable(inType.Key, outType.Key) {
sw.Do("for key, val := range *in {\n", nil)
if outType.Elem.IsAssignable() {
if isDirectlyAssignable(inType.Elem, outType.Elem) {
if inType.Key == outType.Key {
sw.Do("(*out)[key] = ", nil)
} else {
......@@ -659,7 +656,7 @@ func (g *genConversion) doSlice(inType, outType *types.Type, sw *generator.Snipp
sw.Do("copy(*out, *in)\n", nil)
} else {
sw.Do("for i := range *in {\n", nil)
if outType.Elem.IsAssignable() {
if isDirectlyAssignable(inType.Elem, outType.Elem) {
if inType.Elem == outType.Elem {
sw.Do("(*out)[i] = (*in)[i]\n", nil)
} else {
......@@ -750,7 +747,7 @@ func (g *genConversion) doStruct(inType, outType *types.Type, sw *generator.Snip
sw.Do("return err\n", nil)
sw.Do("}\n", nil)
case types.Alias:
if outT.IsAssignable() {
if isDirectlyAssignable(t, outT) {
if t == outT {
sw.Do("out.$.name$ = in.$.name$\n", args)
} else {
......@@ -787,7 +784,7 @@ func (g *genConversion) isDirectlyAssignable(inType, outType *types.Type) bool {
func (g *genConversion) doPointer(inType, outType *types.Type, sw *generator.SnippetWriter) {
sw.Do("*out = new($.Elem|raw$)\n", outType)
if outType.Elem.IsAssignable() {
if isDirectlyAssignable(inType.Elem, outType.Elem) {
if inType.Elem == outType.Elem {
sw.Do("**out = **in\n", nil)
} else {
......@@ -816,3 +813,14 @@ func (g *genConversion) doAlias(inType, outType *types.Type, sw *generator.Snipp
func (g *genConversion) doUnknown(inType, outType *types.Type, sw *generator.SnippetWriter) {
sw.Do("// FIXME: Type $.|raw$ is unsupported.\n", inType)
}
func isDirectlyAssignable(inType, outType *types.Type) bool {
// TODO: This should maybe check for actual assignability between the two
// types, rather than superficial traits that happen to indicate it is
// assignable in the ways we currently use this code.
return inType.IsAssignable() && (inType.IsPrimitive() || isSamePackage(inType, outType))
}
func isSamePackage(inType, outType *types.Type) bool {
return inType.Name.Package == outType.Name.Package
}
/*
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
}
/*
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 (
"testing"
"k8s.io/kubernetes/cmd/libs/go2idl/types"
)
func Test_isRootedUnder(t *testing.T) {
testCases := []struct {
path string
roots []string
expect bool
}{
{
path: "/foo/bar",
roots: nil,
expect: false,
},
{
path: "/foo/bar",
roots: []string{},
expect: false,
},
{
path: "/foo/bar",
roots: []string{
"/bad",
},
expect: false,
},
{
path: "/foo/bar",
roots: []string{
"/foo",
},
expect: true,
},
{
path: "/foo/bar",
roots: []string{
"/bad",
"/foo",
},
expect: true,
},
{
path: "/foo/bar/qux/zorb",
roots: []string{
"/foo/bar/qux",
},
expect: true,
},
{
path: "/foo/bar",
roots: []string{
"/foo/bar",
},
expect: true,
},
{
path: "/foo/barn",
roots: []string{
"/foo/bar",
},
expect: false,
},
{
path: "/foo/bar",
roots: []string{
"/foo/barn",
},
expect: false,
},
{
path: "/foo/bar",
roots: []string{
"",
},
expect: true,
},
}
for i, tc := range testCases {
r := isRootedUnder(tc.path, tc.roots)
if r != tc.expect {
t.Errorf("case[%d]: expected %t, got %t for %q in %q", i, tc.expect, r, tc.path, tc.roots)
}
}
}
func Test_hasDeepCopyMethod(t *testing.T) {
testCases := []struct {
typ types.Type
expect bool
}{
{
typ: types.Type{
Name: types.Name{Package: "pkgname", Name: "typename"},
Kind: types.Builtin,
// No DeepCopy method.
Methods: map[string]*types.Type{},
},
expect: false,
},
{
typ: types.Type{
Name: types.Name{Package: "pkgname", Name: "typename"},
Kind: types.Builtin,
Methods: map[string]*types.Type{
// No DeepCopy method.
"method": {
Name: types.Name{Package: "pkgname", Name: "func()"},
Kind: types.Func,
Signature: &types.Signature{
Parameters: []*types.Type{},
Results: []*types.Type{},
},
},
},
},
expect: false,
},
{
typ: types.Type{
Name: types.Name{Package: "pkgname", Name: "typename"},
Kind: types.Builtin,
Methods: map[string]*types.Type{
// Wrong signature (no result).
"DeepCopy": {
Name: types.Name{Package: "pkgname", Name: "func()"},
Kind: types.Func,
Signature: &types.Signature{
Parameters: []*types.Type{},
Results: []*types.Type{},
},
},
},
},
expect: false,
},
{
typ: types.Type{
Name: types.Name{Package: "pkgname", Name: "typename"},
Kind: types.Builtin,
Methods: map[string]*types.Type{
// Wrong signature (wrong result).
"DeepCopy": {
Name: types.Name{Package: "pkgname", Name: "func() int"},
Kind: types.Func,
Signature: &types.Signature{
Parameters: []*types.Type{},
Results: []*types.Type{
{
Name: types.Name{Name: "int"},
Kind: types.Builtin,
},
},
},
},
},
},
expect: false,
},
{
typ: types.Type{
Name: types.Name{Package: "pkgname", Name: "typename"},
Kind: types.Builtin,
Methods: map[string]*types.Type{
// Correct signature.
"DeepCopy": {
Name: types.Name{Package: "pkgname", Name: "func() pkgname.typename"},
Kind: types.Func,
Signature: &types.Signature{
Parameters: []*types.Type{},
Results: []*types.Type{
{
Name: types.Name{Package: "pkgname", Name: "typename"},
Kind: types.Builtin,
},
},
},
},
},
},
expect: true,
},
{
typ: types.Type{
Name: types.Name{Package: "pkgname", Name: "typename"},
Kind: types.Builtin,
Methods: map[string]*types.Type{
// Wrong signature (has params).
"DeepCopy": {
Name: types.Name{Package: "pkgname", Name: "func(int) pkgname.typename"},
Kind: types.Func,
Signature: &types.Signature{
Parameters: []*types.Type{
{
Name: types.Name{Name: "int"},
Kind: types.Builtin,
},
},
Results: []*types.Type{
{
Name: types.Name{Package: "pkgname", Name: "typename"},
Kind: types.Builtin,
},
},
},
},
},
},
expect: false,
},
{
typ: types.Type{
Name: types.Name{Package: "pkgname", Name: "typename"},
Kind: types.Builtin,
Methods: map[string]*types.Type{
// Wrong signature (extra results).
"DeepCopy": {
Name: types.Name{Package: "pkgname", Name: "func() (pkgname.typename, int)"},
Kind: types.Func,
Signature: &types.Signature{
Parameters: []*types.Type{},
Results: []*types.Type{
{
Name: types.Name{Package: "pkgname", Name: "typename"},
Kind: types.Builtin,
},
{
Name: types.Name{Name: "int"},
Kind: types.Builtin,
},
},
},
},
},
},
expect: false,
},
}
for i, tc := range testCases {
r := hasDeepCopyMethod(&tc.typ)
if r != tc.expect {
t.Errorf("case[%d]: expected %t, got %t", i, tc.expect, r)
}
}
}
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)
}
}
}
......@@ -16,9 +16,35 @@ limitations under the License.
// deepcopy-gen is a tool for auto-generating DeepCopy functions.
//
// Structs in the input directories with the below line in their comments
// will be ignored during generation.
// // +gencopy=false
// Given a list of input directories, it will generate functions that
// efficiently perform a full deep-copy of each type. For any type that
// offers a `.DeepCopy()` method, it will simply call that. Otherwise it will
// use standard value assignment whenever possible. If that is not possible it
// will try to call its own generated copy function for the type, if the type is
// within the allowed root packages. Failing that, it will fall back on
// `conversion.Cloner.DeepCopy(val)` to make the copy. The resulting file will
// be stored in the same directory as the processed source package.
//
// 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=package
//
// 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
//
// 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 (
......@@ -26,58 +52,24 @@ import (
"k8s.io/kubernetes/cmd/libs/go2idl/deepcopy-gen/generators"
"github.com/golang/glog"
"github.com/spf13/pflag"
)
func main() {
arguments := args.Default()
arguments.CustomArgs = generators.Constraints{
// Types outside of this package will be inlined.
PackageConstraints: []string{"k8s.io/kubernetes/"},
}
// Override defaults. These are Kubernetes specific input locations.
arguments.InputDirs = []string{
// generate all types, but do not register them
"+k8s.io/kubernetes/pkg/api/unversioned",
"-k8s.io/kubernetes/pkg/api/meta",
"-k8s.io/kubernetes/pkg/api/meta/metatypes",
"-k8s.io/kubernetes/pkg/api/resource",
"-k8s.io/kubernetes/pkg/conversion",
"-k8s.io/kubernetes/pkg/labels",
"-k8s.io/kubernetes/pkg/runtime",
"-k8s.io/kubernetes/pkg/runtime/serializer",
"-k8s.io/kubernetes/pkg/util/intstr",
"-k8s.io/kubernetes/pkg/util/sets",
// Override defaults.
arguments.OutputFileBaseName = "deep_copy_generated"
"k8s.io/kubernetes/pkg/api",
"k8s.io/kubernetes/pkg/api/v1",
"k8s.io/kubernetes/pkg/apis/authentication.k8s.io",
"k8s.io/kubernetes/pkg/apis/authentication.k8s.io/v1beta1",
"k8s.io/kubernetes/pkg/apis/authorization",
"k8s.io/kubernetes/pkg/apis/authorization/v1beta1",
"k8s.io/kubernetes/pkg/apis/autoscaling",
"k8s.io/kubernetes/pkg/apis/autoscaling/v1",
"k8s.io/kubernetes/pkg/apis/batch",
"k8s.io/kubernetes/pkg/apis/batch/v1",
"k8s.io/kubernetes/pkg/apis/batch/v2alpha1",
"k8s.io/kubernetes/pkg/apis/apps",
"k8s.io/kubernetes/pkg/apis/apps/v1alpha1",
"k8s.io/kubernetes/pkg/apis/certificates",
"k8s.io/kubernetes/pkg/apis/certificates/v1alpha1",
"k8s.io/kubernetes/pkg/apis/componentconfig",
"k8s.io/kubernetes/pkg/apis/componentconfig/v1alpha1",
"k8s.io/kubernetes/pkg/apis/policy",
"k8s.io/kubernetes/pkg/apis/policy/v1alpha1",
"k8s.io/kubernetes/pkg/apis/extensions",
"k8s.io/kubernetes/pkg/apis/extensions/v1beta1",
"k8s.io/kubernetes/pkg/apis/rbac",
"k8s.io/kubernetes/pkg/apis/rbac/v1alpha1",
"k8s.io/kubernetes/federation/apis/federation",
"k8s.io/kubernetes/federation/apis/federation/v1beta1",
// Custom args.
customArgs := &generators.CustomArgs{
BoundingDirs: []string{"k8s.io/kubernetes"},
}
pflag.CommandLine.StringSliceVar(&customArgs.BoundingDirs, "bounding-dirs", customArgs.BoundingDirs,
"Comma-separated list of import paths which bound the types for which deep-copies will be generated.")
arguments.CustomArgs = customArgs
// Run it.
if err := arguments.Execute(
generators.NameSystems(),
generators.DefaultNameSystem(),
......
......@@ -152,6 +152,9 @@ type Context struct {
// All the types, in case you want to look up something.
Universe types.Universe
// All the user-specified packages. This is after recursive expansion.
Inputs []string
// The canonical ordering of the types (will be filtered by both the
// Package's and Generator's Filter methods).
Order []*types.Type
......@@ -168,14 +171,15 @@ type Context struct {
// NewContext generates a context from the given builder, naming systems, and
// the naming system you wish to construct the canonical ordering from.
func NewContext(b *parser.Builder, nameSystems namer.NameSystems, canonicalOrderName string) (*Context, error) {
u, err := b.FindTypes()
universe, err := b.FindTypes()
if err != nil {
return nil, err
}
c := &Context{
Namers: namer.NameSystems{},
Universe: u,
Universe: universe,
Inputs: b.FindPackages(),
FileTypes: map[string]FileType{
GolangFileType: NewGolangFile(),
},
......@@ -185,7 +189,7 @@ func NewContext(b *parser.Builder, nameSystems namer.NameSystems, canonicalOrder
c.Namers[name] = systemNamer
if name == canonicalOrderName {
orderer := namer.Orderer{Namer: systemNamer}
c.Order = orderer.OrderUniverse(u)
c.Order = orderer.OrderUniverse(universe)
}
}
return c, nil
......
......@@ -25,6 +25,8 @@ import (
"strconv"
"strings"
"github.com/golang/glog"
"k8s.io/kubernetes/cmd/libs/go2idl/generator"
"k8s.io/kubernetes/cmd/libs/go2idl/namer"
"k8s.io/kubernetes/cmd/libs/go2idl/types"
......@@ -70,13 +72,20 @@ func (g *genProtoIDL) Namers(c *generator.Context) namer.NameSystems {
// Filter ignores types that are identified as not exportable.
func (g *genProtoIDL) Filter(c *generator.Context, t *types.Type) bool {
flags := types.ExtractCommentTags("+", t.CommentLines)
switch {
case flags["protobuf"] == "false":
return false
case flags["protobuf"] == "true":
return true
case !g.generateAll:
tagVals := types.ExtractCommentTags("+", t.CommentLines)["protobuf"]
if tagVals != nil {
if tagVals[0] == "false" {
// Type specified "false".
return false
}
if tagVals[0] == "true" {
// Type specified "true".
return true
}
glog.Fatalf(`Comment tag "protobuf" must be true or false, found: %q`, tagVals[0])
}
if !g.generateAll {
// We're not generating everything.
return false
}
seen := map[*types.Type]bool{}
......@@ -125,7 +134,7 @@ func isOptionalAlias(t *types.Type) bool {
if t.Underlying == nil || (t.Underlying.Kind != types.Map && t.Underlying.Kind != types.Slice) {
return false
}
if types.ExtractCommentTags("+", t.CommentLines)["protobuf.nullable"] != "true" {
if extractBoolTagOrDie("protobuf.nullable", t.CommentLines) == false {
return false
}
return true
......@@ -268,7 +277,7 @@ func (b bodyGen) doAlias(sw *generator.SnippetWriter) error {
Members: []types.Member{
{
Name: "Items",
CommentLines: fmt.Sprintf("items, if empty, will result in an empty %s\n", kind),
CommentLines: []string{fmt.Sprintf("items, if empty, will result in an empty %s\n", kind)},
Type: b.t.Underlying,
},
},
......@@ -296,7 +305,7 @@ func (b bodyGen) doStruct(sw *generator.SnippetWriter) error {
key := strings.TrimPrefix(k, "protobuf.options.")
switch key {
case "marshal":
if v == "false" {
if v[0] == "false" {
if !b.omitGogo {
options = append(options,
"(gogoproto.marshaler) = false",
......@@ -307,14 +316,14 @@ func (b bodyGen) doStruct(sw *generator.SnippetWriter) error {
}
default:
if !b.omitGogo || !strings.HasPrefix(key, "(gogoproto.") {
options = append(options, fmt.Sprintf("%s = %s", key, v))
options = append(options, fmt.Sprintf("%s = %s", key, v[0]))
}
}
// protobuf.as allows a type to have the same message contents as another Go type
case k == "protobuf.as":
fields = nil
if alias = b.locator.GoTypeForName(types.Name{Name: v}); alias == nil {
return fmt.Errorf("type %v references alias %q which does not exist", b.t, v)
if alias = b.locator.GoTypeForName(types.Name{Name: v[0]}); alias == nil {
return fmt.Errorf("type %v references alias %q which does not exist", b.t, v[0])
}
// protobuf.embed instructs the generator to use the named type in this package
// as an embedded message.
......@@ -322,10 +331,10 @@ func (b bodyGen) doStruct(sw *generator.SnippetWriter) error {
fields = []protoField{
{
Tag: 1,
Name: v,
Name: v[0],
Type: &types.Type{
Name: types.Name{
Name: v,
Name: v[0],
Package: b.localPackage.Package,
Path: b.localPackage.Path,
},
......@@ -410,7 +419,7 @@ type protoField struct {
Nullable bool
Extras map[string]string
CommentLines string
CommentLines []string
}
var (
......@@ -687,8 +696,7 @@ func membersToFields(locator ProtobufLocator, t *types.Type, localPackage types.
return fields, nil
}
func genComment(out io.Writer, comment, indent string) {
lines := strings.Split(comment, "\n")
func genComment(out io.Writer, lines []string, indent string) {
for {
l := len(lines)
if l == 0 || len(lines[l-1]) != 0 {
......
......@@ -14,29 +14,20 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package core
package protobuf
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/runtime"
"github.com/golang/glog"
"k8s.io/kubernetes/cmd/libs/go2idl/types"
)
func addDeepCopyFuncs(scheme *runtime.Scheme) {
if err := scheme.AddGeneratedDeepCopyFuncs(
api.DeepCopy_api_DeleteOptions,
api.DeepCopy_api_ExportOptions,
api.DeepCopy_api_List,
api.DeepCopy_api_ListOptions,
api.DeepCopy_api_ObjectMeta,
api.DeepCopy_api_ObjectReference,
api.DeepCopy_api_OwnerReference,
api.DeepCopy_api_Service,
api.DeepCopy_api_ServiceList,
api.DeepCopy_api_ServicePort,
api.DeepCopy_api_ServiceSpec,
api.DeepCopy_api_ServiceStatus,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
// 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 {
glog.Fatalf(err.Error())
}
return val
}
......@@ -70,11 +70,10 @@ func main() {
// Override defaults. These are Kubernetes specific input and output
// locations.
arguments.InputDirs = []string{
"k8s.io/kubernetes/pkg/",
"k8s.io/kubernetes/cmd/",
"k8s.io/kubernetes/plugin/",
"k8s.io/kubernetes/pkg/...",
"k8s.io/kubernetes/cmd/...",
"k8s.io/kubernetes/plugin/...",
}
arguments.Recursive = true
// arguments.VerifyOnly = true
if err := arguments.Execute(
......
......@@ -129,7 +129,9 @@ func (b *Builder) buildPackage(pkgPath string) (*build.Package, error) {
}
pkg, err = b.context.Import(pkgPath, cwd, build.ImportComment)
if err != nil {
return nil, fmt.Errorf("unable to import %q: %v", pkgPath, err)
if _, ok := err.(*build.NoGoError); !ok {
return nil, fmt.Errorf("unable to import %q: %v", pkgPath, err)
}
}
b.buildInfo[pkgPath] = pkg
......@@ -350,6 +352,20 @@ func (b *Builder) makePackages() error {
return nil
}
// FindPackages fetches a list of the user-imported packages.
func (b *Builder) FindPackages() []string {
result := []string{}
for pkgPath := range b.pkgs {
if b.userRequested[pkgPath] {
// Since walkType is recursive, all types that are in packages that
// were directly mentioned will be included. We don't need to
// include all types in all transitive packages, though.
result = append(result, pkgPath)
}
}
return result
}
// FindTypes finalizes the package imports, and searches through all the
// packages for types.
func (b *Builder) FindTypes() (types.Universe, error) {
......@@ -370,11 +386,12 @@ func (b *Builder) FindTypes() (types.Universe, error) {
for _, f := range b.parsed[pkgPath] {
if strings.HasSuffix(f.name, "/doc.go") {
tp := u.Package(pkgPath)
for i := range f.file.Comments {
tp.Comments = append(tp.Comments, splitLines(f.file.Comments[i].Text())...)
}
if f.file.Doc != nil {
tp := u.Package(pkgPath)
for _, c := range f.file.Doc.List {
tp.DocComments = append(tp.DocComments, c.Text)
}
tp.DocComments = splitLines(f.file.Doc.Text())
}
}
}
......@@ -386,11 +403,11 @@ func (b *Builder) FindTypes() (types.Universe, error) {
if ok {
t := b.walkType(u, nil, tn.Type())
c1 := b.priorCommentLines(obj.Pos(), 1)
t.CommentLines = c1.Text()
t.CommentLines = splitLines(c1.Text())
if c1 == nil {
t.SecondClosestCommentLines = b.priorCommentLines(obj.Pos(), 2).Text()
t.SecondClosestCommentLines = splitLines(b.priorCommentLines(obj.Pos(), 2).Text())
} else {
t.SecondClosestCommentLines = b.priorCommentLines(c1.List[0].Slash, 2).Text()
t.SecondClosestCommentLines = splitLines(b.priorCommentLines(c1.List[0].Slash, 2).Text())
}
}
tf, ok := obj.(*tc.Func)
......@@ -418,6 +435,10 @@ func (b *Builder) priorCommentLines(pos token.Pos, lines int) *ast.CommentGroup
return b.endLineToCommentGroup[key]
}
func splitLines(str string) []string {
return strings.Split(strings.TrimRight(str, "\n"), "\n")
}
func tcFuncNameToName(in string) types.Name {
name := strings.TrimLeft(in, "func ")
nameParts := strings.Split(name, "(")
......@@ -494,7 +515,7 @@ func (b *Builder) walkType(u types.Universe, useName *types.Name, in tc.Type) *t
Embedded: f.Anonymous(),
Tags: t.Tag(i),
Type: b.walkType(u, nil, f.Type()),
CommentLines: b.priorCommentLines(f.Pos(), 1).Text(),
CommentLines: splitLines(b.priorCommentLines(f.Pos(), 1).Text()),
}
out.Members = append(out.Members, m)
}
......@@ -570,7 +591,10 @@ func (b *Builder) walkType(u types.Universe, useName *types.Name, in tc.Type) *t
out.Kind = types.Interface
t.Complete()
for i := 0; i < t.NumMethods(); i++ {
out.Methods = append(out.Methods, b.walkType(u, nil, t.Method(i).Type()))
if out.Methods == nil {
out.Methods = map[string]*types.Type{}
}
out.Methods[t.Method(i).Name()] = b.walkType(u, nil, t.Method(i).Type())
}
return out
case *tc.Named:
......@@ -599,7 +623,10 @@ func (b *Builder) walkType(u types.Universe, useName *types.Name, in tc.Type) *t
// methods, add them. (Interface types will
// have already added methods.)
for i := 0; i < t.NumMethods(); i++ {
out.Methods = append(out.Methods, b.walkType(u, nil, t.Method(i).Type()))
if out.Methods == nil {
out.Methods = map[string]*types.Type{}
}
out.Methods[t.Method(i).Name()] = b.walkType(u, nil, t.Method(i).Type())
}
}
return out
......
......@@ -197,13 +197,13 @@ type Blah struct {
if e, a := types.Struct, blahT.Kind; e != a {
t.Errorf("struct kind wrong, wanted %v, got %v", e, a)
}
if e, a := "Blah is a test.\nA test, I tell you.\n", blahT.CommentLines; e != a {
t.Errorf("struct comment wrong, wanted %v, got %v", e, a)
if e, a := []string{"Blah is a test.", "A test, I tell you."}, blahT.CommentLines; !reflect.DeepEqual(e, a) {
t.Errorf("struct comment wrong, wanted %q, got %q", e, a)
}
m := types.Member{
Name: "B",
Embedded: false,
CommentLines: "B is the second field.\nMultiline comments work.\n",
CommentLines: []string{"B is the second field.", "Multiline comments work."},
Tags: `json:"b"`,
Type: types.String,
}
......@@ -216,7 +216,7 @@ func TestParseSecondClosestCommentLines(t *testing.T) {
const fileName = "base/foo/proto/foo.go"
testCases := []struct {
testFile map[string]string
expected string
expected []string
}{
{
map[string]string{fileName: `package foo
......@@ -229,7 +229,7 @@ type Blah struct {
a int
}
`},
"Blah's SecondClosestCommentLines.\nAnother line.\n",
[]string{"Blah's SecondClosestCommentLines.", "Another line."},
},
{
map[string]string{fileName: `package foo
......@@ -240,15 +240,15 @@ type Blah struct {
a int
}
`},
"Blah's SecondClosestCommentLines.\nAnother line.\n",
[]string{"Blah's SecondClosestCommentLines.", "Another line."},
},
}
for _, test := range testCases {
_, u, o := construct(t, test.testFile, namer.NewPublicNamer(0))
t.Logf("%#v", o)
blahT := u.Type(types.Name{Package: "base/foo/proto", Name: "Blah"})
if e, a := test.expected, blahT.SecondClosestCommentLines; e != a {
t.Errorf("struct second closest comment wrong, wanted %v, got %v", e, a)
if e, a := test.expected, blahT.SecondClosestCommentLines; !reflect.DeepEqual(e, a) {
t.Errorf("struct second closest comment wrong, wanted %q, got %q", e, a)
}
}
}
......
......@@ -108,7 +108,7 @@ func Packages(_ *generator.Context, arguments *args.GeneratorArgs) generator.Pac
// // +genset
// or
// // +genset=true
return types.ExtractCommentTags("+", t.CommentLines)["genset"] == "true"
return extractBoolTagOrDie("genset", t.CommentLines) == true
}
return false
},
......
......@@ -14,29 +14,20 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package v1
package generators
import (
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/runtime"
"github.com/golang/glog"
"k8s.io/kubernetes/cmd/libs/go2idl/types"
)
func addDeepCopyFuncs(scheme *runtime.Scheme) {
if err := scheme.AddGeneratedDeepCopyFuncs(
v1.DeepCopy_v1_DeleteOptions,
v1.DeepCopy_v1_ExportOptions,
v1.DeepCopy_v1_List,
v1.DeepCopy_v1_ListOptions,
v1.DeepCopy_v1_ObjectMeta,
v1.DeepCopy_v1_ObjectReference,
v1.DeepCopy_v1_OwnerReference,
v1.DeepCopy_v1_Service,
v1.DeepCopy_v1_ServiceList,
v1.DeepCopy_v1_ServicePort,
v1.DeepCopy_v1_ServiceSpec,
v1.DeepCopy_v1_ServiceStatus,
); err != nil {
// if one of the deep copy functions is malformed, detect it immediately.
panic(err)
// 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 {
glog.Fatalf(err.Error())
}
return val
}
......@@ -19,29 +19,28 @@ limitations under the License.
package types
import (
"fmt"
"strings"
)
// ExtractCommentTags parses comments for lines of the form:
//
// 'marker'+"key1=value1,key2=value2".
// 'marker' + "key=value".
//
// Values are optional; 'true' is the default. If a key is set multiple times,
// the last one wins.
// Values are optional; "" is the default. A tag can be specified more than
// one time and all values are returned. If the resulting map has an entry for
// a key, the value (a slice) is guaranteed to have at least 1 element.
//
// Example: if you pass "+" for 'marker', and the following two lines are in
// Example: if you pass "+" for 'marker', and the following lines are in
// the comments:
// +foo=value1,bar
// +foo=value2,baz="frobber"
// +foo=value1
// +bar
// +foo=value2
// +baz="qux"
// Then this function will return:
// map[string]string{"foo":"value2", "bar": "true", "baz": "frobber"}
//
// TODO: Basically we need to define a standard way of giving instructions to
// autogenerators in the comments of a type. This is a first iteration of that.
// TODO: allow multiple values per key?
func ExtractCommentTags(marker, allLines string) map[string]string {
lines := strings.Split(allLines, "\n")
out := map[string]string{}
// map[string][]string{"foo":{"value1, "value2"}, "bar": {""}, "baz": {"qux"}}
func ExtractCommentTags(marker string, lines []string) map[string][]string {
out := map[string][]string{}
for _, line := range lines {
line = strings.Trim(line, " ")
if len(line) == 0 {
......@@ -50,15 +49,34 @@ func ExtractCommentTags(marker, allLines string) map[string]string {
if !strings.HasPrefix(line, marker) {
continue
}
pairs := strings.Split(line[len(marker):], ",")
for _, p := range pairs {
kv := strings.Split(p, "=")
if len(kv) == 2 {
out[kv[0]] = kv[1]
} else if len(kv) == 1 {
out[kv[0]] = "true"
}
// TODO: we could support multiple values per key if we split on spaces
kv := strings.SplitN(line[len(marker):], "=", 2)
if len(kv) == 2 {
out[kv[0]] = append(out[kv[0]], kv[1])
} else if len(kv) == 1 {
out[kv[0]] = append(out[kv[0]], "")
}
}
return out
}
// ExtractSingleBoolCommentTag parses comments for lines of the form:
//
// 'marker' + "key=value1"
//
// If the tag is not found, the default value is returned. Values are asserted
// to be boolean ("true" or "false"), and any other value will cause an error
// to be returned. If the key has multiple values, the first one will be used.
func ExtractSingleBoolCommentTag(marker string, key string, defaultVal bool, lines []string) (bool, error) {
values := ExtractCommentTags(marker, lines)[key]
if values == nil {
return defaultVal, nil
}
if values[0] == "true" {
return true, nil
}
if values[0] == "false" {
return false, nil
}
return false, fmt.Errorf("tag value for %q is not boolean: %q", key, values[0])
}
......@@ -18,18 +18,69 @@ package types
import (
"reflect"
"strings"
"testing"
)
func TestExtractCommentTags(t *testing.T) {
commentLines := `
Human comment that is ignored.
+foo=value1,bar
+foo=value2,baz=frobber
`
commentLines := []string{
"Human comment that is ignored.",
"+foo=value1",
"+bar",
"+foo=value2",
"+baz=qux,zrb=true",
}
a := ExtractCommentTags("+", commentLines)
e := map[string]string{"foo": "value2", "bar": "true", "baz": "frobber"}
e := map[string][]string{
"foo": {"value1", "value2"},
"bar": {""},
"baz": {"qux,zrb=true"},
}
if !reflect.DeepEqual(e, a) {
t.Errorf("Wanted %#v, got %#v", e, a)
t.Errorf("Wanted %q, got %q", e, a)
}
}
func TestExtractSingleBoolCommentTag(t *testing.T) {
commentLines := []string{
"Human comment that is ignored.",
"+TRUE=true",
"+FALSE=false",
"+MULTI=true",
"+MULTI=false",
"+MULTI=multi",
"+NOTBOOL=blue",
"+EMPTY",
}
testCases := []struct {
key string
def bool
exp bool
err string // if set, ignore exp.
}{
{"TRUE", false, true, ""},
{"FALSE", true, false, ""},
{"MULTI", false, true, ""},
{"NOTBOOL", false, true, "is not boolean"},
{"EMPTY", false, true, "is not boolean"},
{"ABSENT", true, true, ""},
{"ABSENT", false, false, ""},
}
for i, tc := range testCases {
v, err := ExtractSingleBoolCommentTag("+", tc.key, tc.def, commentLines)
if err != nil && tc.err == "" {
t.Errorf("[%d]: unexpected failure: %v", i, err)
} else if err == nil && tc.err != "" {
t.Errorf("[%d]: expected failure: %v", i, tc.err)
} else if err != nil {
if !strings.Contains(err.Error(), tc.err) {
t.Errorf("[%d]: unexpected error: expected %q, got %q", i, tc.err, err)
}
} else if v != tc.exp {
t.Errorf("[%d]: unexpected value: expected %t, got %t", i, tc.exp, v)
}
}
}
......@@ -89,9 +89,12 @@ type Package struct {
// 'package x' line.
Name string
// Comments from doc.go file.
// DocComments from doc.go, if any.
DocComments []string
// Comments from doc.go, if any.
Comments []string
// Types within this package, indexed by their name (*not* including
// package name).
Types map[string]*Type
......@@ -235,7 +238,7 @@ type Type struct {
// If there are comment lines immediately before the type definition,
// they will be recorded here.
CommentLines string
CommentLines []string
// If there are comment lines preceding the `CommentLines`, they will be
// recorded here. There are two cases:
......@@ -252,7 +255,7 @@ type Type struct {
// a blank line
// type definition
// ---
SecondClosestCommentLines string
SecondClosestCommentLines []string
// If Kind == Struct
Members []Member
......@@ -267,10 +270,10 @@ type Type struct {
// If Kind == DeclarationOf, this is the type of the declaration.
Underlying *Type
// If Kind == Interface, this is the list of all required functions.
// If Kind == Interface, this is the set of all required functions.
// Otherwise, if this is a named type, this is the list of methods that
// type has. (All elements will have Kind=="Func")
Methods []*Type
Methods map[string]*Type
// If Kind == func, this is the signature of the function.
Signature *Signature
......@@ -285,9 +288,32 @@ func (t *Type) String() string {
return t.Name.String()
}
// IsAssignable returns whether the type is assignable.
// IsPrimitive returns whether the type is a built-in type or is an alias to a
// built-in type. For example: strings and aliases of strings are primitives,
// structs are not.
func (t *Type) IsPrimitive() bool {
if t.Kind == Builtin || (t.Kind == Alias && t.Underlying.Kind == Builtin) {
return true
}
return false
}
// IsAssignable returns whether the type is deep-assignable. For example,
// slices and maps and pointers are shallow copies, but ints and strings are
// complete.
func (t *Type) IsAssignable() bool {
return t.Kind == Builtin || (t.Kind == Alias && t.Underlying.Kind == Builtin)
if t.IsPrimitive() {
return true
}
if t.Kind == Struct {
for _, m := range t.Members {
if !m.Type.IsAssignable() {
return false
}
}
return true
}
return false
}
// IsAnonymousStruct returns true if the type is an anonymous struct or an alias
......@@ -307,7 +333,7 @@ type Member struct {
// If there are comment lines immediately before the member in the type
// definition, they will be recorded here.
CommentLines string
CommentLines []string
// If there are tags along with this member, they will be saved here.
Tags string
......@@ -335,7 +361,7 @@ type Signature struct {
// If there are comment lines immediately before this
// signature/method/function declaration, they will be recorded here.
CommentLines string
CommentLines []string
}
// Built in types.
......
......@@ -45,3 +45,166 @@ func TestGetMarker(t *testing.T) {
t.Errorf("Expected marker type.")
}
}
func Test_Type_IsPrimitive(t *testing.T) {
testCases := []struct {
typ Type
expect bool
}{
{
typ: Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Builtin,
},
expect: true,
},
{
typ: Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Alias,
Underlying: &Type{
Name: Name{Package: "pkgname", Name: "underlying"},
Kind: Builtin,
},
},
expect: true,
},
{
typ: Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Pointer,
Elem: &Type{
Name: Name{Package: "pkgname", Name: "pointee"},
Kind: Builtin,
},
},
expect: false,
},
{
typ: Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Struct,
},
expect: false,
},
}
for i, tc := range testCases {
r := tc.typ.IsPrimitive()
if r != tc.expect {
t.Errorf("case[%d]: expected %t, got %t", i, tc.expect, r)
}
}
}
func Test_Type_IsAssignable(t *testing.T) {
testCases := []struct {
typ Type
expect bool
}{
{
typ: Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Builtin,
},
expect: true,
},
{
typ: Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Alias,
Underlying: &Type{
Name: Name{Package: "pkgname", Name: "underlying"},
Kind: Builtin,
},
},
expect: true,
},
{
typ: Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Pointer,
Elem: &Type{
Name: Name{Package: "pkgname", Name: "pointee"},
Kind: Builtin,
},
},
expect: false,
},
{
typ: Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Struct, // Empty struct
},
expect: true,
},
{
typ: Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Struct,
Members: []Member{
{
Name: "m1",
Type: &Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Builtin,
},
},
{
Name: "m2",
Type: &Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Alias,
Underlying: &Type{
Name: Name{Package: "pkgname", Name: "underlying"},
Kind: Builtin,
},
},
},
{
Name: "m3",
Type: &Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Struct, // Empty struct
},
},
},
},
expect: true,
},
{
typ: Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Struct,
Members: []Member{
{
Name: "m1",
Type: &Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Builtin,
},
},
{
Name: "m2",
Type: &Type{
Name: Name{Package: "pkgname", Name: "typename"},
Kind: Pointer,
Elem: &Type{
Name: Name{Package: "pkgname", Name: "pointee"},
Kind: Builtin,
},
},
},
},
},
expect: false,
},
}
for i, tc := range testCases {
r := tc.typ.IsAssignable()
if r != tc.expect {
t.Errorf("case[%d]: expected %t, got %t", i, tc.expect, r)
}
}
}
......@@ -75,12 +75,14 @@ cmd/libs/go2idl/ tool.
1. Generate conversions and deep-copies:
1. Add your "group/" or "group/version" into
cmd/libs/go2idl/{conversion-gen, deep-copy-gen}/main.go;
cmd/libs/go2idl/conversion-gen/main.go;
2. Make sure your pkg/apis/`<group>`/`<version>` directory has a doc.go file
with the comment `// +k8s:deepcopy-gen=package,register`, to catch the
attention of our generation tools.
3. Make sure your pkg/apis/`<group>`/`<version>` directory has a doc.go file
with the comment `// +genconversion=true`, to catch the attention of our
gen-conversion script.
3. Run hack/update-all.sh.
4. Run hack/update-all.sh.
2. Generate files for Ugorji codec:
......
......@@ -468,12 +468,11 @@ regenerate auto-generated ones. To regenerate them run:
hack/update-codegen.sh
```
update-codegen will also generate code to handle deep copy of your versioned
api objects. The deep copy code resides with each versioned API:
- `pkg/api/<version>/deep_copy_generated.go` containing auto-generated copy functions
- `pkg/apis/extensions/<version>/deep_copy_generated.go` containing auto-generated copy functions
As part of the build, kubernetes will also generate code to handle deep copy of
your versioned api objects. The deep copy code resides with each versioned API:
- `<path_to_versioned_api>/zz_generated.deep_copy.go` containing auto-generated copy functions
If running the above script is impossible due to compile errors, the easiest
If regeneration is somehow not possible due to compile errors, the easiest
workaround is to comment out the code causing errors and let the script to
regenerate it. If the auto-generated conversion methods are not used by the
manually-written ones, it's fine to just remove the whole file and let the
......
......@@ -73,7 +73,6 @@ func AddToScheme(scheme *runtime.Scheme) {
&unversioned.APIResourceList{},
)
addDeepCopyFuncs(scheme)
addDefaultingFuncs(scheme)
addConversionFuncs(scheme)
}
......@@ -34,7 +34,6 @@ func AddToScheme(scheme *runtime.Scheme) {
addKnownTypes(scheme)
addConversionFuncs(scheme)
addDefaultingFuncs(scheme)
addDeepCopyFuncs(scheme)
}
// Adds the list of known types to api.Scheme.
......
......@@ -22,7 +22,6 @@ package federation
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
......@@ -41,9 +40,7 @@ func init() {
}
func DeepCopy_federation_Cluster(in Cluster, out *Cluster, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -59,24 +56,16 @@ func DeepCopy_federation_Cluster(in Cluster, out *Cluster, c *conversion.Cloner)
func DeepCopy_federation_ClusterCondition(in ClusterCondition, out *ClusterCondition, c *conversion.Cloner) error {
out.Type = in.Type
out.Status = in.Status
if err := unversioned.DeepCopy_unversioned_Time(in.LastProbeTime, &out.LastProbeTime, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastTransitionTime, &out.LastTransitionTime, c); err != nil {
return err
}
out.LastProbeTime = in.LastProbeTime.DeepCopy()
out.LastTransitionTime = in.LastTransitionTime.DeepCopy()
out.Reason = in.Reason
out.Message = in.Message
return nil
}
func DeepCopy_federation_ClusterList(in ClusterList, out *ClusterList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Cluster, len(in))
......@@ -96,9 +85,7 @@ func DeepCopy_federation_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conver
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
*out = make([]ServerAddressByClientCIDR, len(in))
for i := range in {
if err := DeepCopy_federation_ServerAddressByClientCIDR(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.ServerAddressByClientCIDRs = nil
......@@ -106,9 +93,7 @@ func DeepCopy_federation_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conver
if in.SecretRef != nil {
in, out := in.SecretRef, &out.SecretRef
*out = new(api.LocalObjectReference)
if err := api.DeepCopy_api_LocalObjectReference(*in, *out, c); err != nil {
return err
}
**out = *in
} else {
out.SecretRef = nil
}
......
// +build !ignore_autogenerated
/*
Copyright 2016 The Kubernetes Authors.
......@@ -16,17 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package intstr
import (
conversion "k8s.io/kubernetes/pkg/conversion"
)
// +k8s:deepcopy-gen=package,register
func DeepCopy_intstr_IntOrString(in IntOrString, out *IntOrString, c *conversion.Cloner) error {
out.Type = in.Type
out.IntVal = in.IntVal
out.StrVal = in.StrVal
return nil
}
package federation
......@@ -82,7 +82,8 @@ type ClusterStatus struct {
Region string `json:"region,omitempty"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// Information about a registered cluster in a federated kubernetes setup. Clusters are not namespaced and have unique names in the federation.
type Cluster struct {
......
......@@ -22,7 +22,6 @@ package v1beta1
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
)
......@@ -42,9 +41,7 @@ func init() {
}
func DeepCopy_v1beta1_Cluster(in Cluster, out *Cluster, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -60,24 +57,16 @@ func DeepCopy_v1beta1_Cluster(in Cluster, out *Cluster, c *conversion.Cloner) er
func DeepCopy_v1beta1_ClusterCondition(in ClusterCondition, out *ClusterCondition, c *conversion.Cloner) error {
out.Type = in.Type
out.Status = in.Status
if err := unversioned.DeepCopy_unversioned_Time(in.LastProbeTime, &out.LastProbeTime, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastTransitionTime, &out.LastTransitionTime, c); err != nil {
return err
}
out.LastProbeTime = in.LastProbeTime.DeepCopy()
out.LastTransitionTime = in.LastTransitionTime.DeepCopy()
out.Reason = in.Reason
out.Message = in.Message
return nil
}
func DeepCopy_v1beta1_ClusterList(in ClusterList, out *ClusterList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Cluster, len(in))
......@@ -97,9 +86,7 @@ func DeepCopy_v1beta1_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conversio
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
*out = make([]ServerAddressByClientCIDR, len(in))
for i := range in {
if err := DeepCopy_v1beta1_ServerAddressByClientCIDR(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.ServerAddressByClientCIDRs = nil
......@@ -107,9 +94,7 @@ func DeepCopy_v1beta1_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conversio
if in.SecretRef != nil {
in, out := in.SecretRef, &out.SecretRef
*out = new(v1.LocalObjectReference)
if err := v1.DeepCopy_v1_LocalObjectReference(*in, *out, c); err != nil {
return err
}
**out = *in
} else {
out.SecretRef = nil
}
......
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v1beta1
......@@ -82,7 +82,8 @@ type ClusterStatus struct {
Region string `json:"region,omitempty" protobuf:"bytes,6,opt,name=region"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// Information about a registered cluster in a federated kubernetes setup. Clusters are not namespaced and have unique names in the federation.
type Cluster struct {
......
......@@ -48,7 +48,34 @@ ${clientgen} --clientset-name="release_1_4" --input="api/v1,extensions/v1beta1,a
${clientgen} --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input="../../federation/apis/federation/","api/" --included-types-overrides="api/Service" "$@"
${clientgen} --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input="../../federation/apis/federation/v1beta1","api/v1" --included-types-overrides="api/v1/Service" "$@"
${conversiongen} "$@"
${deepcopygen} "$@"
${setgen} "$@"
# You may add additional calls of code generators like set-gen above.
# Generate a list of all files that have a `+k8s:` comment-tag. This will be
# used to derive lists of files/dirs for generation tools.
ALL_K8S_TAG_FILES=$(
grep -l '^// \?+k8s:' $(
find . \
-not \( \
\( \
-path ./vendor -o \
-path ./_output -o \
-path ./.git \
\) -prune \
\) \
-type f -name \*.go \
| sed 's|^./||'
)
)
DEEP_COPY_DIRS=$(
grep -l '+k8s:deepcopy-gen=' ${ALL_K8S_TAG_FILES} \
| xargs dirname \
| sort -u
)
INPUTS=$(
for d in ${DEEP_COPY_DIRS}; do
echo k8s.io/kubernetes/$d
done | paste -sd,
)
${deepcopygen} -i ${INPUTS}
......@@ -35,6 +35,7 @@ bench-workers
bind-address
bind-pods-burst
bind-pods-qps
bounding-dirs
build-only
build-services
build-tag
......@@ -339,6 +340,7 @@ out-version
outofdisk-transition-frequency
output-base
output-directory
output-file-base
output-package
output-print-type
output-version
......
......@@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +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.
// The contract presented to clients is located in the versioned packages,
......
......@@ -83,7 +83,6 @@ option go_package = "resource";
// writing some sort of special handling code in the hopes that that will
// cause implementors to also use a fixed point implementation.
//
// +gencopy=false
// +protobuf=true
// +protobuf.embed=string
// +protobuf.options.marshal=false
......
......@@ -87,7 +87,6 @@ import (
// writing some sort of special handling code in the hopes that that will
// cause implementors to also use a fixed point implementation.
//
// +gencopy=false
// +protobuf=true
// +protobuf.embed=string
// +protobuf.options.marshal=false
......@@ -386,6 +385,16 @@ func ParseQuantity(str string) (Quantity, error) {
return Quantity{d: infDecAmount{amount}, Format: format}, nil
}
// DeepCopy returns a deep-copy of the Quantity value. Note that the method
// receiver is a value, so we can mutate it in-place and return it.
func (q Quantity) DeepCopy() Quantity {
if q.d.Dec != nil {
tmp := &inf.Dec{}
q.d.Dec = tmp.Set(q.d.Dec)
}
return q
}
// CanonicalizeBytes returns the canonical form of q and its suffix (see comment on Quantity).
//
// Note about BinarySI:
......
......@@ -283,7 +283,8 @@ type PersistentVolumeClaimVolumeSource struct {
ReadOnly bool `json:"readOnly,omitempty"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
type PersistentVolume struct {
unversioned.TypeMeta `json:",inline"`
......@@ -2096,7 +2097,8 @@ const (
// ResourceList is a set of (resource name, quantity) pairs.
type ResourceList map[ResourceName]resource.Quantity
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// Node is a worker node in Kubernetes
// The name of the node according to etcd is in ObjectMeta.Name.
......@@ -2149,7 +2151,8 @@ const (
NamespaceTerminating NamespacePhase = "Terminating"
)
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// A namespace provides a scope for Names.
// Use of multiple namespaces is optional
......@@ -2785,7 +2788,8 @@ type ComponentCondition struct {
Error string `json:"error,omitempty"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
type ComponentStatus struct {
......
......@@ -26,31 +26,23 @@ import (
)
func DeepCopy_unversioned_APIGroup(in APIGroup, out *APIGroup, c *conversion.Cloner) error {
if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.Name = in.Name
if in.Versions != nil {
in, out := in.Versions, &out.Versions
*out = make([]GroupVersionForDiscovery, len(in))
for i := range in {
if err := DeepCopy_unversioned_GroupVersionForDiscovery(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.Versions = nil
}
if err := DeepCopy_unversioned_GroupVersionForDiscovery(in.PreferredVersion, &out.PreferredVersion, c); err != nil {
return err
}
out.PreferredVersion = in.PreferredVersion
if in.ServerAddressByClientCIDRs != nil {
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
*out = make([]ServerAddressByClientCIDR, len(in))
for i := range in {
if err := DeepCopy_unversioned_ServerAddressByClientCIDR(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.ServerAddressByClientCIDRs = nil
......@@ -59,9 +51,7 @@ func DeepCopy_unversioned_APIGroup(in APIGroup, out *APIGroup, c *conversion.Clo
}
func DeepCopy_unversioned_APIGroupList(in APIGroupList, out *APIGroupList, c *conversion.Cloner) error {
if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if in.Groups != nil {
in, out := in.Groups, &out.Groups
*out = make([]APIGroup, len(in))
......@@ -84,17 +74,13 @@ func DeepCopy_unversioned_APIResource(in APIResource, out *APIResource, c *conve
}
func DeepCopy_unversioned_APIResourceList(in APIResourceList, out *APIResourceList, c *conversion.Cloner) error {
if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.GroupVersion = in.GroupVersion
if in.APIResources != nil {
in, out := in.APIResources, &out.APIResources
*out = make([]APIResource, len(in))
for i := range in {
if err := DeepCopy_unversioned_APIResource(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.APIResources = nil
......@@ -103,9 +89,7 @@ func DeepCopy_unversioned_APIResourceList(in APIResourceList, out *APIResourceLi
}
func DeepCopy_unversioned_APIVersions(in APIVersions, out *APIVersions, c *conversion.Cloner) error {
if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if in.Versions != nil {
in, out := in.Versions, &out.Versions
*out = make([]string, len(in))
......@@ -117,9 +101,7 @@ func DeepCopy_unversioned_APIVersions(in APIVersions, out *APIVersions, c *conve
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
*out = make([]ServerAddressByClientCIDR, len(in))
for i := range in {
if err := DeepCopy_unversioned_ServerAddressByClientCIDR(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.ServerAddressByClientCIDRs = nil
......@@ -133,9 +115,7 @@ func DeepCopy_unversioned_Duration(in Duration, out *Duration, c *conversion.Clo
}
func DeepCopy_unversioned_ExportOptions(in ExportOptions, out *ExportOptions, c *conversion.Cloner) error {
if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.Export = in.Export
out.Exact = in.Exact
return nil
......@@ -244,12 +224,8 @@ func DeepCopy_unversioned_ServerAddressByClientCIDR(in ServerAddressByClientCIDR
}
func DeepCopy_unversioned_Status(in Status, out *Status, c *conversion.Cloner) error {
if err := DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
out.Status = in.Status
out.Message = in.Message
out.Reason = in.Reason
......@@ -281,9 +257,7 @@ func DeepCopy_unversioned_StatusDetails(in StatusDetails, out *StatusDetails, c
in, out := in.Causes, &out.Causes
*out = make([]StatusCause, len(in))
for i := range in {
if err := DeepCopy_unversioned_StatusCause(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.Causes = nil
......
/*
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.
*/
// +k8s:deepcopy-gen=package
package unversioned
......@@ -33,6 +33,13 @@ type Time struct {
time.Time `protobuf:"-"`
}
// DeepCopy returns a deep-copy of the Time value. The underlying time.Time
// type is effectively immutable in the time API, so it is safe to
// copy-by-assign, despite the presence of (unexported) Pointer fields.
func (t Time) DeepCopy() Time {
return t
}
// NewTime returns a wrapped instance of the provided time
func NewTime(time time.Time) Time {
return Time{time}
......
......@@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// Package v1 is the v1 version of the API.
// +genconversion=true
package v1
......@@ -341,7 +341,8 @@ type PersistentVolumeSource struct {
VsphereVolume *VsphereVirtualDiskVolumeSource `json:"vsphereVolume,omitempty" protobuf:"bytes,14,opt,name=vsphereVolume"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// PersistentVolume (PV) is a storage resource provisioned by an administrator.
// It is analogous to a node.
......@@ -2497,7 +2498,8 @@ const (
// ResourceList is a set of (resource name, quantity) pairs.
type ResourceList map[ResourceName]resource.Quantity
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// Node is a worker node in Kubernetes, formerly known as minion.
// Each node will have a unique identifier in the cache (i.e. in etcd).
......@@ -2560,7 +2562,8 @@ const (
NamespaceTerminating NamespacePhase = "Terminating"
)
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// Namespace provides a scope for Names.
// Use of multiple namespaces is optional.
......@@ -3215,7 +3218,8 @@ type ComponentCondition struct {
Error string `json:"error,omitempty" protobuf:"bytes,4,opt,name=error"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
type ComponentStatus struct {
......
......@@ -39,9 +39,7 @@ func init() {
}
func DeepCopy_apps_PetSet(in PetSet, out *PetSet, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -55,12 +53,8 @@ func DeepCopy_apps_PetSet(in PetSet, out *PetSet, c *conversion.Cloner) error {
}
func DeepCopy_apps_PetSetList(in PetSetList, out *PetSetList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]PetSet, len(in))
......
/*
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.
*/
// +k8s:deepcopy-gen=package,register
package apps
......@@ -40,9 +40,7 @@ func init() {
}
func DeepCopy_v1alpha1_PetSet(in PetSet, out *PetSet, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -56,12 +54,8 @@ func DeepCopy_v1alpha1_PetSet(in PetSet, out *PetSet, c *conversion.Cloner) erro
}
func DeepCopy_v1alpha1_PetSetList(in PetSetList, out *PetSetList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]PetSet, len(in))
......
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v1alpha1
......@@ -22,7 +22,6 @@ package authentication
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
......@@ -39,12 +38,8 @@ func init() {
}
func DeepCopy_authenticationk8sio_TokenReview(in TokenReview, out *TokenReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_authenticationk8sio_TokenReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.Spec = in.Spec
if err := DeepCopy_authenticationk8sio_TokenReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
......
/*
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.
*/
// +k8s:deepcopy-gen=package,register
package authentication
......@@ -22,7 +22,6 @@ package v1beta1
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
......@@ -39,12 +38,8 @@ func init() {
}
func DeepCopy_v1beta1_TokenReview(in TokenReview, out *TokenReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := DeepCopy_v1beta1_TokenReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.Spec = in.Spec
if err := DeepCopy_v1beta1_TokenReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
......
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v1beta1
......@@ -22,7 +22,6 @@ package authorization
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
......@@ -43,15 +42,11 @@ func init() {
}
func DeepCopy_authorization_LocalSubjectAccessReview(in LocalSubjectAccessReview, out *LocalSubjectAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := DeepCopy_authorization_SubjectAccessReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_authorization_SubjectAccessReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
out.Status = in.Status
return nil
}
......@@ -73,15 +68,11 @@ func DeepCopy_authorization_ResourceAttributes(in ResourceAttributes, out *Resou
}
func DeepCopy_authorization_SelfSubjectAccessReview(in SelfSubjectAccessReview, out *SelfSubjectAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := DeepCopy_authorization_SelfSubjectAccessReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_authorization_SubjectAccessReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
out.Status = in.Status
return nil
}
......@@ -89,18 +80,14 @@ func DeepCopy_authorization_SelfSubjectAccessReviewSpec(in SelfSubjectAccessRevi
if in.ResourceAttributes != nil {
in, out := in.ResourceAttributes, &out.ResourceAttributes
*out = new(ResourceAttributes)
if err := DeepCopy_authorization_ResourceAttributes(*in, *out, c); err != nil {
return err
}
**out = *in
} else {
out.ResourceAttributes = nil
}
if in.NonResourceAttributes != nil {
in, out := in.NonResourceAttributes, &out.NonResourceAttributes
*out = new(NonResourceAttributes)
if err := DeepCopy_authorization_NonResourceAttributes(*in, *out, c); err != nil {
return err
}
**out = *in
} else {
out.NonResourceAttributes = nil
}
......@@ -108,15 +95,11 @@ func DeepCopy_authorization_SelfSubjectAccessReviewSpec(in SelfSubjectAccessRevi
}
func DeepCopy_authorization_SubjectAccessReview(in SubjectAccessReview, out *SubjectAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := DeepCopy_authorization_SubjectAccessReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_authorization_SubjectAccessReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
out.Status = in.Status
return nil
}
......@@ -124,18 +107,14 @@ func DeepCopy_authorization_SubjectAccessReviewSpec(in SubjectAccessReviewSpec,
if in.ResourceAttributes != nil {
in, out := in.ResourceAttributes, &out.ResourceAttributes
*out = new(ResourceAttributes)
if err := DeepCopy_authorization_ResourceAttributes(*in, *out, c); err != nil {
return err
}
**out = *in
} else {
out.ResourceAttributes = nil
}
if in.NonResourceAttributes != nil {
in, out := in.NonResourceAttributes, &out.NonResourceAttributes
*out = new(NonResourceAttributes)
if err := DeepCopy_authorization_NonResourceAttributes(*in, *out, c); err != nil {
return err
}
**out = *in
} else {
out.NonResourceAttributes = nil
}
......
/*
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.
*/
// +k8s:deepcopy-gen=package,register
package authorization
......@@ -22,7 +22,6 @@ package v1beta1
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
......@@ -43,15 +42,11 @@ func init() {
}
func DeepCopy_v1beta1_LocalSubjectAccessReview(in LocalSubjectAccessReview, out *LocalSubjectAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := DeepCopy_v1beta1_SubjectAccessReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_v1beta1_SubjectAccessReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
out.Status = in.Status
return nil
}
......@@ -73,15 +68,11 @@ func DeepCopy_v1beta1_ResourceAttributes(in ResourceAttributes, out *ResourceAtt
}
func DeepCopy_v1beta1_SelfSubjectAccessReview(in SelfSubjectAccessReview, out *SelfSubjectAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := DeepCopy_v1beta1_SelfSubjectAccessReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_v1beta1_SubjectAccessReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
out.Status = in.Status
return nil
}
......@@ -89,18 +80,14 @@ func DeepCopy_v1beta1_SelfSubjectAccessReviewSpec(in SelfSubjectAccessReviewSpec
if in.ResourceAttributes != nil {
in, out := in.ResourceAttributes, &out.ResourceAttributes
*out = new(ResourceAttributes)
if err := DeepCopy_v1beta1_ResourceAttributes(*in, *out, c); err != nil {
return err
}
**out = *in
} else {
out.ResourceAttributes = nil
}
if in.NonResourceAttributes != nil {
in, out := in.NonResourceAttributes, &out.NonResourceAttributes
*out = new(NonResourceAttributes)
if err := DeepCopy_v1beta1_NonResourceAttributes(*in, *out, c); err != nil {
return err
}
**out = *in
} else {
out.NonResourceAttributes = nil
}
......@@ -108,15 +95,11 @@ func DeepCopy_v1beta1_SelfSubjectAccessReviewSpec(in SelfSubjectAccessReviewSpec
}
func DeepCopy_v1beta1_SubjectAccessReview(in SubjectAccessReview, out *SubjectAccessReview, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := DeepCopy_v1beta1_SubjectAccessReviewSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_v1beta1_SubjectAccessReviewStatus(in.Status, &out.Status, c); err != nil {
return err
}
out.Status = in.Status
return nil
}
......@@ -124,18 +107,14 @@ func DeepCopy_v1beta1_SubjectAccessReviewSpec(in SubjectAccessReviewSpec, out *S
if in.ResourceAttributes != nil {
in, out := in.ResourceAttributes, &out.ResourceAttributes
*out = new(ResourceAttributes)
if err := DeepCopy_v1beta1_ResourceAttributes(*in, *out, c); err != nil {
return err
}
**out = *in
} else {
out.ResourceAttributes = nil
}
if in.NonResourceAttributes != nil {
in, out := in.NonResourceAttributes, &out.NonResourceAttributes
*out = new(NonResourceAttributes)
if err := DeepCopy_v1beta1_NonResourceAttributes(*in, *out, c); err != nil {
return err
}
**out = *in
} else {
out.NonResourceAttributes = nil
}
......
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v1beta1
......@@ -50,9 +50,7 @@ func DeepCopy_autoscaling_CrossVersionObjectReference(in CrossVersionObjectRefer
}
func DeepCopy_autoscaling_HorizontalPodAutoscaler(in HorizontalPodAutoscaler, out *HorizontalPodAutoscaler, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -66,12 +64,8 @@ func DeepCopy_autoscaling_HorizontalPodAutoscaler(in HorizontalPodAutoscaler, ou
}
func DeepCopy_autoscaling_HorizontalPodAutoscalerList(in HorizontalPodAutoscalerList, out *HorizontalPodAutoscalerList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]HorizontalPodAutoscaler, len(in))
......@@ -87,9 +81,7 @@ func DeepCopy_autoscaling_HorizontalPodAutoscalerList(in HorizontalPodAutoscaler
}
func DeepCopy_autoscaling_HorizontalPodAutoscalerSpec(in HorizontalPodAutoscalerSpec, out *HorizontalPodAutoscalerSpec, c *conversion.Cloner) error {
if err := DeepCopy_autoscaling_CrossVersionObjectReference(in.ScaleTargetRef, &out.ScaleTargetRef, c); err != nil {
return err
}
out.ScaleTargetRef = in.ScaleTargetRef
if in.MinReplicas != nil {
in, out := in.MinReplicas, &out.MinReplicas
*out = new(int32)
......@@ -119,9 +111,7 @@ func DeepCopy_autoscaling_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscal
if in.LastScaleTime != nil {
in, out := in.LastScaleTime, &out.LastScaleTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
**out = in.DeepCopy()
} else {
out.LastScaleTime = nil
}
......@@ -138,18 +128,12 @@ func DeepCopy_autoscaling_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscal
}
func DeepCopy_autoscaling_Scale(in Scale, out *Scale, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_autoscaling_ScaleSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_autoscaling_ScaleStatus(in.Status, &out.Status, c); err != nil {
return err
}
out.Spec = in.Spec
out.Status = in.Status
return nil
}
......
/*
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.
*/
// +k8s:deepcopy-gen=package,register
package autoscaling
......@@ -51,9 +51,7 @@ func DeepCopy_v1_CrossVersionObjectReference(in CrossVersionObjectReference, out
}
func DeepCopy_v1_HorizontalPodAutoscaler(in HorizontalPodAutoscaler, out *HorizontalPodAutoscaler, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api_v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -67,12 +65,8 @@ func DeepCopy_v1_HorizontalPodAutoscaler(in HorizontalPodAutoscaler, out *Horizo
}
func DeepCopy_v1_HorizontalPodAutoscalerList(in HorizontalPodAutoscalerList, out *HorizontalPodAutoscalerList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]HorizontalPodAutoscaler, len(in))
......@@ -88,9 +82,7 @@ func DeepCopy_v1_HorizontalPodAutoscalerList(in HorizontalPodAutoscalerList, out
}
func DeepCopy_v1_HorizontalPodAutoscalerSpec(in HorizontalPodAutoscalerSpec, out *HorizontalPodAutoscalerSpec, c *conversion.Cloner) error {
if err := DeepCopy_v1_CrossVersionObjectReference(in.ScaleTargetRef, &out.ScaleTargetRef, c); err != nil {
return err
}
out.ScaleTargetRef = in.ScaleTargetRef
if in.MinReplicas != nil {
in, out := in.MinReplicas, &out.MinReplicas
*out = new(int32)
......@@ -120,9 +112,7 @@ func DeepCopy_v1_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscalerStatus,
if in.LastScaleTime != nil {
in, out := in.LastScaleTime, &out.LastScaleTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
**out = in.DeepCopy()
} else {
out.LastScaleTime = nil
}
......@@ -139,18 +129,12 @@ func DeepCopy_v1_HorizontalPodAutoscalerStatus(in HorizontalPodAutoscalerStatus,
}
func DeepCopy_v1_Scale(in Scale, out *Scale, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api_v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_v1_ScaleSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_v1_ScaleStatus(in.Status, &out.Status, c); err != nil {
return err
}
out.Spec = in.Spec
out.Status = in.Status
return nil
}
......
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v1
......@@ -46,9 +46,7 @@ func init() {
}
func DeepCopy_batch_Job(in Job, out *Job, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -64,24 +62,16 @@ func DeepCopy_batch_Job(in Job, out *Job, c *conversion.Cloner) error {
func DeepCopy_batch_JobCondition(in JobCondition, out *JobCondition, c *conversion.Cloner) error {
out.Type = in.Type
out.Status = in.Status
if err := unversioned.DeepCopy_unversioned_Time(in.LastProbeTime, &out.LastProbeTime, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastTransitionTime, &out.LastTransitionTime, c); err != nil {
return err
}
out.LastProbeTime = in.LastProbeTime.DeepCopy()
out.LastTransitionTime = in.LastTransitionTime.DeepCopy()
out.Reason = in.Reason
out.Message = in.Message
return nil
}
func DeepCopy_batch_JobList(in JobList, out *JobList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Job, len(in))
......@@ -155,18 +145,14 @@ func DeepCopy_batch_JobStatus(in JobStatus, out *JobStatus, c *conversion.Cloner
if in.StartTime != nil {
in, out := in.StartTime, &out.StartTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
**out = in.DeepCopy()
} else {
out.StartTime = nil
}
if in.CompletionTime != nil {
in, out := in.CompletionTime, &out.CompletionTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
**out = in.DeepCopy()
} else {
out.CompletionTime = nil
}
......@@ -177,9 +163,7 @@ func DeepCopy_batch_JobStatus(in JobStatus, out *JobStatus, c *conversion.Cloner
}
func DeepCopy_batch_JobTemplate(in JobTemplate, out *JobTemplate, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -200,9 +184,7 @@ func DeepCopy_batch_JobTemplateSpec(in JobTemplateSpec, out *JobTemplateSpec, c
}
func DeepCopy_batch_ScheduledJob(in ScheduledJob, out *ScheduledJob, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -216,12 +198,8 @@ func DeepCopy_batch_ScheduledJob(in ScheduledJob, out *ScheduledJob, c *conversi
}
func DeepCopy_batch_ScheduledJobList(in ScheduledJobList, out *ScheduledJobList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ScheduledJob, len(in))
......@@ -264,9 +242,7 @@ func DeepCopy_batch_ScheduledJobStatus(in ScheduledJobStatus, out *ScheduledJobS
in, out := in.Active, &out.Active
*out = make([]api.ObjectReference, len(in))
for i := range in {
if err := api.DeepCopy_api_ObjectReference(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.Active = nil
......@@ -274,9 +250,7 @@ func DeepCopy_batch_ScheduledJobStatus(in ScheduledJobStatus, out *ScheduledJobS
if in.LastScheduleTime != nil {
in, out := in.LastScheduleTime, &out.LastScheduleTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
**out = in.DeepCopy()
} else {
out.LastScheduleTime = nil
}
......
/*
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.
*/
// +k8s:deepcopy-gen=package,register
package batch
......@@ -43,9 +43,7 @@ func init() {
}
func DeepCopy_v1_Job(in Job, out *Job, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api_v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -61,24 +59,16 @@ func DeepCopy_v1_Job(in Job, out *Job, c *conversion.Cloner) error {
func DeepCopy_v1_JobCondition(in JobCondition, out *JobCondition, c *conversion.Cloner) error {
out.Type = in.Type
out.Status = in.Status
if err := unversioned.DeepCopy_unversioned_Time(in.LastProbeTime, &out.LastProbeTime, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastTransitionTime, &out.LastTransitionTime, c); err != nil {
return err
}
out.LastProbeTime = in.LastProbeTime.DeepCopy()
out.LastTransitionTime = in.LastTransitionTime.DeepCopy()
out.Reason = in.Reason
out.Message = in.Message
return nil
}
func DeepCopy_v1_JobList(in JobList, out *JobList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Job, len(in))
......@@ -152,18 +142,14 @@ func DeepCopy_v1_JobStatus(in JobStatus, out *JobStatus, c *conversion.Cloner) e
if in.StartTime != nil {
in, out := in.StartTime, &out.StartTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
**out = in.DeepCopy()
} else {
out.StartTime = nil
}
if in.CompletionTime != nil {
in, out := in.CompletionTime, &out.CompletionTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
**out = in.DeepCopy()
} else {
out.CompletionTime = nil
}
......
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v1
......@@ -49,9 +49,7 @@ func init() {
}
func DeepCopy_v2alpha1_Job(in Job, out *Job, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -67,24 +65,16 @@ func DeepCopy_v2alpha1_Job(in Job, out *Job, c *conversion.Cloner) error {
func DeepCopy_v2alpha1_JobCondition(in JobCondition, out *JobCondition, c *conversion.Cloner) error {
out.Type = in.Type
out.Status = in.Status
if err := unversioned.DeepCopy_unversioned_Time(in.LastProbeTime, &out.LastProbeTime, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Time(in.LastTransitionTime, &out.LastTransitionTime, c); err != nil {
return err
}
out.LastProbeTime = in.LastProbeTime.DeepCopy()
out.LastTransitionTime = in.LastTransitionTime.DeepCopy()
out.Reason = in.Reason
out.Message = in.Message
return nil
}
func DeepCopy_v2alpha1_JobList(in JobList, out *JobList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Job, len(in))
......@@ -158,18 +148,14 @@ func DeepCopy_v2alpha1_JobStatus(in JobStatus, out *JobStatus, c *conversion.Clo
if in.StartTime != nil {
in, out := in.StartTime, &out.StartTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
**out = in.DeepCopy()
} else {
out.StartTime = nil
}
if in.CompletionTime != nil {
in, out := in.CompletionTime, &out.CompletionTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
**out = in.DeepCopy()
} else {
out.CompletionTime = nil
}
......@@ -180,9 +166,7 @@ func DeepCopy_v2alpha1_JobStatus(in JobStatus, out *JobStatus, c *conversion.Clo
}
func DeepCopy_v2alpha1_JobTemplate(in JobTemplate, out *JobTemplate, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -240,9 +224,7 @@ func DeepCopy_v2alpha1_LabelSelectorRequirement(in LabelSelectorRequirement, out
}
func DeepCopy_v2alpha1_ScheduledJob(in ScheduledJob, out *ScheduledJob, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -256,12 +238,8 @@ func DeepCopy_v2alpha1_ScheduledJob(in ScheduledJob, out *ScheduledJob, c *conve
}
func DeepCopy_v2alpha1_ScheduledJobList(in ScheduledJobList, out *ScheduledJobList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ScheduledJob, len(in))
......@@ -304,9 +282,7 @@ func DeepCopy_v2alpha1_ScheduledJobStatus(in ScheduledJobStatus, out *ScheduledJ
in, out := in.Active, &out.Active
*out = make([]v1.ObjectReference, len(in))
for i := range in {
if err := v1.DeepCopy_v1_ObjectReference(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.Active = nil
......@@ -314,9 +290,7 @@ func DeepCopy_v2alpha1_ScheduledJobStatus(in ScheduledJobStatus, out *ScheduledJ
if in.LastScheduleTime != nil {
in, out := in.LastScheduleTime, &out.LastScheduleTime
*out = new(unversioned.Time)
if err := unversioned.DeepCopy_unversioned_Time(*in, *out, c); err != nil {
return err
}
**out = in.DeepCopy()
} else {
out.LastScheduleTime = nil
}
......
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v2alpha1
......@@ -22,7 +22,6 @@ package certificates
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
......@@ -40,9 +39,7 @@ func init() {
}
func DeepCopy_certificates_CertificateSigningRequest(in CertificateSigningRequest, out *CertificateSigningRequest, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -59,19 +56,13 @@ func DeepCopy_certificates_CertificateSigningRequestCondition(in CertificateSign
out.Type = in.Type
out.Reason = in.Reason
out.Message = in.Message
if err := unversioned.DeepCopy_unversioned_Time(in.LastUpdateTime, &out.LastUpdateTime, c); err != nil {
return err
}
out.LastUpdateTime = in.LastUpdateTime.DeepCopy()
return nil
}
func DeepCopy_certificates_CertificateSigningRequestList(in CertificateSigningRequestList, out *CertificateSigningRequestList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]CertificateSigningRequest, len(in))
......
/*
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.
*/
// +k8s:deepcopy-gen=package,register
package certificates
......@@ -21,7 +21,8 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
)
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// Describes a certificate signing request
type CertificateSigningRequest struct {
......
......@@ -22,7 +22,6 @@ package v1alpha1
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
)
......@@ -41,9 +40,7 @@ func init() {
}
func DeepCopy_v1alpha1_CertificateSigningRequest(in CertificateSigningRequest, out *CertificateSigningRequest, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -60,19 +57,13 @@ func DeepCopy_v1alpha1_CertificateSigningRequestCondition(in CertificateSigningR
out.Type = in.Type
out.Reason = in.Reason
out.Message = in.Message
if err := unversioned.DeepCopy_unversioned_Time(in.LastUpdateTime, &out.LastUpdateTime, c); err != nil {
return err
}
out.LastUpdateTime = in.LastUpdateTime.DeepCopy()
return nil
}
func DeepCopy_v1alpha1_CertificateSigningRequestList(in CertificateSigningRequestList, out *CertificateSigningRequestList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]CertificateSigningRequest, len(in))
......
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v1alpha1
......@@ -21,7 +21,8 @@ import (
"k8s.io/kubernetes/pkg/api/v1"
)
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// Describes a certificate signing request
type CertificateSigningRequest struct {
......
/*
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.
*/
// +k8s:deepcopy-gen=package,register
package componentconfig
......@@ -22,7 +22,6 @@ package v1alpha1
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
......@@ -38,9 +37,7 @@ func init() {
}
func DeepCopy_v1alpha1_KubeProxyConfiguration(in KubeProxyConfiguration, out *KubeProxyConfiguration, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.BindAddress = in.BindAddress
out.ClusterCIDR = in.ClusterCIDR
out.HealthzBindAddress = in.HealthzBindAddress
......@@ -53,9 +50,7 @@ func DeepCopy_v1alpha1_KubeProxyConfiguration(in KubeProxyConfiguration, out *Ku
} else {
out.IPTablesMasqueradeBit = nil
}
if err := unversioned.DeepCopy_unversioned_Duration(in.IPTablesSyncPeriod, &out.IPTablesSyncPeriod, c); err != nil {
return err
}
out.IPTablesSyncPeriod = in.IPTablesSyncPeriod
out.KubeconfigPath = in.KubeconfigPath
out.MasqueradeAll = in.MasqueradeAll
out.Master = in.Master
......@@ -69,20 +64,14 @@ func DeepCopy_v1alpha1_KubeProxyConfiguration(in KubeProxyConfiguration, out *Ku
out.Mode = in.Mode
out.PortRange = in.PortRange
out.ResourceContainer = in.ResourceContainer
if err := unversioned.DeepCopy_unversioned_Duration(in.UDPIdleTimeout, &out.UDPIdleTimeout, c); err != nil {
return err
}
out.UDPIdleTimeout = in.UDPIdleTimeout
out.ConntrackMax = in.ConntrackMax
if err := unversioned.DeepCopy_unversioned_Duration(in.ConntrackTCPEstablishedTimeout, &out.ConntrackTCPEstablishedTimeout, c); err != nil {
return err
}
out.ConntrackTCPEstablishedTimeout = in.ConntrackTCPEstablishedTimeout
return nil
}
func DeepCopy_v1alpha1_KubeSchedulerConfiguration(in KubeSchedulerConfiguration, out *KubeSchedulerConfiguration, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.Port = in.Port
out.Address = in.Address
out.AlgorithmProvider = in.AlgorithmProvider
......@@ -114,14 +103,8 @@ func DeepCopy_v1alpha1_LeaderElectionConfiguration(in LeaderElectionConfiguratio
} else {
out.LeaderElect = nil
}
if err := unversioned.DeepCopy_unversioned_Duration(in.LeaseDuration, &out.LeaseDuration, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Duration(in.RenewDeadline, &out.RenewDeadline, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_Duration(in.RetryPeriod, &out.RetryPeriod, c); err != nil {
return err
}
out.LeaseDuration = in.LeaseDuration
out.RenewDeadline = in.RenewDeadline
out.RetryPeriod = in.RetryPeriod
return nil
}
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v1alpha1
/*
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.
*/
// +k8s:deepcopy-gen=package,register
package extensions
......@@ -51,7 +51,8 @@ type ScaleStatus struct {
Selector *unversioned.LabelSelector `json:"selector,omitempty"`
}
// +genclient=true,noMethods=true
// +genclient=true
// +noMethods=true
// represents a scaling request for a resource.
type Scale struct {
......@@ -94,7 +95,8 @@ type CustomMetricCurrentStatusList struct {
Items []CustomMetricCurrentStatus `json:"items"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource
// types to the API. It consists of one or more Versions of the api.
......@@ -624,7 +626,8 @@ type ReplicaSetStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// PodSecurityPolicy governs the ability to make requests that affect the SecurityContext
// that will be applied to a pod and container.
......
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v1beta1
......@@ -46,7 +46,8 @@ type ScaleStatus struct {
TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
}
// +genclient=true,noMethods=true
// +genclient=true
// +noMethods=true
// represents a scaling request for a resource.
type Scale struct {
......@@ -166,7 +167,8 @@ type HorizontalPodAutoscalerList struct {
Items []HorizontalPodAutoscaler `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource
// types to the API. It consists of one or more Versions of the api.
......@@ -912,7 +914,8 @@ type ReplicaSetStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// Pod Security Policy governs the ability to make requests that affect the Security Context
// that will be applied to a pod and container.
......
......@@ -24,7 +24,6 @@ import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
intstr "k8s.io/kubernetes/pkg/util/intstr"
)
func init() {
......@@ -40,28 +39,20 @@ func init() {
}
func DeepCopy_policy_PodDisruptionBudget(in PodDisruptionBudget, out *PodDisruptionBudget, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_policy_PodDisruptionBudgetSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_policy_PodDisruptionBudgetStatus(in.Status, &out.Status, c); err != nil {
return err
}
out.Status = in.Status
return nil
}
func DeepCopy_policy_PodDisruptionBudgetList(in PodDisruptionBudgetList, out *PodDisruptionBudgetList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]PodDisruptionBudget, len(in))
......@@ -77,9 +68,7 @@ func DeepCopy_policy_PodDisruptionBudgetList(in PodDisruptionBudgetList, out *Po
}
func DeepCopy_policy_PodDisruptionBudgetSpec(in PodDisruptionBudgetSpec, out *PodDisruptionBudgetSpec, c *conversion.Cloner) error {
if err := intstr.DeepCopy_intstr_IntOrString(in.MinAvailable, &out.MinAvailable, c); err != nil {
return err
}
out.MinAvailable = in.MinAvailable
if in.Selector != nil {
in, out := in.Selector, &out.Selector
*out = new(unversioned.LabelSelector)
......
/*
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.
*/
// +k8s:deepcopy-gen=package,register
package policy
......@@ -49,7 +49,8 @@ type PodDisruptionBudgetStatus struct {
ExpectedPods int32 `json:"expectedPods"`
}
// +genclient=true,noMethods=true
// +genclient=true
// +noMethods=true
// PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods
type PodDisruptionBudget struct {
......
......@@ -25,7 +25,6 @@ import (
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
intstr "k8s.io/kubernetes/pkg/util/intstr"
)
func init() {
......@@ -41,28 +40,20 @@ func init() {
}
func DeepCopy_v1alpha1_PodDisruptionBudget(in PodDisruptionBudget, out *PodDisruptionBudget, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_v1alpha1_PodDisruptionBudgetSpec(in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_v1alpha1_PodDisruptionBudgetStatus(in.Status, &out.Status, c); err != nil {
return err
}
out.Status = in.Status
return nil
}
func DeepCopy_v1alpha1_PodDisruptionBudgetList(in PodDisruptionBudgetList, out *PodDisruptionBudgetList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]PodDisruptionBudget, len(in))
......@@ -78,9 +69,7 @@ func DeepCopy_v1alpha1_PodDisruptionBudgetList(in PodDisruptionBudgetList, out *
}
func DeepCopy_v1alpha1_PodDisruptionBudgetSpec(in PodDisruptionBudgetSpec, out *PodDisruptionBudgetSpec, c *conversion.Cloner) error {
if err := intstr.DeepCopy_intstr_IntOrString(in.MinAvailable, &out.MinAvailable, c); err != nil {
return err
}
out.MinAvailable = in.MinAvailable
if in.Selector != nil {
in, out := in.Selector, &out.Selector
*out = new(unversioned.LabelSelector)
......
......@@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +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,
// NetworkPolicy, etc.
......
......@@ -50,7 +50,8 @@ type PodDisruptionBudgetStatus struct {
ExpectedPods int32 `json:"expectedPods" protobuf:"varint,4,opt,name=expectedPods"`
}
// +genclient=true,noMethods=true
// +genclient=true
// +noMethods=true
// PodDisruptionBudget is an object to define the max disruption that can be caused to a collection of pods
type PodDisruptionBudget struct {
......
......@@ -22,7 +22,6 @@ package rbac
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
)
......@@ -46,9 +45,7 @@ func init() {
}
func DeepCopy_rbac_ClusterRole(in ClusterRole, out *ClusterRole, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -67,9 +64,7 @@ func DeepCopy_rbac_ClusterRole(in ClusterRole, out *ClusterRole, c *conversion.C
}
func DeepCopy_rbac_ClusterRoleBinding(in ClusterRoleBinding, out *ClusterRoleBinding, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -77,26 +72,18 @@ func DeepCopy_rbac_ClusterRoleBinding(in ClusterRoleBinding, out *ClusterRoleBin
in, out := in.Subjects, &out.Subjects
*out = make([]Subject, len(in))
for i := range in {
if err := DeepCopy_rbac_Subject(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.Subjects = nil
}
if err := api.DeepCopy_api_ObjectReference(in.RoleRef, &out.RoleRef, c); err != nil {
return err
}
out.RoleRef = in.RoleRef
return nil
}
func DeepCopy_rbac_ClusterRoleBindingList(in ClusterRoleBindingList, out *ClusterRoleBindingList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ClusterRoleBinding, len(in))
......@@ -112,12 +99,8 @@ func DeepCopy_rbac_ClusterRoleBindingList(in ClusterRoleBindingList, out *Cluste
}
func DeepCopy_rbac_ClusterRoleList(in ClusterRoleList, out *ClusterRoleList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ClusterRole, len(in))
......@@ -179,9 +162,7 @@ func DeepCopy_rbac_PolicyRule(in PolicyRule, out *PolicyRule, c *conversion.Clon
}
func DeepCopy_rbac_Role(in Role, out *Role, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -200,9 +181,7 @@ func DeepCopy_rbac_Role(in Role, out *Role, c *conversion.Cloner) error {
}
func DeepCopy_rbac_RoleBinding(in RoleBinding, out *RoleBinding, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -210,26 +189,18 @@ func DeepCopy_rbac_RoleBinding(in RoleBinding, out *RoleBinding, c *conversion.C
in, out := in.Subjects, &out.Subjects
*out = make([]Subject, len(in))
for i := range in {
if err := DeepCopy_rbac_Subject(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.Subjects = nil
}
if err := api.DeepCopy_api_ObjectReference(in.RoleRef, &out.RoleRef, c); err != nil {
return err
}
out.RoleRef = in.RoleRef
return nil
}
func DeepCopy_rbac_RoleBindingList(in RoleBindingList, out *RoleBindingList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]RoleBinding, len(in))
......@@ -245,12 +216,8 @@ func DeepCopy_rbac_RoleBindingList(in RoleBindingList, out *RoleBindingList, c *
}
func DeepCopy_rbac_RoleList(in RoleList, out *RoleList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Role, len(in))
......
......@@ -14,5 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +groupName=rbac.authorization.k8s.io
package rbac
......@@ -126,7 +126,8 @@ type RoleList struct {
Items []Role
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.
type ClusterRole struct {
......@@ -138,7 +139,8 @@ type ClusterRole struct {
Rules []PolicyRule
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace,
// and adds who information via Subject.
......
......@@ -22,7 +22,6 @@ package v1alpha1
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
......@@ -47,9 +46,7 @@ func init() {
}
func DeepCopy_v1alpha1_ClusterRole(in ClusterRole, out *ClusterRole, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -68,9 +65,7 @@ func DeepCopy_v1alpha1_ClusterRole(in ClusterRole, out *ClusterRole, c *conversi
}
func DeepCopy_v1alpha1_ClusterRoleBinding(in ClusterRoleBinding, out *ClusterRoleBinding, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -78,26 +73,18 @@ func DeepCopy_v1alpha1_ClusterRoleBinding(in ClusterRoleBinding, out *ClusterRol
in, out := in.Subjects, &out.Subjects
*out = make([]Subject, len(in))
for i := range in {
if err := DeepCopy_v1alpha1_Subject(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.Subjects = nil
}
if err := v1.DeepCopy_v1_ObjectReference(in.RoleRef, &out.RoleRef, c); err != nil {
return err
}
out.RoleRef = in.RoleRef
return nil
}
func DeepCopy_v1alpha1_ClusterRoleBindingList(in ClusterRoleBindingList, out *ClusterRoleBindingList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ClusterRoleBinding, len(in))
......@@ -113,12 +100,8 @@ func DeepCopy_v1alpha1_ClusterRoleBindingList(in ClusterRoleBindingList, out *Cl
}
func DeepCopy_v1alpha1_ClusterRoleList(in ClusterRoleList, out *ClusterRoleList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]ClusterRole, len(in))
......@@ -176,9 +159,7 @@ func DeepCopy_v1alpha1_PolicyRule(in PolicyRule, out *PolicyRule, c *conversion.
}
func DeepCopy_v1alpha1_Role(in Role, out *Role, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -197,9 +178,7 @@ func DeepCopy_v1alpha1_Role(in Role, out *Role, c *conversion.Cloner) error {
}
func DeepCopy_v1alpha1_RoleBinding(in RoleBinding, out *RoleBinding, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
......@@ -207,26 +186,18 @@ func DeepCopy_v1alpha1_RoleBinding(in RoleBinding, out *RoleBinding, c *conversi
in, out := in.Subjects, &out.Subjects
*out = make([]Subject, len(in))
for i := range in {
if err := DeepCopy_v1alpha1_Subject(in[i], &(*out)[i], c); err != nil {
return err
}
(*out)[i] = in[i]
}
} else {
out.Subjects = nil
}
if err := v1.DeepCopy_v1_ObjectReference(in.RoleRef, &out.RoleRef, c); err != nil {
return err
}
out.RoleRef = in.RoleRef
return nil
}
func DeepCopy_v1alpha1_RoleBindingList(in RoleBindingList, out *RoleBindingList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]RoleBinding, len(in))
......@@ -242,12 +213,8 @@ func DeepCopy_v1alpha1_RoleBindingList(in RoleBindingList, out *RoleBindingList,
}
func DeepCopy_v1alpha1_RoleList(in RoleList, out *RoleList, c *conversion.Cloner) error {
if err := unversioned.DeepCopy_unversioned_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
if err := unversioned.DeepCopy_unversioned_ListMeta(in.ListMeta, &out.ListMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := in.Items, &out.Items
*out = make([]Role, len(in))
......
......@@ -15,5 +15,7 @@ limitations under the License.
*/
// +groupName=rbac.authorization.k8s.io
// +k8s:deepcopy-gen=package,register
// +genconversion=true
package v1alpha1
......@@ -113,7 +113,8 @@ type RoleList struct {
Items []Role `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// ClusterRole is a cluster level, logical grouping of PolicyRules that can be referenced as a unit by a RoleBinding or ClusterRoleBinding.
type ClusterRole struct {
......@@ -125,7 +126,8 @@ type ClusterRole struct {
Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"`
}
// +genclient=true,nonNamespaced=true
// +genclient=true
// +nonNamespaced=true
// ClusterRoleBinding references a ClusterRole, but not contain it. It can reference a ClusterRole in the global namespace,
// and adds who information via Subject.
......
......@@ -49,9 +49,7 @@ func DeepCopy_runtime_TypeMeta(in TypeMeta, out *TypeMeta, c *conversion.Cloner)
}
func DeepCopy_runtime_Unknown(in Unknown, out *Unknown, c *conversion.Cloner) error {
if err := DeepCopy_runtime_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
out.TypeMeta = in.TypeMeta
if in.Raw != nil {
in, out := in.Raw, &out.Raw
*out = make([]byte, len(in))
......
......@@ -41,4 +41,5 @@ limitations under the License.
//
// As a bonus, a few common types useful from all api objects and versions
// are provided in types.go.
package runtime
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment