Skip to content

allow specifying the API version of bootstrap from the command line#10803

Merged
htuch merged 18 commits intoenvoyproxy:masterfrom
snowp:specify-version
Apr 23, 2020
Merged

allow specifying the API version of bootstrap from the command line#10803
htuch merged 18 commits intoenvoyproxy:masterfrom
snowp:specify-version

Conversation

@snowp
Copy link
Copy Markdown
Contributor

@snowp snowp commented Apr 16, 2020

Adds a --boostrap_version flag that can be used to determine which API version the bootstrap should be parsed as.

Risk Level: Low
Testing: UTs
Docs Changes: Flag docs
Release Notes: n/a
Fixes #10343

@snowp
Copy link
Copy Markdown
Contributor Author

snowp commented Apr 16, 2020

Just wanted to put something up to see if we think this is the right kind of approach, there are a few issues currently:

  • having to map from a version string to LATEST_VERSION/EARLIEST_VERSION is a bit gross feeling, should this instead just bypass all of the API boosting?
  • As a result of hooking into the API boosting wrapper, the failure when its set to v2 throws an ApiBoostRetryException, which results in a less than idea error message prompting the user to "try again"

@htuch

Copy link
Copy Markdown
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 for taking this on!

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.

Should it just be an integer, since we won't have non-integer major versions?

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.

The repetition with the code below might support refactoring if we go down this path.

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 agree this is a bit ungraceful. I think the alternative is we supply to loadFromJson etc. the type URL of the bootstrap that we know exists on the filesystem, e.g. envoy.config.bootstrap.v2. We can do that mapping here.

Then, we load JSON specifically into a message that we build from reflection with that type. We then have a v2 bootstrap message. Following this, we do a VersionConverter::upgrade to the v3 bootstrap Envoy is using internally. LMK if you need more details on this, we have some examples of each of these things around.

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.

That makes sense to me, it's along the lines of what I had in mind as well for a way doing this by bypassing the whole withApiBoosting helper. I'll give that a go and see how it goes

@repokitteh-read-only
Copy link
Copy Markdown

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

🐱

Caused by: #10803 was synchronize by snowp.

see: more, trace.

Copy link
Copy Markdown
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.

Generally looks great, it's pretty easy to understand now..
/wait

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.

Does this still need to move?

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.

Does this still need to be rewritten?

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.

Nit: prefer not explicitly state captures.

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.

Should there be some positive tests as well for explicit version CLI?

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.

Should this use a strict validator and reject?

@snowp
Copy link
Copy Markdown
Contributor Author

snowp commented Apr 21, 2020

Huh for some reason DCO is broken on one of the commits. I'll fix once this is approved

htuch
htuch previously approved these changes Apr 22, 2020
Copy link
Copy Markdown
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, thanks!

Snow Pettersen added 16 commits April 21, 2020 17:54
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
Signed-off-by: Snow Pettersen <kpettersen@netflix.com>
}

// Validate that we correctly parse a V2 file when configured to do so.
TEST_P(ServerInstanceImplTest, LoadsV2ConfigWhenV2SelectedFromPbText) {
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.

Hmm this seems to fail under compile_time_options with

[ RUN      ] IpVersions/ServerInstanceImplTest.LoadsV2ConfigWhenV2SelectedFromPbText/IPv4
[libprotobuf WARNING external/com_google_protobuf/src/google/protobuf/text_format.cc:324] Warning parsing text-format envoy.config.bootstrap.v2.Bootstrap: 4:1: text format contains deprecated field "build_version"
[2020-04-22 05:18:57.856][17][critical][main] [external/envoy/source/server/server.cc:98] error initializing configuration '/b/f/w/_tmp/fa9accb9e25432420d3f5adcb6c78680/valid_v2_but_invalid_v3_bootstrap.pb_text.with.ports.pb_text': Proto constraint validation failed (Using deprecated option 'envoy.api.v2.core.Node.build_version' from file base.proto. This configuration will be removed from Envoy soon. Please see https://www.envoyproxy.io/docs/envoy/latest/intro/deprecated for details. If continued use of this field is absolutely necessary, see https://www.envoyproxy.io/docs/envoy/latest/configuration/operations/runtime#using-runtime-overrides-for-deprecated-features for how to apply a temporary and highly discouraged override.): id: "bootstrap_id"
build_version: "foo"

unknown file: Failure
C++ exception with description "Proto constraint validation failed (Using deprecated option 'envoy.api.v2.core.Node.build_version' from file base.proto. This configuration will be removed from Envoy soon. Please see https://www.envoyproxy.io/docs/envoy/latest/intro/deprecated for details. If continued use of this field is absolutely necessary, see https://www.envoyproxy.io/docs/envoy/latest/configuration/operations/runtime#using-runtime-overrides-for-deprecated-features for how to apply a temporary and highly discouraged override.): id: "bootstrap_id"
build_version: "foo"
" thrown in the test body.
[  FAILED  ] IpVersions/ServerInstanceImplTest.LoadsV2ConfigWhenV2SelectedFromPbText/IPv4, where GetParam() = 4-byte object <00-00 00-00> (4 ms)

presumably since we run the test with --disabled-features=disabled. Thoughts on how to make this test work @htuch ?

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.

Can this be a DEPRECATED_FEATURE_TEST?

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.

Yep this worked, thanks!

snowp added 2 commits April 22, 2020 22:20
Signed-off-by: Snow Pettersen <aickck@gmail.com>
Signed-off-by: Snow Pettersen <aickck@gmail.com>
Copy link
Copy Markdown
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, thanks!

@htuch htuch merged commit 62777e8 into envoyproxy:master Apr 23, 2020
spenceral added a commit to spenceral/envoy that referenced this pull request Apr 23, 2020
Signed-off-by: Spencer Lewis <slewis@squareup.com>
* master: (46 commits)
  allow specifying the API version of bootstrap from the command line (envoyproxy#10803)
  config: adding connect matcher (unused) (envoyproxy#10894)
  Add missing dependency on `assert.h` (envoyproxy#10918)
  Lower heap and disk space used by kafka tests (envoyproxy#10915)
  [tools] handle commits merged without PR in deprecated script (envoyproxy#10723)
  tools: including working tree in modified_since_last_github_commit.sh diff. (envoyproxy#10911)
  rocketmq_proxy: implement rocketmq proxy
  [docs] PR template to include commit message (envoyproxy#10900)
  docs: breaking long word to stop content overflow. (envoyproxy#10880)
  Delete legacy connection pool code. (envoyproxy#10881)
  wasm: clarify how configuration is passed (envoyproxy#10782)
  issue template: clarify security/crash reporting (envoyproxy#10885)
  api/faq: add entry on incremental xDS. (envoyproxy#10876)
  router: retry overloaded requests (envoyproxy#10847)
  Remove inclusion of pthread.h, not needed for linux compilation (envoyproxy#10895)
  request_id: Add option to always set request id in response (envoyproxy#10808)
  xray: Use correct types for segment document output (envoyproxy#10834)
  router: fixing a watermark bug for streaming retries (envoyproxy#10866)
  http: auditing Path() calls for safety with Pathless CONNECT (envoyproxy#10851)
  Remove hardcoded type urls Part.2 (envoyproxy#10848)
  ...
@moderation
Copy link
Copy Markdown
Contributor

FYI @snowp, I'm running envoy --bootstrap-version 3 --service-cluster <servicename> --service-node <hostname> --base-id 1 --config-path <config.json> --log-level info but the output of :<adminport>/server_info returns "bootstrap_version": 0,. Is that expected?

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.

Explicit v2/v3 versioning in YAML/JSON files

3 participants