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

fully use buf to generate go from proto #50587

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmorel-35
Copy link
Contributor

@mmorel-35 mmorel-35 commented Apr 21, 2024

Please provide a description of this PR:

fully use buf to generate go from proto:

  • move buf.yaml at the root
  • declare buf.build/googleapis/googleapis and buf.build/k8s/api dependencies
  • remove common-proto/k8s.io

@istio-testing istio-testing added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Apr 21, 2024
@istio-testing
Copy link
Collaborator

Hi @mmorel-35. Thanks for your PR.

I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mmorel-35 mmorel-35 marked this pull request as draft April 21, 2024 18:43
@istio-testing istio-testing added the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Apr 21, 2024
@mmorel-35 mmorel-35 marked this pull request as ready for review April 21, 2024 18:53
@istio-testing istio-testing removed the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Apr 21, 2024
@howardjohn
Copy link
Member

@ericvn WDYT of this?

This puts a dependency on buf.build servers at build time (like we depend on the golang module proxy)

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label Apr 22, 2024
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label Apr 23, 2024
@costinm
Copy link
Contributor

costinm commented Apr 23, 2024

@ericvn WDYT of this?

This puts a dependency on buf.build servers at build time (like we depend on the golang module proxy)

Do we still support offline builds (disconnected from internet) / without buf.build ? ( I assume we can build without golang module proxy ).

At the very least the PR description should make this more clear and explain how to use without.

@mmorel-35
Copy link
Contributor Author

I'm not really familiar with offline usage of buf.build, but the FAQ has some answers to that

@costinm
Copy link
Contributor

costinm commented Apr 23, 2024 via email

@howardjohn
Copy link
Member

fwiw - The codegen still runs locally, just the proto sources are pulled from buf instead of checked into git. They do also have remote codegen but this PR isn't introducing it

@costinm
Copy link
Contributor

costinm commented Apr 23, 2024 via email

@costinm
Copy link
Contributor

costinm commented Apr 23, 2024 via email

@bleggett
Copy link
Contributor

bleggett commented Apr 30, 2024

That's a bit better - but still something that should be in the PR description. I assume someone modifying the proto sources is less critical - at worse they may remove security fields but the tests should catch that. The difference between this and golang module proxy is that the module proxy is untrusted - go still verifies the SHAs from go.sum.

This effectively does the same thing as go.sum but with buf.lock - either way, any mutation of the protos changes the SHA and would require a buf.lock update - which would generate a Git commit on our end.

So the risks here are the same risks we have today around the potential for someone to start compromising Go code we're pulling - no better and no worse, and in either case we have traceability/attestability via git.

@bleggett
Copy link
Contributor

/ok-to-test

@istio-testing istio-testing added ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. and removed needs-ok-to-test labels Apr 30, 2024
@bleggett
Copy link
Contributor

bleggett commented Apr 30, 2024

I assume the buf.build servers are only used in 'make generate' - so not a problem.

I'm not really familiar with offline usage of buf.build, but the FAQ has some answers to that

I'm assuming this means we would be hitting buf servers at least once-per-CI-run? And if their servers were down our CI would start to fail? Unless we retain local state between runs which I don't think we do.

It also looks like there might be some caveats with the local cache, depending on whether you use plugins: bufbuild/buf#2543

I'll defer to @ericvn but while I like the idea here, and I don't think the security model changes, I am concerned that we wouldn't have a good mitigation if the buf servers went down for a day and that does concern me a bit.

@costinm
Copy link
Contributor

costinm commented May 1, 2024 via email

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label May 1, 2024
@ericvn
Copy link
Contributor

ericvn commented May 2, 2024

My first thought reading this was that we will use a local cache (after being download once from the server), then their servers, and if not available, we can get from another source (although I'm still not sure of the last item). I think that should be easy to test. If that all works, then I think this is an acceptable idea. I wouldn't want to eliminate off-line builds. Last question is if we would want to create a local cache to use across CI jobs.

@costinm
Copy link
Contributor

costinm commented May 3, 2024 via email

@howardjohn
Copy link
Member

While the security risk is probably low/acceptable, TBH I don't really see the benefits here. We are talking about adding a cache, security, availability... what benefits do we get? Seems like little to none

@costinm
Copy link
Contributor

costinm commented May 3, 2024 via email

@bleggett
Copy link
Contributor

bleggett commented May 3, 2024

While the security risk is probably low/acceptable, TBH I don't really see the benefits here. We are talking about adding a cache, security, availability... what benefits do we get? Seems like little to none

Only real benefit is it removes ~20k lines worth of vendored protos from our tree (which is good). If we have concerns about caching/availability for CI I am OK holding off on this tho, until we have good answers.

I would like at least testing of/proposed mitigations for any potential CI breakage we could get from this if the buf servers are down, and whether we could safely retain cache across builds or not.

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
@istio-testing istio-testing removed the needs-rebase Indicates a PR needs to be rebased before being merged label May 3, 2024
@istio-testing
Copy link
Collaborator

istio-testing commented May 3, 2024

@mmorel-35: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
release-notes_istio 7626370 link true /test release-notes

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@jacob-delgado
Copy link
Contributor

Are we able to reproduce any build if we go down this route? I don't like having checked in protos, but as long as we can have something in the manifest as to which shas from protos we checked in that'd be great.

I use buf often in smaller projects and I enjoy using it compared to using protoc. So overall it's a +1 from me.

@istio-testing istio-testing added the needs-rebase Indicates a PR needs to be rebased before being merged label May 10, 2024
@istio-testing
Copy link
Collaborator

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR needs to be rebased before being merged ok-to-test Set this label allow normal testing to take place for a PR not submitted by an Istio org member. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants