Skip to content

Commit 9d626eb

Browse files
authored
Increase qps and burst limits (#435)
1 parent 5c6713f commit 9d626eb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

backup.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ func NewCmdBackup() *cobra.Command {
2727
ScratchDir: "/tmp",
2828
PodLabelsPath: "/etc/stash/labels",
2929
DockerRegistry: docker.ACRegistry,
30+
QPS: 100,
31+
Burst: 100,
3032
ResyncPeriod: 5 * time.Minute,
3133
MaxNumRequeues: 5,
3234
NumThreads: 1,
@@ -111,6 +113,8 @@ func NewCmdBackup() *cobra.Command {
111113
cmd.Flags().StringVar(&opt.ResticName, "restic-name", opt.ResticName, "Name of the Restic used as configuration.")
112114
cmd.Flags().StringVar(&opt.ScratchDir, "scratch-dir", opt.ScratchDir, "Directory used to store temporary files. Use an `emptyDir` in Kubernetes.")
113115
cmd.Flags().StringVar(&opt.PushgatewayURL, "pushgateway-url", opt.PushgatewayURL, "URL of Prometheus pushgateway used to cache backup metrics")
116+
cmd.Flags().Float64Var(&opt.QPS, "qps", opt.QPS, "The maximum QPS to the master from this client")
117+
cmd.Flags().IntVar(&opt.Burst, "burst", opt.Burst, "The maximum burst for throttle")
114118
cmd.Flags().DurationVar(&opt.ResyncPeriod, "resync-period", opt.ResyncPeriod, "If non-zero, will re-list this often. Otherwise, re-list will be delayed aslong as possible (until the upstream source closes the watch or times out.")
115119
cmd.Flags().BoolVar(&opt.RunViaCron, "run-via-cron", opt.RunViaCron, "Run backup periodically via cron.")
116120
cmd.Flags().StringVar(&opt.DockerRegistry, "docker-registry", opt.DockerRegistry, "Check job image registry.")

server/options.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ type ControllerOptions struct {
2222
NumThreads int
2323
ScratchDir string
2424
OpsAddress string
25+
QPS float64
26+
Burst int
2527
ResyncPeriod time.Duration
2628
}
2729

@@ -33,6 +35,8 @@ func NewControllerOptions() *ControllerOptions {
3335
NumThreads: 2,
3436
ScratchDir: "/tmp",
3537
OpsAddress: ":56790",
38+
QPS: 100,
39+
Burst: 100,
3640
ResyncPeriod: 10 * time.Minute,
3741
}
3842
}
@@ -43,6 +47,9 @@ func (s *ControllerOptions) AddGoFlags(fs *flag.FlagSet) {
4347
fs.StringVar(&s.ScratchDir, "scratch-dir", s.ScratchDir, "Directory used to store temporary files. Use an `emptyDir` in Kubernetes.")
4448
fs.StringVar(&s.StashImageTag, "image-tag", s.StashImageTag, "Image tag for sidecar, init-container, check-job and recovery-job")
4549
fs.StringVar(&s.DockerRegistry, "docker-registry", s.DockerRegistry, "Docker image registry for sidecar, init-container, check-job, recovery-job and kubectl-job")
50+
51+
fs.Float64Var(&s.QPS, "qps", s.QPS, "The maximum QPS to the master from this client")
52+
fs.IntVar(&s.Burst, "burst", s.Burst, "The maximum burst for throttle")
4653
fs.DurationVar(&s.ResyncPeriod, "resync-period", s.ResyncPeriod, "If non-zero, will re-list this often. Otherwise, re-list will be delayed aslong as possible (until the upstream source closes the watch or times out.")
4754
}
4855

@@ -63,6 +70,9 @@ func (s *ControllerOptions) ApplyTo(cfg *controller.ControllerConfig) error {
6370
cfg.OpsAddress = s.OpsAddress
6471
cfg.ResyncPeriod = s.ResyncPeriod
6572

73+
cfg.ClientConfig.QPS = float32(s.QPS)
74+
cfg.ClientConfig.Burst = s.Burst
75+
6676
if cfg.KubeClient, err = kubernetes.NewForConfig(cfg.ClientConfig); err != nil {
6777
return err
6878
}

0 commit comments

Comments
 (0)