Skip to content

dynamic forward proxy: add factory declarations + linking validation#7889

Merged
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
rebello95:forward-proxy
Aug 11, 2019
Merged

dynamic forward proxy: add factory declarations + linking validation#7889
mattklein123 merged 4 commits intoenvoyproxy:masterfrom
rebello95:forward-proxy

Conversation

@rebello95
Copy link
Copy Markdown
Contributor

@rebello95 rebello95 commented Aug 9, 2019

In Envoy Mobile, we'll be using the dynamic forward proxy configuration as the defacto template for starting up Envoy. In the process of integrating this, we found that when we include the extension, the proto file for configuration gets stripped out and thus fails at runtime when starting up the Envoy instance. This PR fixes the issue by allowing us to force-register the necessary extensions and ensure the proto file is not stripped.

  • Adds factory declarations for the dynamic forward proxy filter and cluster using the DECLARE_FACTORY macro
  • Adds a dummy proto which is then referenced in the implementation of the extension to force the proto file to be included with the extension (rather than being stripped) Not necessary because this proto isn't a service
  • Validates that the proto descriptor for the cluster config is present using an assertion

A similar change for validating proto descriptors are present was checked in here, and an example of how we've added dummy proto messages for this purpose in the past can be found here.

Risk Level: Low
Testing: Done locally, and CI
Docs Changes: None
Release Notes: None

Signed-off-by: Michael Rebello me@michaelrebello.com

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: Michael Rebello <me@michaelrebello.com>
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #7889 was synchronize by rebello95.

see: more, trace.

Copy link
Copy Markdown
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, LGTM with 1 question.

/wait

// [#protodoc-title: Dynamic forward proxy cluster configuration]

// [#not-implemented-hide:] Not configuration. Workaround for C++ issue with stripping proto files.
message ClusterDummy {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I might be wrong but I don't think you need any of this as there is no service here. The protos will be compiled in when the code is used

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hm yea looks like you're right. Removed the dummy proto but kept the validation assert around because that seems useful. LMK if you think we should remove/change it

@mattklein123 mattklein123 self-assigned this Aug 9, 2019
Signed-off-by: Michael Rebello <me@michaelrebello.com>
Copy link
Copy Markdown
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.

LGTM but I would remove the verification code. Thank you!

/wait


// This function validates that the message descriptors that
// are referenced in Any messages are available in the descriptor pool.
bool validateProtoDescriptors();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah I would just kill all of this. The filter code won't compile if it's missing so there is no chance of it getting elided from the build.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

SGTM, done

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Copy link
Copy Markdown
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!

@mattklein123 mattklein123 merged commit 922f2f9 into envoyproxy:master Aug 11, 2019
rebello95 added a commit to envoyproxy/envoy-mobile that referenced this pull request Aug 13, 2019
We'll be using the [dynamic forward proxy configuration](https://www.envoyproxy.io/docs/envoy/latest/configuration/http_filters/dynamic_forward_proxy_filter#config-http-filters-dynamic-forward-proxy) as the defacto configuration that will ship with Envoy Mobile. This will allow us to avoid making consumers register the DNS/domains they need to support when starting up the Envoy instance.

This PR:
- Pulls in the upstream fixes to support for this in envoyproxy/envoy#7889
- Moves our example config to use the dynamic forward proxy
- Updates our main interfaces to force register the necessary extensions

Future PRs will:
- Move this into a resource compiled with the library
- Convert it to a template
- Provide typed configurations for wrapping the template
- Enable TLS: #322

Part of #169.

Signed-off-by: Michael Rebello <me@michaelrebello.com>
jpsim pushed a commit that referenced this pull request Nov 28, 2022
We'll be using the [dynamic forward proxy configuration](https://www.envoyproxy.io/docs/envoy/latest/configuration/http_filters/dynamic_forward_proxy_filter#config-http-filters-dynamic-forward-proxy) as the defacto configuration that will ship with Envoy Mobile. This will allow us to avoid making consumers register the DNS/domains they need to support when starting up the Envoy instance.

This PR:
- Pulls in the upstream fixes to support for this in #7889
- Moves our example config to use the dynamic forward proxy
- Updates our main interfaces to force register the necessary extensions

Future PRs will:
- Move this into a resource compiled with the library
- Convert it to a template
- Provide typed configurations for wrapping the template
- Enable TLS: envoyproxy/envoy-mobile#322

Part of envoyproxy/envoy-mobile#169.

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: JP Simard <jp@jpsim.com>
jpsim pushed a commit that referenced this pull request Nov 29, 2022
We'll be using the [dynamic forward proxy configuration](https://www.envoyproxy.io/docs/envoy/latest/configuration/http_filters/dynamic_forward_proxy_filter#config-http-filters-dynamic-forward-proxy) as the defacto configuration that will ship with Envoy Mobile. This will allow us to avoid making consumers register the DNS/domains they need to support when starting up the Envoy instance.

This PR:
- Pulls in the upstream fixes to support for this in #7889
- Moves our example config to use the dynamic forward proxy
- Updates our main interfaces to force register the necessary extensions

Future PRs will:
- Move this into a resource compiled with the library
- Convert it to a template
- Provide typed configurations for wrapping the template
- Enable TLS: envoyproxy/envoy-mobile#322

Part of envoyproxy/envoy-mobile#169.

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: JP Simard <jp@jpsim.com>
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