Skip to content

config: Specify Bootstrap as proto object to Envoy::OptionsImpl#7722

Merged
jmarantz merged 10 commits intoenvoyproxy:masterfrom
fcfort:bootstrap_text_proto
Jul 27, 2019
Merged

config: Specify Bootstrap as proto object to Envoy::OptionsImpl#7722
jmarantz merged 10 commits intoenvoyproxy:masterfrom
fcfort:bootstrap_text_proto

Conversation

@fcfort
Copy link
Copy Markdown
Contributor

@fcfort fcfort commented Jul 25, 2019

Description: Adds a method to Envoy::OptionsImpl to allow specifying the bootstrap configuration as a proto Bootstrap object directly rather than using the configYaml or configPath options.

This would allow clients to directly specify a Bootstrap proto object without having to deal with yaml serialization and would simplify our configuration process since we construct the Bootstrap proto programmatically as a protocol buffer.

This is not a command line flag like configYaml or configPath since this is not a serialized attribute of the options and we don't want to allow for a separate configuration path that isn't YAML.

I moved the validation of the config flags to source/server/options_impl.cc so that test/integration:run_envoy_test would pass, since we now have a config source that isn't specified on the command line.

Risk Level: Low
Testing: Ran bazel test test/common/... test/exe/... test/integration/... test/mocks/... test/config_test/... test/server:options_impl_test
Docs Changes: N/A
Release Notes: N/A
Fixes #7713

fcfort added 5 commits July 24, 2019 18:17
Signed-off-by: Frank Fort <ffort@google.com>
Signed-off-by: Frank Fort <ffort@google.com>
…ide the command line

Signed-off-by: Frank Fort <ffort@google.com>
Signed-off-by: Frank Fort <ffort@google.com>
Signed-off-by: Frank Fort <ffort@google.com>
fcfort added 2 commits July 25, 2019 17:33
…breaks everything

Signed-off-by: Frank Fort <ffort@google.com>
Signed-off-by: Frank Fort <ffort@google.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.

Thank you, a few small comments.

/wait

void setBaseId(uint64_t base_id) { base_id_ = base_id; };
void setConcurrency(uint32_t concurrency) { concurrency_ = concurrency; }
void setConfigPath(const std::string& config_path) { config_path_ = config_path; }
void setConfigProto(const envoy::config::bootstrap::v2::Bootstrap& config_proto) {
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.

Any reason to not just take this as an optional constructor arg? Then it can also be const below.

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.

The reason I wanted to make this a setter was because we use the argc/argv version of OptionsImpl to first initialize OptionsImpl from the command line and then later mutate it via these setter functions.

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.

OK sounds good.

Signed-off-by: Frank Fort <ffort@google.com>
Signed-off-by: Frank Fort <ffort@google.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, LGTM modulo a few small comments.

/wait

bootstrap.MergeFrom(bootstrap_override);
}
if (config_proto.ByteSize() != 0) {
bootstrap.MergeFrom(config_proto);
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.

Do you have a server test that actually covers this case?

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.

Sorry missed this. Added a few tests to verify the order that Bootstrap config is read from the various config functions.

Signed-off-by: Frank Fort <ffort@google.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!

@jmarantz jmarantz merged commit c37234b into envoyproxy:master Jul 27, 2019
@fcfort fcfort deleted the bootstrap_text_proto branch July 29, 2019 13:30
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.

Allow Envoy::OptionsImpl to take a Bootstrap proto object directly

4 participants