mirror of https://github.com/portainer/portainer
reduce throttling in the kube client (#8630)
parent
8f42af49e8
commit
29648f517b
|
@ -17,6 +17,11 @@ import (
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
DefaultKubeClientQPS = 30
|
||||||
|
DefaultKubeClientBurst = 100
|
||||||
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// ClientFactory is used to create Kubernetes clients
|
// ClientFactory is used to create Kubernetes clients
|
||||||
ClientFactory struct {
|
ClientFactory struct {
|
||||||
|
@ -113,6 +118,9 @@ func (factory *ClientFactory) CreateKubeClientFromKubeConfig(clusterID string, k
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cliConfig.QPS = DefaultKubeClientQPS
|
||||||
|
cliConfig.Burst = DefaultKubeClientBurst
|
||||||
|
|
||||||
cli, err := kubernetes.NewForConfig(cliConfig)
|
cli, err := kubernetes.NewForConfig(cliConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -198,7 +206,10 @@ func (factory *ClientFactory) createRemoteClient(endpointURL string) (*kubernete
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
config.Insecure = true
|
config.Insecure = true
|
||||||
|
config.QPS = DefaultKubeClientQPS
|
||||||
|
config.Burst = DefaultKubeClientBurst
|
||||||
|
|
||||||
config.Wrap(func(rt http.RoundTripper) http.RoundTripper {
|
config.Wrap(func(rt http.RoundTripper) http.RoundTripper {
|
||||||
return &agentHeaderRoundTripper{
|
return &agentHeaderRoundTripper{
|
||||||
|
@ -217,6 +228,9 @@ func buildLocalClient() (*kubernetes.Clientset, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.QPS = DefaultKubeClientQPS
|
||||||
|
config.Burst = DefaultKubeClientBurst
|
||||||
|
|
||||||
return kubernetes.NewForConfig(config)
|
return kubernetes.NewForConfig(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue