Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

envoy-gateway support multi content-type #4283

Closed
qicz opened this issue Sep 19, 2024 · 17 comments
Closed

envoy-gateway support multi content-type #4283

qicz opened this issue Sep 19, 2024 · 17 comments

Comments

@qicz
Copy link
Member

qicz commented Sep 19, 2024

support core types by protobuf and envoy-gateway apis by json

@zirain
Copy link
Member

zirain commented Sep 19, 2024

does GatewayAPI support protobuf?

@qicz
Copy link
Member Author

qicz commented Sep 19, 2024

does GatewayAPI support protobuf?

raised PR kubernetes-sigs/gateway-api#3346

@zirain
Copy link
Member

zirain commented Sep 19, 2024

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

@qicz
Copy link
Member Author

qicz commented Sep 20, 2024

@qicz
Copy link
Member Author

qicz commented Sep 20, 2024

kubernetes/client-go#76

@zirain
Copy link
Member

zirain commented Sep 20, 2024

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
Copy link
Member Author

qicz commented Sep 23, 2024

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
Copy link
Member

zirain commented Sep 23, 2024

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
Copy link
Member Author

qicz commented Sep 23, 2024

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
Copy link
Member

zirain commented Sep 23, 2024

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
Copy link
Contributor

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
Copy link
Member Author

qicz commented Sep 24, 2024

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. kubernetes/kubernetes#55541

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

cc @zirain

@zirain
Copy link
Member

zirain commented Sep 24, 2024

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

sgtm

@liorokman
Copy link
Contributor

liorokman commented Sep 24, 2024

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 kubernetes-sigs/controller-runtime#1149

@qicz
Copy link
Member Author

qicz commented Sep 25, 2024

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 kubernetes-sigs/controller-runtime#1149

Great, we should refactor clients using the informer. but the controller will refactor too, I think that is impossible, there are too many dependencies.

@qicz qicz changed the title envoy-gateway apis support protobuf envoy-gateway support different content-type Sep 25, 2024
@qicz qicz changed the title envoy-gateway support different content-type envoy-gateway support multi content-type Sep 25, 2024
@liorokman
Copy link
Contributor

Great, we should refactor clients using the informer. but the controller will refactor too, I think that is impossible, there are too many dependencies.

I can't find places in the codebase where a non controller-runtime client is used. Can you provide a link to code that needs to be fixed? The code in internal/provider/kubernetes uses controller-runtime to get clients to the provider, as far as I can tell.

@qicz
Copy link
Member Author

qicz commented Sep 27, 2024

already support multi content-type
image

@qicz qicz closed this as completed Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants