-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Proposal: Check-in generated golang protos in envoy/api #8151
Description
Hi envoy-api shepards,
Given the recent improvement to the golang APIs via #8003 and the upcoming goproto compatible version of go-control-plane via envoyproxy/go-control-plane#213, I wanted to propose another change: Is it possible that we could check in generate golang protos into the api/ folder?
Most golang code uses the built-in go build system instead of Bazel. This is a standard in the open-source golang community. This means that the generated golang protos (.pb.go files) must be checked into these repos, allowing consumers to depend upon them and build them using the go build system.
Currently, envoy's api repository does not have the generated golang protos. Instead, both go-control-plane/envoy and gprc-go/xds/internal/proto/envoy contain the generated envoy golang protos. This is a problem because:
- Each repo needs to manually update their generated protos everytime any protos in envoy are updated
- There is no single source-of-truth for generated protos. We could modify either go-control-plane or grpc-go to serve as the SOT, but it would bring in more dependencies than required. The ideal solution is to have the data-plane-api be the SOT.
- We recently split the UDPA apis into cncf/udpa. With this change, grpc-go was also forced to add generation for the UDPA protos. Here are the generated protos in grpc-go. Once again, this breaks the single source-of-truth.
- In the worst case, it may be impossible for external golang code to import both go-control-plane and grpc-go due to "duplicate proto type registered" errors. This would be extremely painful to solve.
Checking in generated files is OK for golang protos. Other than go-control-plane and grpc-go, some other repositories also follow the same structure for non-envoy protos:
- census-instrumentation/opencensus-proto in the gen-go/ folder
- googleapis/go-genproto in the googleapis/ folder
It would be ideal to have golang protos auto-generated and checked-in to the api/ folder whenever any of the underlying protos files are updated. Proto generation would occur with protoc using grpc and protoc-gen-validate.
I know that envoy primarily supports C++, but this change would help drive golang adoption for the control plane.