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

build: marking extensions as extension-only visible by default #12337

Merged
merged 11 commits into from
Aug 1, 2020

Conversation

alyssawilk
Copy link
Contributor

Risk Level: medium (of build breakage)
Testing: n/a
Docs Changes: n/a
Release Notes: n/a
Part of #9953

@alyssawilk
Copy link
Contributor Author

cc @yanavlasov for import (where I think we can just define envoy_cc_extension_library to envoy_cc_library and ignore the dependency issue)

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Contributor Author

This only does half of it -
envoy_cc_extension needs it too

@alyssawilk
Copy link
Contributor Author

Ok I take it back - I ended up defining extra_visibility so there will need to be some bzl tweaks.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Contributor Author

It feels like this PR basically consists of tagging every filter in the integration tests. Still, I think it'll help future proof, like we should have moved the redirect integration test into extensions when we started adding pluggable retry predicates. So everything is included everywhere but hopefully it won't be going forward?

@lizan
Copy link
Member

lizan commented Jul 29, 2020

This is likely breaking many downstream builds. We have bunch of extension point that defined in extensions, for example: envoy.thrift_proxy.protocols, envoy.thrift_proxy.protocols and so on. Limiting visibility of those extension point make downstream builds unable to define extension from there.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Contributor Author

Unfortunately, one can't do //visibility:public -//source:__subpackages

How about this: I'll split the rules into their own build file, and add instructions on how folks can override on their imports?

@lizan
Copy link
Member

lizan commented Jul 29, 2020

Yeah, wondering whether visibility can be selected? If so we can do that as part of compile time option.

@@ -1,16 +1,18 @@
load(
"//bazel:envoy_build_system.bzl",
"envoy_cc_library",
"envoy_cc_extension_library",
"envoy_package",
)

licenses(["notice"]) # Apache 2

envoy_package()
Copy link
Member

Choose a reason for hiding this comment

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

We can define a envoy_extension_package with stricter default_visibility, use that instead of envoy_package in extensions. That limit visibility beyond cc_library.

@lizan lizan added the waiting label Jul 29, 2020
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

LGTM, one TODO to add.

BUILD Outdated
Comment on lines 8 to 31
# These two definitions exist to help reduce Envoy upstream core code depending on extensions.
# To avoid visibility problems, one can replace the package lists below with "//visibility:public"
#
# TODO(#9953) //test/config_test:__pkg__ should probably be split up and removed.
# TODO(#9953) the config fuzz tests should be moved somewhere local and //test/config_test and //test/server removed.
package_group(
name = "extension_config",
packages = [
"//source/exe",
"//source/extensions/...",
"//test/config_test",
"//test/extensions/...",
"//test/server",
"//test/server/config_validation",
],
)

package_group(
name = "extension_library",
packages = [
"//source/extensions/...",
"//test/extensions/...",
],
)
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 add a TODO here to make this override more easier? I think potentially we can embed part of this in source/extensions/extensions_build_config.bzl (something like additional_visibility), that's where the overrides happen for downstream builds normally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gah, that's a fair point.
I hate to make folks overwrite the build file, then move their workarounds when I do the TODO. Let me see if I can get something working tonight.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
BUILD Outdated
@@ -1,3 +1,8 @@
load(
"//source/extensions:extensions_build_config.bzl",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"//source/extensions:extensions_build_config.bzl",
"@envoy_build_config//:extensions_build_config.bzl",

Is the real overridden path :)

@@ -6,7 +11,7 @@ exports_files([
])

# These two definitions exist to help reduce Envoy upstream core code depending on extensions.
# To avoid visibility problems, one can replace the package lists below with "//visibility:public"
# To avoid visibility problems, one can extend ADDITIONAL_VISIBILITY in source/extensions/extensions_build_config.bzl
Copy link
Member

Choose a reason for hiding this comment

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

re: how to override is documented in https://github.com/envoyproxy/envoy/tree/master/bazel#disabling-extensions, can you update there too?

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
By default, Envoy extensions are set up to only be visible to code within the
[//source/extensions](../source/extensions/), or the Envoy server target. To adjust this,
add any additional targets you need to `ADDITIONAL_VISIBILITY` in
[extensions_build_config.bzl](../source/extensions/extensions_build_config.bzl).
Copy link
Member

Choose a reason for hiding this comment

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

To inject this file should be done like what https://github.com/envoyproxy/envoy/blob/master/bazel/README.md#disabling-extensions describes, add a link?

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@lizan lizan merged commit da403fa into envoyproxy:master Aug 1, 2020
chaoqin-li1123 pushed a commit to chaoqin-li1123/envoy that referenced this pull request Aug 7, 2020
…proxy#12337)

Risk Level: medium (of build breakage)
Testing: n/a
Docs Changes: n/a
Release Notes: n/a
Part of envoyproxy#9953

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
chaoqin-li1123 pushed a commit to chaoqin-li1123/envoy that referenced this pull request Aug 7, 2020
…proxy#12337)

Risk Level: medium (of build breakage)
Testing: n/a
Docs Changes: n/a
Release Notes: n/a
Part of envoyproxy#9953

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: chaoqinli <chaoqinli@google.com>
lizan pushed a commit that referenced this pull request Aug 11, 2020
Commit Message: Revert buffer filter visibility back to public
Additional Description: After bringing in #12337, we are unable to build the router check tool as we build it with the buffer filter extension, which is no longer visible to the target we use. This change reverts the visibility change for the buffer filter back to public.
Risk Level: Low
Testing: N/A
Docs Changes: N/A
Release Notes: N/A
Part of #12444

Signed-off-by: Lisa Lu <lisalu@lyft.com>
@alyssawilk alyssawilk deleted the visibility branch December 10, 2020 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants