-
Notifications
You must be signed in to change notification settings - Fork 808
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
use protobuf content type instead of json for k8s client #2138
use protobuf content type instead of json for k8s client #2138
Conversation
Hi @bhavi-koduru. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
/lgtm |
FYI @ConnorJC3 @ElijahQuinones @torredil Seems like this is documented in Kubernetes API Concepts | Alternate Representations of resources @bhavi-koduru mentioned that this support was enabled in k8s 1.13 so we are safe for all supported K8s versions. (x-ref: kubernetes/client-go#76). CRDs (sometimes?) are JSON-only. I may do some research to ensure no noticeable performance regression before approving this PR, but it is good that e2e tests are passing. Seems like there have been some (old) cases of setting ContentType to protobuf breaking things, but that might have been because those projects did not set the fallback to be JSON via |
If protobuf is so much better than JSON is there a reason it isn't enabled by default in Also, is it even worth taking this risk for the driver binary itself? It rarely communicates with the API server (off the top of my head I can only think of the startup taint removal and pre-stop hooks). |
Yeah I had same question, turns out it was not enabled by default because not all CRDs support protobuf, and there was concern about protobuf encodings being less stable than JSON encodings back in 2017. At-least that is what this issue rabbit hole mentions: kubernetes/client-go#76
Good point, @bhavi-koduru is there a world where PRs on the kubernetes-csi sidecars (e.g. external-attacher, resizer, provisioner, snapshotter) makes more sense? Those are the components of EBS CSI Driver that watch the K8s API Server and then call this plugin's gRPC endpoints to perform EBS volume / EC2 instance actions like creating and mounting volumes. |
CRDs currently only support json. That's why this change has a fallback after protobuf. Controller-runtime which is most popular SDK to build controller has adopted protobuf in 2020: kubernetes-sigs/controller-runtime#1149 There is an attempt kubernetes/kubernetes#125314 in upstream to change the default. But it will take some time. |
The scope of this task is to get eks/aws components using protobuf. Hence, we are not focusing on upstream components currently. |
I think @ConnorJC3 and @AndrewSirenko raise valid concerns here. That said, I'm more inclined to accept this change if kubernetes-csi/external-attacher#585 is accepted, especially given that standard components default to protobuf. |
Main reason why it wasn't defaulted is because of this today FMU kubernetes/kubernetes#26130 If it wasn't exposed, defaulting would have happened already. |
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.
Thank you for the contribution!
/lgtm
/lgtm |
@ElijahQuinones: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/approve I did some deep digging, and based on what I found this looks to be safe in the versions we support. I would still encourage the submitter to consider contributing to other upstream projects like the sidecars if they're looking for a big improvement howerver. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ConnorJC3 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest likely flake |
Is this a bug fix or adding new feature?
What is this PR about? / Why do we need it?
This MR is a part of effort to elevate single eks cluster performance by migrating the EKS components to use protobuf instead of json.
Modify kubeconfig type to use content type application/vnd.kubernetes.protobuf instead of json for performance gain.
This change essentially lets the ebs driver (client) to talk to apiserver using protobuf and falls back to json if protobuf isn't supported. It will only affect the wire format between ebs driver and apiserver.
What testing is done?