Skip to content

Commit

Permalink
Allow higher qps and burst for the kube client (#84)
Browse files Browse the repository at this point in the history
With large number of Nodes we can fire a lot of simultaneous reqs, since
they are all going through this app, we need to allow higher qps.
  • Loading branch information
george-angel authored Nov 1, 2024
1 parent e8fb8e4 commit 1817814
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,10 @@ func nodeHandler(w http.ResponseWriter, r *http.Request, kubeClient *kubernetes.
h.ServeHTTP(w, r)
}

// newKubeClient returns a Kubernetes client (clientset) from the supplied
// kubeconfig path, the KUBECONFIG environment variable, the default config file
// location ($HOME/.kube/config) or from the in-cluster service account environment.
// newKubeClient returns a Kubernetes client (clientset) with configurable
// rate limits from a supplied kubeconfig path, the KUBECONFIG environment variable,
// the default config file location ($HOME/.kube/config), or from the in-cluster
// service account environment.
func newKubeClient(path string) (*kubernetes.Clientset, error) {
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
if path != "" {
Expand All @@ -448,6 +449,10 @@ func newKubeClient(path string) (*kubernetes.Clientset, error) {
return nil, err
}

// Set rate limits to reduce client-side throttling
config.QPS = 100
config.Burst = 200

return kubernetes.NewForConfig(config)
}

Expand Down

0 comments on commit 1817814

Please sign in to comment.