Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Exapose the rateLimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
cwdsuzhou committed Jun 30, 2020
1 parent a9d7108 commit e931152
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion internal/commands/root/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func installFlags(flags *pflag.FlagSet, c *opts.Opts) {
"kubeAPIQPS is the QPS to use while talking with kubernetes apiserver")
flags.Int32Var(&c.KubeAPIBurst, "kube-api-burst", c.KubeAPIBurst,
"kubeAPIBurst is the burst to allow while talking with kubernetes apiserver")

flagset := flag.NewFlagSet("klog", flag.PanicOnError)
klog.InitFlags(flagset)
flagset.VisitAll(func(f *flag.Flag) {
Expand Down
1 change: 1 addition & 0 deletions internal/commands/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ func runRootCommandWithProviderAndClient(ctx context.Context, pInit provider.Ini
SecretInformer: secretInformer,
ConfigMapInformer: configMapInformer,
ServiceInformer: serviceInformer,
RateLimiter: c.RateLimiter,
})
if err != nil {
return errors.Wrap(err, "error setting up pod controller")
Expand Down
4 changes: 4 additions & 0 deletions opts/opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/mitchellh/go-homedir"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/util/workqueue"
)

// Defaults for root command options
Expand Down Expand Up @@ -93,6 +94,8 @@ type Opts struct {
KubeAPIQPS int32
// KubeAPIBurst is the burst to allow while talking with kubernetes apiserver
KubeAPIBurst int32
// RateLimiter defines the rate limit of work queue
RateLimiter workqueue.RateLimiter

Version string
}
Expand Down Expand Up @@ -147,6 +150,7 @@ func setDefaults(o *Opts) {
o.KubeClusterDomain = DefaultKubeClusterDomain
o.StreamIdleTimeout = DefaultStreamIdleTimeout
o.StreamCreationTimeout = DefaultStreamCreationTimeout
o.RateLimiter = workqueue.DefaultControllerRateLimiter()
}

func getEnv(key, defaultValue string) string {
Expand Down

0 comments on commit e931152

Please sign in to comment.