From 5fd0af2737d1a4cd8528adab6a09948f0e793831 Mon Sep 17 00:00:00 2001 From: Antoni Zawodny Date: Mon, 9 Sep 2024 13:28:10 +0200 Subject: [PATCH] Use protobuf encoding for core K8s APIs in external-snapshotter --- cmd/csi-snapshotter/main.go | 5 ++++- cmd/snapshot-controller/main.go | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/csi-snapshotter/main.go b/cmd/csi-snapshotter/main.go index 1515b84bd..0f2903d6f 100644 --- a/cmd/csi-snapshotter/main.go +++ b/cmd/csi-snapshotter/main.go @@ -30,6 +30,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" coreinformers "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" @@ -123,7 +124,9 @@ func main() { config.QPS = (float32)(*kubeAPIQPS) config.Burst = *kubeAPIBurst - kubeClient, err := kubernetes.NewForConfig(config) + coreConfig := rest.CopyConfig(config) + coreConfig.ContentType = runtime.ContentTypeProtobuf + kubeClient, err := kubernetes.NewForConfig(coreConfig) if err != nil { klog.Error(err.Error()) os.Exit(1) diff --git a/cmd/snapshot-controller/main.go b/cmd/snapshot-controller/main.go index 346d51d4b..1f5a157f6 100644 --- a/cmd/snapshot-controller/main.go +++ b/cmd/snapshot-controller/main.go @@ -36,6 +36,7 @@ import ( "k8s.io/client-go/util/workqueue" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/wait" klog "k8s.io/klog/v2" @@ -166,7 +167,9 @@ func main() { config.QPS = (float32)(*kubeAPIQPS) config.Burst = *kubeAPIBurst - kubeClient, err := kubernetes.NewForConfig(config) + coreConfig := rest.CopyConfig(config) + coreConfig.ContentType = runtime.ContentTypeProtobuf + kubeClient, err := kubernetes.NewForConfig(coreConfig) if err != nil { klog.Error(err.Error()) os.Exit(1)