From 4cf8572648dc8a4f0e2d97002f5e3832396b6749 Mon Sep 17 00:00:00 2001 From: Bhavitha Koduru Date: Thu, 12 Sep 2024 05:58:54 +0000 Subject: [PATCH] use protobuf content type instead of json for k8s client --- cmd/main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/main.go b/cmd/main.go index 95577b3..add7aea 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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)