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

api: shadowing for API protos. #9429

Merged
merged 17 commits into from
Dec 29, 2019
Merged

api: shadowing for API protos. #9429

merged 17 commits into from
Dec 29, 2019

Conversation

htuch
Copy link
Member

@htuch htuch commented Dec 20, 2019

This is intended to simplify the internal handling of deprecations during API boosting.

See https://docs.google.com/document/d/1mGO9LtVo7t4Lph7WlmyGCxXye3h6j29z3JZvIBbs_D0/edit

Ultimately the plan is to hide this all as a build artifact in Bazel cache, but due to the technical complexity of the pure Bazel solution (involving changes spanning PGV, protoxform, API build rules), we will use checked-in artifacts for 1.13.0.

Risk level: Low
Testing: Additional API test and protoxform golden test.

Part of #8082

This should be unwound in the future with #9479

Signed-off-by: Harvey Tuch htuch@google.com

@htuch
Copy link
Member Author

htuch commented Dec 20, 2019

This is a sketch for what the shadow protos would look like. I think I can get them working end-to-end with only a small amount of additional work on import paths and BUILD files. At this point, given that it sort-of-works, I'm interested in hearing from @lizan how hard it might be to turn this into some sort of aspect rule based approach that hides the shadows in the Bazel cache.

This is intended to simplify the internal handling of deprecations
during API boosting.

See
https://docs.google.com/document/d/1mGO9LtVo7t4Lph7WlmyGCxXye3h6j29z3JZvIBbs_D0/edit

Ultimately the plan is to hide this all as a build artifact in Bazel
cache, but due to the technical complexity of the pure Bazel solution
(involving changes spanning PGV, protoxform, API build rules), we will
use checked-in artifacts for 1.13.0.

Risk level: Low
Testing: Additional API test and protoxform golden test.

Part of envoyproxy#8082

Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch htuch changed the title RFC: Envoy internal shadow for API protos. api: shadowing for API protos. Dec 25, 2019
@htuch htuch marked this pull request as ready for review December 25, 2019 19:59
@htuch
Copy link
Member Author

htuch commented Dec 25, 2019

@lizan @mattklein123 this is now ready for review and is the plan-of-record for 1.13.0 + v3.

@htuch htuch added the api/v3 Major version release @ end of Q3 2019 label Dec 26, 2019
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks this makes sense to me. I have 2 small comments and also one general question: I'm a little fearful that this is going to cause a bunch of pain for consuming projects that consume Envoy as a submodule. Do you have any intuition of what this will look like? Do you think we should run the tooling in the envoy-filter-example repo to expose issues like this? This should probably done as a P1 ASAP thing? WDYT?

api_shadow/BUILD Outdated
@@ -0,0 +1,157 @@
# DO NOT EDIT. This file is generated by tools/proto_sync.py.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe put this somewhere else that is not top level so that people don't see it, ignore the README, and get pretty confused? My first thought was a top level generated/ directory, but I think we have scripts that put stuff in a directory by that name so that might get confusing. Also, it's still top level. Maybe somewhere under bazel/ as it is a baked in part of our build that should eventually just go away? WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about prebuillt/api_shadow, internal/api_shadow, vendored/api_shadow? Prefer not under bazel/, as this doesn't technically relate to Bazel infra (but it is build related).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, maybe generated_api?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of like prebuilt/api_shadow but I don't feel that strongly about it. (2nd place would be vendored/)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put it in generated_api_shadow; it's only 3 lines to change it to whatever folks want, so if @lizan has any strong preferences, we can do that.

api_shadow/envoy/api/v3alpha/cds.proto Outdated Show resolved Hide resolved
@htuch
Copy link
Member Author

htuch commented Dec 26, 2019

@mattklein123 re: submodules, I think this should be largely transparent. As long as folks are using api_binding.bzl in their WORKSPACE, the use of shadowing should not matter. What will be really confusing and break-the-world is the move to v3, but that affects everyone, not just consuming projects (e.g. filter developers).

Signed-off-by: Harvey Tuch <htuch@google.com>
.gitattributes Outdated
@@ -1,6 +1,8 @@
/docs/root/intro/version_history.rst merge=union
*.generated.pb_text linguist-generated=true
*.generated.pb_text -diff -merge
/api_shadow/envoy/** linguist-generated=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update this?

@@ -44,7 +44,7 @@ envoy_cc_library(
hdrs = ["subscription_factory.h"],
deps = [
":subscription_interface",
"@envoy_api//envoy/api/v2/core:pkg_cc_proto",
"@envoy_api_shadow//envoy/api/v2/core:pkg_cc_proto",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we switch the bind, (i.e. use @envoy_api for shadow)? I think that makes less breaking for BUILD files under include/ and source/, and less breaking for consuming project, as @mattklein123 pointed out.

Otherwise this will easily cause ODR violation when some consuming project trying to link @envoy_api//envoy/api/v2/core:pkg_cc_proto.

Copy link
Member Author

@htuch htuch Dec 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done this, but it comes with tradeoffs. While most of the source now deals with @envoy_api, we have to switch all developer tools to an alias for the real artifacts, @envoy_api_canonical (lest we have some weird dependence of generating tools on generated artifacts). Then we need to symlink across Bazel rules. It works, PTAL.

Copy link
Member

@lizan lizan Dec 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it comes with tradeoffs but I prefer this way to be less breaking for consuming projects, as well as less breaking when we merge envoy_api_canonical with envoy_api.

Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch
Copy link
Member Author

htuch commented Dec 27, 2019

@lizan Windows breaks due to the symlink, do you know if we can enable "developer mode" on CI to solve this? https://www.quora.com/How-does-Git-handle-symbolic-links-on-Windows

@lizan
Copy link
Member

lizan commented Dec 28, 2019

@lizan Windows breaks due to the symlink, do you know if we can enable "developer mode" on CI to solve this? https://www.quora.com/How-does-Git-handle-symbolic-links-on-Windows

Hmm, not sure how to do this, were we previously not using symlink?

@htuch
Copy link
Member Author

htuch commented Dec 29, 2019

OK, will merge for now and we can sort out Windows next week. Thanks.

@htuch htuch merged commit da5fb5c into envoyproxy:master Dec 29, 2019
@htuch htuch deleted the upgrade-shadow branch December 29, 2019 04:07
sthagen added a commit to sthagen/envoyproxy-envoy that referenced this pull request Dec 29, 2019
htuch added a commit to htuch/envoy that referenced this pull request Dec 30, 2019
Signed-off-by: Harvey Tuch <htuch@google.com>
htuch added a commit that referenced this pull request Dec 30, 2019
Signed-off-by: Harvey Tuch <htuch@google.com>
@junr03 junr03 mentioned this pull request Jan 2, 2020
prakhag1 pushed a commit to prakhag1/envoy that referenced this pull request Jan 3, 2020
This is intended to simplify the internal handling of deprecations during API boosting.

See https://docs.google.com/document/d/1mGO9LtVo7t4Lph7WlmyGCxXye3h6j29z3JZvIBbs_D0/edit

Ultimately the plan is to hide this all as a build artifact in Bazel cache, but due to the technical complexity of the pure Bazel solution (involving changes spanning PGV, protoxform, API build rules), we will use checked-in artifacts for 1.13.0.

Risk level: Low
Testing: Additional API test and protoxform golden test.

Part of envoyproxy#8082

This should be unwound in the future with envoyproxy#9479

Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Prakhar <prakhar_au@yahoo.com>
prakhag1 pushed a commit to prakhag1/envoy that referenced this pull request Jan 3, 2020
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Prakhar <prakhar_au@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api/v3 Major version release @ end of Q3 2019
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants