From 8efa7259b89872846f775fd833636a8585aa2496 Mon Sep 17 00:00:00 2001 From: Mikkel Oscar Lyderik Larsen Date: Wed, 8 May 2019 20:59:40 +0200 Subject: [PATCH] Update code generation to be more robust Signed-off-by: Mikkel Oscar Lyderik Larsen --- go.mod | 1 + go.sum | 2 ++ hack/update-codegen.sh | 13 +++++++++++++ pkg/client/clientset/versioned/clientset.go | 8 ++++++++ .../clientset/versioned/fake/clientset_generated.go | 5 +++++ 5 files changed, 29 insertions(+) diff --git a/go.mod b/go.mod index 3ab756e..3deb07f 100644 --- a/go.mod +++ b/go.mod @@ -27,6 +27,7 @@ require ( github.com/stretchr/testify v1.2.2 golang.org/x/net v0.0.0-20190311183353-d8887717615a // indirect golang.org/x/oauth2 v0.0.0-20190115181402-5dab4167f31c // indirect + golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 // indirect gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect gopkg.in/alecthomas/kingpin.v2 v2.2.6 diff --git a/go.sum b/go.sum index dc8ccfd..63293c8 100644 --- a/go.sum +++ b/go.sum @@ -64,6 +64,8 @@ golang.org/x/oauth2 v0.0.0-20190115181402-5dab4167f31c h1:pcBdqVcrlT+A3i+tWsOROF golang.org/x/oauth2 v0.0.0-20190115181402-5dab4167f31c/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 5e6cb61..b7e9255 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -25,6 +25,19 @@ CUSTOM_RESOURCE_VERSION="v1" SCRIPT_ROOT="$(dirname "${BASH_SOURCE[0]}")/.." +# special setup for go modules +CODE_GEN_K8S_VERSION="c2090bec4d9b1fb25de3812f868accc2bc9ecbae" # 1.13.5 (https://github.com/kubernetes/code-generator/releases/tag/kubernetes-1.13.5) +packages=( +defaulter-gen +client-gen +lister-gen +informer-gen +deepcopy-gen +) +mkdir -p build +for pkg in "${packages[@]}"; do + go get "k8s.io/code-generator/cmd/${pkg}@${CODE_GEN_K8S_VERSION}" +done # use vendor/ as a temporary stash for code-generator. rm -rf "${SCRIPT_ROOT}/vendor/k8s.io/code-generator" rm -rf "${SCRIPT_ROOT}/vendor/k8s.io/gengo" diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 9458e20..9aebdac 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -28,6 +28,8 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface AmazonawsV1() amazonawsv1.AmazonawsV1Interface + // Deprecated: please explicitly pick a version if possible. + Amazonaws() amazonawsv1.AmazonawsV1Interface } // Clientset contains the clients for groups. Each group has exactly one @@ -42,6 +44,12 @@ func (c *Clientset) AmazonawsV1() amazonawsv1.AmazonawsV1Interface { return c.amazonawsV1 } +// Deprecated: Amazonaws retrieves the default version of AmazonawsClient. +// Please explicitly pick a version. +func (c *Clientset) Amazonaws() amazonawsv1.AmazonawsV1Interface { + return c.amazonawsV1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 41ed06d..28ee905 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -75,3 +75,8 @@ var _ clientset.Interface = &Clientset{} func (c *Clientset) AmazonawsV1() amazonawsv1.AmazonawsV1Interface { return &fakeamazonawsv1.FakeAmazonawsV1{Fake: &c.Fake} } + +// Amazonaws retrieves the AmazonawsV1Client +func (c *Clientset) Amazonaws() amazonawsv1.AmazonawsV1Interface { + return &fakeamazonawsv1.FakeAmazonawsV1{Fake: &c.Fake} +}