Skip to content

Commit

Permalink
use protobuf content type instead of json for k8s client (#131)
Browse files Browse the repository at this point in the history
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. Ensure you have added the unit tests for your changes.
2. Ensure you have included output of manual testing done in the Testing
section.
3. Ensure number of lines of code for new or existing methods are within
the reasonable limit.
4. Ensure your change works on existing clusters after upgrade.
-->
**What type of PR is this?**

<!--
Add one of the following:
bug
cleanup
documentation
feature
-->

**Which issue does this PR fix**:


**What does this PR do / 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.

**If an issue # is not available please add steps to reproduce and the
controller logs**:


**Testing done on this change**:
<!--
output of manual testing/integration tests results and also attach logs
showing the fix being resolved
-->

**Automation added to e2e**:
<!--
List the e2e tests you added as part of this PR.
If no, create an issue with enhancement/testing label
-->

**Will this PR introduce any new dependencies?**:
<!--
e.g. new K8s API
-->

**Will this break upgrades or downgrades. Has updating a running cluster
been tested?**:


**Does this PR introduce any user-facing change?**:
<!--
If yes, a release note update is required:
Enter your extended release note in the block below. If the PR requires
additional actions
from users switching to the new release, include the string "action
required".
-->
No
```release-note

```

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
  • Loading branch information
jaydeokar authored Oct 18, 2024
2 parents 31b8e4b + eea7423 commit 23447ae
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,16 @@ func main() {
setupLog.Error(err, "unable to build REST config")
os.Exit(1)
}
clientSet, err := kubernetes.NewForConfig(restCFG)

clientSetRestConfig, err := config.BuildRestConfig(controllerCFG.RuntimeConfig)
if err != nil {
setupLog.Error(err, "unable to build REST config")
os.Exit(1)
}
clientSetRestConfig.AcceptContentTypes = "application/vnd.kubernetes.protobuf,application/json"
clientSetRestConfig.ContentType = "application/vnd.kubernetes.protobuf"

clientSet, err := kubernetes.NewForConfig(clientSetRestConfig)
if err != nil {
setupLog.Error(err, "unable to obtain clientSet")
os.Exit(1)
Expand Down

0 comments on commit 23447ae

Please sign in to comment.