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
Switch from JSON to protobuf for kube-api requests #2570
Conversation
Signed-off-by: r2k1 <yokree@gmail.com>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super cool! Thanks for the optimization numbers to help put the change in context. The decreased CPU usage is particularly exciting.
pkg/kubeconfig/loader.go
Outdated
return loader.ClientConfig() | ||
config, err := loader.ClientConfig() | ||
if err != nil { | ||
return nil, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you please wrap this error?
config.AcceptContentTypes = "application/vnd.kubernetes.protobuf,application/json" | ||
config.ContentType = "application/vnd.kubernetes.protobuf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there somewhere in the K8s documentation we can link to that explains these config values? E.g. what acceptable inputs are and what setting ContentType = "application/vnd.kubernetes.protobuf"
means? I don't have the library in front of me, so if its already documented in the Go libraries godoc then that is plenty for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very very cool! I wonder why they haven't switched to this by default. Backwards compatibility I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@r2k1 Just want to make sure that older versions of kubernetes will still work appropriately with this change. Is there any reason to expect versions of kubernetes on GKS, EKS, AKS may not work properly?
Just want to make sure that we're covering our bases here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not aware about any potential reasons why it would not work. I would expect all cloud services to use the same binary.
kube-state-metrics sets same values.
Signed-off-by: r2k1 <yokree@gmail.com>
Signed-off-by: r2k1 <yokree@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neat!
Quality Gate passedIssues Measures |
Thank you Artur! |
What does this PR change?
Switch from JSON to protobuf for kube-api requests. Improve performance. I assume it should also reduce load on kube-api.
On my test it:
Memory allocation space diff:
Related issue #2473
For the future references, my test setup:
AKS cluster with ~2500 pods.