Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce WithQPS and WithBurst functions #262

Closed
wants to merge 1 commit into from

Conversation

thapabishwa
Copy link
Contributor

@thapabishwa thapabishwa commented Dec 5, 2023

@chen-keinan
Unfortunately I couldn't create an issue on this repo like we discussed.

As such, I have created this PR to reflect the changes that I made on my end to while I encountered the issue.
I believe that might help you to pin point the issue.

Copy link
Contributor

@chen-keinan chen-keinan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thapabishwa thank you for pointing it out. change lgtm 🚀 I have added couple of comments

Comment on lines +183 to +211
fmt.Println("kubeconfig QPS:", kubeConfig.QPS)
fmt.Println("kubeconfig Burst:", kubeConfig.Burst)

// kubeConfig.QPS = 2000
// kubeConfig.Burst = 2000
/* uncomment the above lines to manually set QPS and Burst
after manually setting QPS and Burst, your response time will be much faster

example output with WithQPS(2000) and WithBurst(2000) functions:
Setting burst to 2000
Setting QPS to 2000
kubeconfig QPS: 0 (qps and burst are reset to 0)
kubeconfig Burst: 0
Current namespace: default
Scanning cluster
Time taken: 2.057551041s
Name: coredns, Kind: Deployment, Namespace: kube-system, Images: [registry.k8s.io/coredns/coredns:v1.10.1]

example output after manually setting QPS and Burst:
Setting burst to 2000
Setting QPS to 2000
kubeconfig QPS: 2000 (manually set values)
kubeconfig Burst: 2000 (manually set values)
Current namespace: default
Scanning cluster
Time taken: 89.546083ms
Name: coredns, Kind: Deployment, Namespace: kube-system, Images: [registry.k8s.io/coredns/coredns:v1.10.1]
*/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for example , I think this comment can be removed

@@ -139,6 +139,21 @@ func WithKubeConfig(kubeConfig string) ClusterOption {
}
}

func WithQPS(qps float32) ClusterOption {
return func(o *genericclioptions.ConfigFlags) {
fmt.Println("Setting QPS to", qps)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fmt.Println can be removed

// WithBurst sets the burst limit for the client
func WithBurst(burst int) ClusterOption {
return func(o *genericclioptions.ConfigFlags) {
fmt.Println("Setting burst to", burst)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fmt.Println can be removed

@thapabishwa
Copy link
Contributor Author

thapabishwa commented Dec 9, 2023

Closed in favor of #263.

Changes in #263 PR can successfully update QPS/Burst values of the clients as opposed to the changes in this PR.

@thapabishwa thapabishwa closed this Dec 9, 2023
@thapabishwa thapabishwa deleted the QPS-Burst-Bug branch December 9, 2023 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants