Skip to content

Commit

Permalink
Merge pull request #350 from tosi3k/gfcd-pb
Browse files Browse the repository at this point in the history
Use protobuf encoding for core K8s APIs in gcs-fuse-csi-driver
  • Loading branch information
songjiaxun authored Sep 17, 2024
2 parents c3ed40c + e86c442 commit 67ada55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"k8s.io/apimachinery/pkg/util/version"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/log"
Expand Down Expand Up @@ -77,7 +78,9 @@ func main() {
kubeConfig := config.GetConfigOrDie()

// Setup client
client, err := kubernetes.NewForConfig(kubeConfig)
coreKubeConfig := rest.CopyConfig(kubeConfig)
coreKubeConfig.ContentType = runtime.ContentTypeProtobuf
client, err := kubernetes.NewForConfig(coreKubeConfig)
if err != nil {
klog.Warningf("Unable to get clientset: %v", err)
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/cloud_provider/clientset/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
authenticationv1 "k8s.io/api/authentication/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
listersv1 "k8s.io/client-go/listers/core/v1"
Expand Down Expand Up @@ -65,6 +66,7 @@ func New(kubeconfigPath string, informerResyncDurationSec int) (Interface, error
if err != nil {
return nil, fmt.Errorf("failed to read kubeconfig: %w", err)
}
rc.ContentType = runtime.ContentTypeProtobuf

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

0 comments on commit 67ada55

Please sign in to comment.