dynamic_modules: support for statically linked modules#43696
Conversation
Signed-off-by: Takeshi Yoneda <tyoneda@netflix.com>
02dce7c to
3adce38
Compare
Signed-off-by: Takeshi Yoneda <tyoneda@netflix.com>
| @@ -640,4 +640,1744 @@ __attribute__((weak)) bool envoy_dynamic_module_callback_matcher_get_header_valu | |||
| return false; | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
change here is just adding missing weak references for testing. Nothing interesting here
| // In this case, Envoy uses ``dlsym(RTLD_DEFAULT, ...)`` to resolve module symbols, with each | ||
| // symbol name prefixed by ``<name>_``. For example, ``foo_envoy_dynamic_module_on_program_init`` | ||
| // is resolved instead of ``envoy_dynamic_module_on_program_init``. | ||
| // When using ``static://``, the ``do_not_close`` and ``load_globally`` fields are ignored. |
There was a problem hiding this comment.
i was thinking about adding "is_static" or whatever flag but it is weird as it's not available to most of the people as well as it sounds very contradictory to the name "dynamic modules" of this proto. So I decided to have this naming schema stuff. Note that any name containing slash was invalid before, so this is backward compatible
There was a problem hiding this comment.
Is it possible for us to automatically infer static if we can find the module to be part of the build? Just not let users specify anything special. WDYT?
There was a problem hiding this comment.
fixed! now it's implicit and no API change needed! Thanks for the good advice
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
| lua*; | ||
| envoyGo*; | ||
| envoy_dynamic_module_callback_*; | ||
| *_envoy_dynamic_module_on_*; |
There was a problem hiding this comment.
this is necessary to allow the statically linked symbols to be available via dlsym
|
|
||
| load("@rules_cc//cc:defs.bzl", "cc_import") | ||
|
|
||
| def envoy_dynamic_module_prefix_symbols(name, module_name, archive, tags = [], **kwargs): |
There was a problem hiding this comment.
i am planning to use this one internally not only the tests here in upstream
|
Will fix the coverage in a bit |
Signed-off-by: Takeshi Yoneda <tyoneda@netflix.com>
Signed-off-by: Takeshi Yoneda <tyoneda@netflix.com>
Signed-off-by: Takeshi Yoneda <tyoneda@netflix.com>
|
/retest |
) Commit Message: dynamic_modules: support for statically linked modules Additional Description: This commit allows statically linked dynamic modules though in that case it is not really a "dynamic". This allows downstream users who build their own Envoy binary to statically link their modules using bazel natively. This will also set the foundation for our discussed direction of the project: allowing new core extensions written as a dynamic module. The idea is that these statically linked modules must prefix Envoy->DM callbacks (envoy_dynamic_module_on_*) with their own module names, and at the dynamic_modules loading phase, Envoy try to find the init symbol like foo_envoy_dynamic_module_on_init. If found, it is a statically linked module, and otherwise it will try to load the shared library normally. Since this functionality is very low-level and not available for normal end users (i.e. anyone using official binaries), i intentionally did not add the release note. Risk Level: low Testing: done Docs Changes: n/a Release Notes: n/a Platform Specific Features: --------- Signed-off-by: Takeshi Yoneda <tyoneda@netflix.com> Signed-off-by: bjmask <11672696+bjmask@users.noreply.github.com>
) Commit Message: dynamic_modules: support for statically linked modules Additional Description: This commit allows statically linked dynamic modules though in that case it is not really a "dynamic". This allows downstream users who build their own Envoy binary to statically link their modules using bazel natively. This will also set the foundation for our discussed direction of the project: allowing new core extensions written as a dynamic module. The idea is that these statically linked modules must prefix Envoy->DM callbacks (envoy_dynamic_module_on_*) with their own module names, and at the dynamic_modules loading phase, Envoy try to find the init symbol like foo_envoy_dynamic_module_on_init. If found, it is a statically linked module, and otherwise it will try to load the shared library normally. Since this functionality is very low-level and not available for normal end users (i.e. anyone using official binaries), i intentionally did not add the release note. Risk Level: low Testing: done Docs Changes: n/a Release Notes: n/a Platform Specific Features: --------- Signed-off-by: Takeshi Yoneda <tyoneda@netflix.com>
) Commit Message: dynamic_modules: support for statically linked modules Additional Description: This commit allows statically linked dynamic modules though in that case it is not really a "dynamic". This allows downstream users who build their own Envoy binary to statically link their modules using bazel natively. This will also set the foundation for our discussed direction of the project: allowing new core extensions written as a dynamic module. The idea is that these statically linked modules must prefix Envoy->DM callbacks (envoy_dynamic_module_on_*) with their own module names, and at the dynamic_modules loading phase, Envoy try to find the init symbol like foo_envoy_dynamic_module_on_init. If found, it is a statically linked module, and otherwise it will try to load the shared library normally. Since this functionality is very low-level and not available for normal end users (i.e. anyone using official binaries), i intentionally did not add the release note. Risk Level: low Testing: done Docs Changes: n/a Release Notes: n/a Platform Specific Features: --------- Signed-off-by: Takeshi Yoneda <tyoneda@netflix.com>
) Commit Message: dynamic_modules: support for statically linked modules Additional Description: This commit allows statically linked dynamic modules though in that case it is not really a "dynamic". This allows downstream users who build their own Envoy binary to statically link their modules using bazel natively. This will also set the foundation for our discussed direction of the project: allowing new core extensions written as a dynamic module. The idea is that these statically linked modules must prefix Envoy->DM callbacks (envoy_dynamic_module_on_*) with their own module names, and at the dynamic_modules loading phase, Envoy try to find the init symbol like foo_envoy_dynamic_module_on_init. If found, it is a statically linked module, and otherwise it will try to load the shared library normally. Since this functionality is very low-level and not available for normal end users (i.e. anyone using official binaries), i intentionally did not add the release note. Risk Level: low Testing: done Docs Changes: n/a Release Notes: n/a Platform Specific Features: --------- Signed-off-by: Takeshi Yoneda <tyoneda@netflix.com>
Commit Message: dynamic_modules: support for statically linked modules
Additional Description:
This commit allows statically linked dynamic modules though in that case it is not really a "dynamic". This allows downstream users who build their own Envoy binary to statically link their modules using bazel natively. This will also set the foundation for our discussed direction of the project: allowing new core extensions written as a dynamic module.
The idea is that these statically linked modules must prefix Envoy->DM callbacks (envoy_dynamic_module_on_*) with their own module names, and at the dynamic_modules loading phase, Envoy try to find the init symbol like foo_envoy_dynamic_module_on_init. If found, it is a statically linked module, and otherwise it will try to load the shared library normally.
Since this functionality is very low-level and not available for normal end users (i.e. anyone using official binaries), i intentionally did not add the release note.
Risk Level: low
Testing: done
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]
Verified that we can indeed build an Envoy binary with the Rust-SDK based dynamic module statically linked:
Produced