envoyproxy / gateway

Manages Envoy Proxy as a Standalone or Kubernetes-based Application Gateway
https://gateway.envoyproxy.io
Apache License 2.0
1.54k stars 333 forks source link

envoy-gateway apis support protobuf #4283

Open qicz opened 5 days ago

qicz commented 5 days ago

Description:

Describe the desired behavior, what scenario it enables and how it would be used.

[optional Relevant Links:]

Any extra documentation required to understand the issue.

zirain commented 5 days ago

does GatewayAPI support protobuf?

qicz commented 5 days ago

does GatewayAPI support protobuf?

raised PR https://github.com/kubernetes-sigs/gateway-api/issues/3346

zirain commented 5 days ago

I didn't found too much docs for this, how can we achieve this?

qicz commented 4 days ago

https://kubernetes.io/docs/reference/using-api/api-concepts/#alternate-representations-of-resources @zirain

qicz commented 4 days ago

https://github.com/kubernetes/client-go/issues/76

zirain commented 4 days ago

https://kubernetes.io/docs/reference/using-api/api-concepts/#alternate-representations-of-resources @zirain

I'm asking how to make our api support it? does EG need any code change?

qicz commented 1 day ago

https://kubernetes.io/docs/reference/using-api/api-concepts/#alternate-representations-of-resources @zirain

I'm asking how to make our api support it? does EG need any code change?

add protobuf tag in API struct

zirain commented 1 day ago

https://kubernetes.io/docs/reference/using-api/api-concepts/#alternate-representations-of-resources @zirain

I'm asking how to make our api support it? does EG need any code change?

add protobuf tag in API struct

can you share an existing project that do such things as demo.

qicz commented 1 day ago

https://kubernetes.io/docs/reference/using-api/api-concepts/#alternate-representations-of-resources @zirain

I'm asking how to make our api support it? does EG need any code change?

add protobuf tag in API struct

can you share an existing project that do such things as demo.

client-go and go-controller-panel have more places using protobuf

https://github.com/kubernetes/apimachinery/blob/c98a9e22228d62689a77506ca0252d70f703958b/pkg/apis/meta/v1/types.go#L111-L152

https://github.com/envoyproxy/go-control-plane/blob/ec6977db26e1e30f8fc353a90442112a7f2b00d6/envoy/api/v2/listener.pb.go#L83-L127

zirain commented 1 day ago

go-control-plane generated from proto to go struct, so I thinks that's not valid example?

for client-go, I cannot find the tag protobuf you said.

liorokman commented 1 day ago

In order for the API server to be able to decode protobuf-encoded resources, the protobuf definitions need to be compiled into the API server.

In Kubernetes, sending the API server protobuf encoded resources only works for core resources, and not for CRDs.

As written here:

Not all API resource types support Protobuf; specifically, Protobuf isn't available for resources that are defined as CustomResourceDefinitions or are served via the aggregation layer.

qicz commented 14 hours ago

In order for the API server to be able to decode protobuf-encoded resources, the protobuf definitions need to be compiled into the API server.

In Kubernetes, sending the API server protobuf encoded resources only works for core resources, and not for CRDs.

As written here:

Not all API resource types support Protobuf; specifically, Protobuf isn't available for resources that are defined as CustomResourceDefinitions or are served via the aggregation layer.

yep, just core types support protobuf. https://github.com/kubernetes/kubernetes/issues/55541

we can support core types by protobuf and crd by json with two client instances. Any other suggestions?

cc @zirain

zirain commented 14 hours ago

we can support core types by protobuf and crd by json with two client instances

sgtm

liorokman commented 10 hours ago

we can support core types by protobuf and crd by json with two client instances. Any other suggestions?

cc @zirain

Controller-runtime based clients already uses protobuf for types that support it.

See https://github.com/kubernetes-sigs/controller-runtime/pull/1149