Skip to content

Commit

Permalink
Use protobuf encoding for core K8s apis
Browse files Browse the repository at this point in the history
For core K8s API objects like Pods, Nodes, etc., we
can use protobuf encoding which reduces CPU consumption
related to (de)serialization, reduces overall latency
of the API call, reduces memory footprint, reduces the
amount of work performed by the GC and results in quicker
propagation of objects to event handlers of shared informers.

Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
  • Loading branch information
Nikhil-Ladha authored and mergify[bot] committed Sep 20, 2024
1 parent 24832d2 commit b2ef27f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/csi-addons/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
)
Expand Down Expand Up @@ -122,6 +123,8 @@ func getKubernetesClient() *kubernetes.Clientset {
panic(err.Error())
}

config.ContentType = runtime.ContentTypeProtobuf

clientset, err := kubernetes.NewForConfig(config)
if err != nil {
panic(err.Error())
Expand Down

0 comments on commit b2ef27f

Please sign in to comment.