This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch refactor-with-go
in repository https://gitbox.apache.org/repos/asf/dubbo-admin.git
The following commit(s) were added to refs/heads/refactor-with-go by this push:
new 4aac64a2 set qps and burst for rest config (#1064)
4aac64a2 is described below
commit 4aac64a2eefd4c6077a6412f7d35ec2f1988b8bf
Author: Jun <[email protected]>
AuthorDate: Mon Mar 27 13:28:37 2023 +0800
set qps and burst for rest config (#1064)
---
pkg/authority/config/options.go | 9 +++++++++
pkg/authority/k8s/client.go | 3 +++
2 files changed, 12 insertions(+)
diff --git a/pkg/authority/config/options.go b/pkg/authority/config/options.go
index db595da4..f5c456e8 100644
--- a/pkg/authority/config/options.go
+++ b/pkg/authority/config/options.go
@@ -46,6 +46,11 @@ type Options struct {
// TODO remove EnableOIDCCheck
EnableOIDCCheck bool
ResourcelockIdentity string
+
+ // Qps for rest config
+ RestConfigQps int
+ // Burst for rest config
+ RestConfigBurst int
}
func NewOptions() *Options {
@@ -64,6 +69,8 @@ func NewOptions() *Options {
IsKubernetesConnected: false,
EnableOIDCCheck: true,
ResourcelockIdentity: GetStringEnv("POD_NAME",
GetDefaultResourcelockIdentity()),
+ RestConfigQps: 50,
+ RestConfigBurst: 100,
}
}
@@ -78,6 +85,8 @@ func (o *Options) FillFlags(flags *pflag.FlagSet) {
flags.BoolVar(&o.InPodEnv, "in-pod-env", false, "dubbo run in pod
environment")
flags.BoolVar(&o.IsKubernetesConnected, "is-kubernetes-connected",
false, "dubbo connected with kubernetes")
flags.BoolVar(&o.EnableOIDCCheck, "enable-oidc-check", false, "dubbo
enable OIDC check")
+ flags.IntVar(&o.RestConfigQps, "rest-config-qps", 50, "qps for rest
config")
+ flags.IntVar(&o.RestConfigBurst, "rest-config-burst", 100, "burst for
rest config")
}
func (o *Options) Validate() []error {
diff --git a/pkg/authority/k8s/client.go b/pkg/authority/k8s/client.go
index b697dc67..ba8e9f62 100644
--- a/pkg/authority/k8s/client.go
+++ b/pkg/authority/k8s/client.go
@@ -100,6 +100,9 @@ func (c *ClientImpl) Init(options *config.Options) bool {
}
}
+ // set qps and burst for rest config
+ config.QPS = float32(c.options.RestConfigQps)
+ config.Burst = c.options.RestConfigBurst
// creates the clientset
clientSet, err := kubernetes.NewForConfig(config)
if err != nil {