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

config: add support Any as opaque config #5435

Merged
merged 8 commits into from
Jan 10, 2019
Merged

Conversation

lizan
Copy link
Member

@lizan lizan commented Dec 28, 2018

Signed-off-by: Lizan Zhou lizan@tetrate.io

Description:
Add support of Any as opaque config for extensions. Deprecates Struct configs. Fixes #4475.

Risk Level: Low
Testing: CI
Docs Changes: Added.
Release Notes: Added.

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
@lizan lizan requested a review from htuch December 28, 2018 01:45
@lizan
Copy link
Member Author

lizan commented Dec 29, 2018

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: release (failed build)

🐱

Caused by: a #5435 (comment) was created by @lizan.

see: more, trace.

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Thanks so much for making this happen @lizan. Some comments, but mostly looks good. I'll be able to resume reviewing on Friday, thanks.

void Utility::translateOpaqueConfig(const ProtobufWkt::Any& typed_config,
const ProtobufWkt::Struct& config,
Protobuf::Message& out_proto) {
static const std::string struct_type =
Copy link
Member

Choose a reason for hiding this comment

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

Static initialization fiasco and non-POD?

Copy link
Member Author

Choose a reason for hiding this comment

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

It shouldn't be problem since it is initialized in first call, but anyway it is also safe to make it as a reference.

// Get the cluster with extension_protocol_options for an http filter factory.
TestHttpFilterConfigFactory factory(factoryBase);
Registry::InjectFactory<Server::Configuration::NamedHttpFilterConfigFactory> registry(factory);
clusters.push_back(makeCluster(typed_yaml));
Copy link
Member

Choose a reason for hiding this comment

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

QQ: do we have a plan to convert all existing test configs and examples to Any? What about docs? Should we have a tracking bug?

Copy link
Member

Choose a reason for hiding this comment

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

Friendly ping, any update on where we are with this and other comments?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah by the time we remove Struct configs we should convert all including examples, I'm planning add a doc in a follow up too.

Copy link
Member

Choose a reason for hiding this comment

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

True, but ideally we convert the docs and examples ahead-of-time in the deprecation cycle, so we want to do this before then.

if (type != struct_type || out_proto.GetDescriptor()->full_name() == struct_type) {
typed_config.UnpackTo(&out_proto);
} else {
ProtobufWkt::Struct struct_config;
Copy link
Member

Choose a reason for hiding this comment

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

Can you add tests for this branch? Looks like it is missing coverage.

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦‍♂️ it should be fixed now.

DEPRECATED.md Outdated Show resolved Hide resolved
@stale
Copy link

stale bot commented Jan 5, 2019

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 Jan 5, 2019
@lizan lizan removed the stale stalebot believes this issue/PR has not been touched recently label Jan 6, 2019
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
lizan added 4 commits January 6, 2019 12:59
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
htuch
htuch previously approved these changes Jan 10, 2019
Copy link
Member

@htuch htuch 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 needs master merge.

htuch
htuch previously approved these changes Jan 10, 2019
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
@lizan
Copy link
Member Author

lizan commented Jan 10, 2019

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: release (failed build)
🔨 rebuilding ci/circleci: clang_tidy (failed build)
🔨 rebuilding ci/circleci: asan (failed build)
🔨 rebuilding ci/circleci: tsan (failed build)
🔨 rebuilding ci/circleci: api (failed build)
🔨 rebuilding ci/circleci: compile_time_options (failed build)
🔨 rebuilding ci/circleci: coverage (failed build)
🔨 rebuilding ci/circleci: ipv6_tests (failed build)
🔨 rebuilding ci/circleci: mac (failed build)

🐱

Caused by: a #5435 (comment) was created by @lizan.

see: more, trace.

ProtobufWkt::Struct struct_config;
typed_config.UnpackTo(&struct_config);
MessageUtil::jsonConvert(struct_config, out_proto);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't there be a return after this line?

Copy link
Member

Choose a reason for hiding this comment

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

It wouldn't hurt, but I think the invariant is that !typed_config.empty ^ !config.empty, i.e. they should generally be disjoint via oneof.

fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
Add support of Any as opaque config for extensions. Deprecates Struct configs. Fixes envoyproxy#4475.

Risk Level: Low
Testing: CI
Docs Changes: Added.
Release Notes: Added.

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Fred Douglas <fredlas@google.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.

3 participants