瀏覽代碼

use protobuf as serialisation format, reduce resource consumption

Signed-off-by: r2k1 <yokree@gmail.com>
r2k1 2 年之前
父節點
當前提交
95ddd96bfb
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      pkg/kubeconfig/loader.go

+ 8 - 1
pkg/kubeconfig/loader.go

@@ -17,7 +17,14 @@ func LoadKubeconfig(path string) (*rest.Config, error) {
 		loadingRules.ExplicitPath = path
 	}
 	loader := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, &clientcmd.ConfigOverrides{})
-	return loader.ClientConfig()
+	config, err := loader.ClientConfig()
+	if err != nil {
+		return nil, err
+	}
+	config.UserAgent = "opencost"
+	config.AcceptContentTypes = "application/vnd.kubernetes.protobuf,application/json"
+	config.ContentType = "application/vnd.kubernetes.protobuf"
+	return config, nil
 }
 
 // LoadKubeClient accepts a path to a kubeconfig to load and returns the clientset