From 7922356c62be363bc9f44f4b0db1870c3b655376 Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Sat, 11 Jan 2020 14:06:46 -0500 Subject: [PATCH] Update apimachinery --- go.sum | 2 ++ pkg/client/clientset_generated/clientset/clientset.go | 7 +++++++ .../clientset_generated/internalclientset/clientset.go | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/go.sum b/go.sum index 9ba981873c..fe8504084c 100644 --- a/go.sum +++ b/go.sum @@ -667,12 +667,14 @@ k8s.io/client-go v0.0.0-20191114101535-6c5935290e33 h1:07mhG/2oEoo3N+sHVOo0L9PJ/ k8s.io/client-go v0.0.0-20191114101535-6c5935290e33/go.mod h1:4L/zQOBkEf4pArQJ+CMk1/5xjA30B5oyWv+Bzb44DOw= k8s.io/cloud-provider v0.0.0-20191114112024-4bbba8331835 h1:5Xeh0moKQ8ULGL/s14SFwPZMoBtREvMBbkrQyAfSA2M= k8s.io/cloud-provider v0.0.0-20191114112024-4bbba8331835/go.mod h1:pYZm7Z5Trmx0WweqTbclJxEeGCCXUBUjixLa8IXoo6I= +k8s.io/code-generator v0.0.0-20191004115455-8e001e5d1894 h1:NMYlxaF7rYQJk2E2IyrUhaX81zX24+dmoZdkPw0gJqI= k8s.io/code-generator v0.0.0-20191004115455-8e001e5d1894/go.mod h1:mJUgkl06XV4kstAnLHAIzJPVCOzVR+ZcfPIv4fUsFCY= k8s.io/component-base v0.0.0-20191204084121-18d14e17701e h1:M4Lg+2QUB2ok9Jif6Z32L5q8q4D8hioeLiAYOsUma6I= k8s.io/component-base v0.0.0-20191204084121-18d14e17701e/go.mod h1:2Co4s3DB4+jSYO9bcPaHTrK2n8JVC4/Q1PgPEfCwUO4= k8s.io/csi-translation-lib v0.0.0-20191114112310-0da609c4ca2d h1:wIFtZZ2eTgdzKBGox8o/Wqbiu+xYxkLaxPkFWkMDIH4= k8s.io/csi-translation-lib v0.0.0-20191114112310-0da609c4ca2d/go.mod h1:riElKBGzYzpYyINM3HozPTu1pscTbTdYW0N3Tg/U2ts= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/gengo v0.0.0-20190822140433-26a664648505 h1:ZY6yclUKVbZ+SdWnkfY+Je5vrMpKOxmGeKRbsXVmqYM= k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/helm v2.9.0+incompatible h1:3EFDJoqKSUe1BpC9qP+YaHi2Oua9hFT+C24/LhX2G1g= k8s.io/helm v2.9.0+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI= diff --git a/pkg/client/clientset_generated/clientset/clientset.go b/pkg/client/clientset_generated/clientset/clientset.go index 9520c2ada3..e63ebf702e 100644 --- a/pkg/client/clientset_generated/clientset/clientset.go +++ b/pkg/client/clientset_generated/clientset/clientset.go @@ -19,6 +19,8 @@ limitations under the License. package clientset import ( + "fmt" + discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -67,9 +69,14 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { } // NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. func NewForConfig(c *rest.Config) (*Clientset, error) { configShallowCopy := *c if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) } var cs Clientset diff --git a/pkg/client/clientset_generated/internalclientset/clientset.go b/pkg/client/clientset_generated/internalclientset/clientset.go index 18d8e546b4..51ff675217 100644 --- a/pkg/client/clientset_generated/internalclientset/clientset.go +++ b/pkg/client/clientset_generated/internalclientset/clientset.go @@ -19,6 +19,8 @@ limitations under the License. package internalclientset import ( + "fmt" + discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -67,9 +69,14 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { } // NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. func NewForConfig(c *rest.Config) (*Clientset, error) { configShallowCopy := *c if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) } var cs Clientset