From 52ab7b61fb3359d8b2bc26b292c63ae1088a192c Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Sat, 1 Feb 2020 22:07:43 -0700 Subject: [PATCH 1/2] Move ratelimit to wrangler --- pkg/ratelimit/none.go | 19 ------------------- restwatch/rest.go | 2 +- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 pkg/ratelimit/none.go diff --git a/pkg/ratelimit/none.go b/pkg/ratelimit/none.go deleted file mode 100644 index e952e2ae5..000000000 --- a/pkg/ratelimit/none.go +++ /dev/null @@ -1,19 +0,0 @@ -package ratelimit - -import ( - "context" - - "k8s.io/client-go/util/flowcontrol" -) - -var ( - None = flowcontrol.RateLimiter((*none)(nil)) -) - -type none struct{} - -func (*none) TryAccept() bool { return true } -func (*none) Stop() {} -func (*none) Accept() {} -func (*none) QPS() float32 { return 1 } -func (*none) Wait(_ context.Context) error { return nil } diff --git a/restwatch/rest.go b/restwatch/rest.go index b02bf36f3..4442d517e 100644 --- a/restwatch/rest.go +++ b/restwatch/rest.go @@ -3,7 +3,7 @@ package restwatch import ( "time" - "github.com/rancher/norman/pkg/ratelimit" + "github.com/rancher/wrangler/pkg/ratelimit" "k8s.io/client-go/rest" ) From 57e6592090a47aa5845d4e0b6c49ca93a2445460 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Sat, 1 Feb 2020 22:12:12 -0700 Subject: [PATCH 2/2] Update vendor --- go.mod | 2 +- go.sum | 4 ++-- .../rancher/wrangler/pkg/ratelimit/none.go | 19 +++++++++++++++++++ vendor/modules.txt | 3 ++- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 vendor/github.com/rancher/wrangler/pkg/ratelimit/none.go diff --git a/go.mod b/go.mod index 4e875dc74..2211c17db 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd github.com/pkg/errors v0.8.1 github.com/prometheus/client_golang v1.4.0 - github.com/rancher/wrangler v0.4.0 + github.com/rancher/wrangler v0.4.1 github.com/sirupsen/logrus v1.4.2 github.com/stretchr/testify v1.4.0 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e diff --git a/go.sum b/go.sum index 3b0f36dab..37522fe6b 100644 --- a/go.sum +++ b/go.sum @@ -270,8 +270,8 @@ github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLk github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009 h1:Xsxh7fX3+2wAUJtPy8g2lZh0cYuyifqhBL0vxCIYojs= github.com/rancher/moq v0.0.0-20190404221404-ee5226d43009/go.mod h1:wpITyDPTi/Na5h73XkbuEf2AP9fbgrIGqqxVzFhYD6U= -github.com/rancher/wrangler v0.4.0 h1:iLvuJcZkd38E3RGG74dFMMNEju0PeTzfT1PQiv5okVU= -github.com/rancher/wrangler v0.4.0/go.mod h1:1cR91WLhZgkZ+U4fV9nVuXqKurWbgXcIReU4wnQvTN8= +github.com/rancher/wrangler v0.4.1 h1:kQLE6syPbX4ciwU4OF+EHIPT9zj6r6pyN83u9Gsv5eg= +github.com/rancher/wrangler v0.4.1/go.mod h1:1cR91WLhZgkZ+U4fV9nVuXqKurWbgXcIReU4wnQvTN8= github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= diff --git a/vendor/github.com/rancher/wrangler/pkg/ratelimit/none.go b/vendor/github.com/rancher/wrangler/pkg/ratelimit/none.go new file mode 100644 index 000000000..e952e2ae5 --- /dev/null +++ b/vendor/github.com/rancher/wrangler/pkg/ratelimit/none.go @@ -0,0 +1,19 @@ +package ratelimit + +import ( + "context" + + "k8s.io/client-go/util/flowcontrol" +) + +var ( + None = flowcontrol.RateLimiter((*none)(nil)) +) + +type none struct{} + +func (*none) TryAccept() bool { return true } +func (*none) Stop() {} +func (*none) Accept() {} +func (*none) QPS() float32 { return 1 } +func (*none) Wait(_ context.Context) error { return nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index 6359a130f..8a277490f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -65,8 +65,9 @@ github.com/prometheus/common/model github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util -# github.com/rancher/wrangler v0.4.0 +# github.com/rancher/wrangler v0.4.1 github.com/rancher/wrangler/pkg/name +github.com/rancher/wrangler/pkg/ratelimit # github.com/sirupsen/logrus v1.4.2 github.com/sirupsen/logrus # github.com/spf13/pflag v1.0.5