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

INCOMPLETE: upstream: add filter chains to upstream connections (#173) #3571

Closed
wants to merge 1 commit into from
Closed

INCOMPLETE: upstream: add filter chains to upstream connections (#173) #3571

wants to merge 1 commit into from

Conversation

alanconway
Copy link

This is an initial pull request for review, it is not yet or ready to merge.

It is working for https://github.com/alanconway/envoy-amqp but has (at least)
the following issues:

  1. The upstream uses a dummy NOT_IMPLEMENTED FactoryContext. FactoryContext has
    listener-specific methods, I'm not sure if/how they can be implemented by a
    Cluster.

  2. The "Filter" configuration is defined in listener.proto. I made cds.proto and
    upstream_impl.cc depend on listener.proto and added server:configuration_lib
    to upstream_includes. Probably the Filter definition and related bits should
    be moved to core.

  3. Need automated unit and integration tests. The code works with the AMQP filters
    but needs independent tests in the envoy repo.

There are TODO(aconway) comments at the code in question.

I would appreciate help and/or direction on how to resolve these and any other
issues that come up during review.

Signed-off-by: Alan Conway [email protected]

This is an initial pull request for review, it is not yet or ready to merge.

It is working for https://github.com/alanconway/envoy-amqp but has (at least)
the following issues:

1. The upstream uses a dummy NOT_IMPLEMENTED FactoryContext. FactoryContext has
   listener-specific methods, I'm not sure if/how they can be implemented by a
   Cluster.

2. The "Filter" configuration is defined in listener.proto. I made cds.proto and
   upstream_impl.cc depend on listener.proto and added server:configuration_lib
   to upstream_includes.  Probably the Filter definition and related bits should
   be moved to core.

3. Need automated unit and integration tests. The code works with the AMQP filters
   but needs independent tests in the envoy repo.

There are TODO(aconway) comments at the code in question.

I would appreciate help and/or direction on how to resolve these and any other
issues that come up during review.

Signed-off-by: Alan Conway <[email protected]>
@mattklein123 mattklein123 self-assigned this Jun 8, 2018
@mattklein123
Copy link
Member

cc @ggreenway can you also take a pass on this w/ initial comments? Related to upstream proxy proto.

Copy link
Contributor

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

I'm guessing some of this, like figuring out exactly what to do with the .proto's will take a few passes. Feel free to jump into envoy-dev in slack if you want to discuss more interactively.

// An optional list of network filters that make up the filter chain for
// outgoing connections made by the cluster. Order matters as the filters are
// processed sequentially as connection events happen.
repeated listener.Filter filters = 34 [(gogoproto.nullable) = false];
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that that type should probably be moved to core. I don't know if such a change breaks protobuf compatibility or not; we'll need to sort that out before making a change.

Copy link
Author

Choose a reason for hiding this comment

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

I started to do it and then backed off till I got feedback. I'll resurrect it for review. On the -dev list @mattklein123 seemed to feel it wouldn't be a breaking change but best put it in code first.

Copy link
Member

Choose a reason for hiding this comment

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

This type of change will cause a compile time breakage, but should not cause a wire breakage. I think it's worth it in this case. @alanconway can you make this change and then I can take a look?

Copy link
Contributor

Choose a reason for hiding this comment

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

Please also test that the canonical-json-protobuf is compatible after the change.

Copy link
Author

Choose a reason for hiding this comment

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

@ggreenway can you point to any existing tests for that kind of compatibility? I have yet to dive into the envoy test suite, I've been testing it from the outside so far.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know of any, but all I was thinking was to write a config that current-envoy will load that includes these bits, and add a test this config loads (and that the relevant bits seem to take effect).

@@ -253,6 +256,30 @@ ClusterLoadReportStats ClusterInfoImpl::generateLoadReportStats(Stats::Scope& sc
return {ALL_CLUSTER_LOAD_REPORT_STATS(POOL_COUNTER(scope))};
}

// TODO(alanconway): dummy factory context, how do we implement this? Some of
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the only fields that are listener-specific are listenerScope(), listenerMetadata(), and possibly drainDecision().

listenerScope() is only used in a few places in the code-base. We may be able to leave it NOT_IMPLEMENTED here, or maybe rename it to ownerScope() or something more generic, and pass it the cluster's scope.

listenerMetadata() isn't called anywhere except one test. Can it be deleted? Or am I missing something?

@@ -340,6 +367,30 @@ ClusterInfoImpl::ClusterInfoImpl(const envoy::api::v2::Cluster& config,
idle_timeout_ = std::chrono::milliseconds(
DurationUtil::durationToMilliseconds(config.common_http_protocol_options().idle_timeout()));
}

auto filters = config.filters();
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks very similar to the code in listemer_manager_impl. Dedupe?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, cut-and-paste. It should be pulled up to a common place. Thought I had a TODO on that one, well spotted.

@stale
Copy link

stale bot commented Jun 20, 2018

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jun 20, 2018
@stale
Copy link

stale bot commented Jun 27, 2018

This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot closed this Jun 27, 2018
@alanconway alanconway deleted the upstream-filter branch September 27, 2018 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale stalebot believes this issue/PR has not been touched recently
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants