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: shadow-based upgrading/downgrading for versioned messages. #9502

Merged
merged 13 commits into from
Jan 2, 2020

Conversation

htuch
Copy link
Member

@htuch htuch commented Dec 27, 2019

This PR replaces the previous unknown field smuggling style of upgrading
with shadow-based. Ultimately, we want to move away from shadows, but
for 1.13.0 this simplifies by removing smuggling.

In addition, we make two major changes that are backported from the
WiP v3alpha branch:

  1. Rather than make translateOpaqueConfig() smart and version/type
    aware, we switch to an iterative loadFromJson() that first attempts
    to load as v2 and then falls back to v3. This relies on the property
    that any v3 configuration that is ingestible as v2 has the same
    semantics in v2/v3, which holds due to the highly structured
    vN/v(N+1) mechanical transforms.

  2. Support for downgrading to earlier versions is introduced to make it
    easier for tests that are within the v(N-1) subset of vN to continue
    to validate v(N-1), while still mostly using vN messages. This is
    particularly useful for ensuring that e2e integration tests are using
    v2 resources. As new v3 tests are introduced, tests will need to
    eschew downgrading, but this should be a viable approach for 1.13.0.

Risk level: Low
Testing: additional unit tests added to cover opaque config conversion, Any unpacking, JSON loading and version conversion.

Part of #8082

Signed-off-by: Harvey Tuch [email protected]

This PR replaces the previous unknown field smuggling style of upgrading
with shadow-based. Ultimately, we want to move away from shadows, but
for 1.13.0 this simplifies by removing smuggling.

In addition, we make two major changes that are backported from the
WiP v3alpha branch:

1. Rather than make translateOpaqueConfig() smart and version/type
   aware, we switch to an iterative loadFromJson() that first attempts
   to load as v2 and then falls back to v3. This relies on the property
   that any v3 configuration that is ingestible as v2 has the same
   semantics in v2/v3, which holds due to the highly structured
   vN/v(N+1) mechanical transforms.

2. Support for downgrading to earlier versions is introduced to make it
   easier for tests that are within the v(N-1) subset of vN to continue
   to validate v(N-1), while still mostly using vN messages. This is
   particularly useful for ensuring that e2e integration tests are using
   v2 resources. As new v3 tests are introduced, tests will need to
   eschew downgrading, but this should be a viable approach for 1.13.0.

Risk level: Low
Testing: There's a bunch of new tests that need to be added for version
  converter, loadFroJson/unpackTo() and translateOpaqueConfig(). Putting
  this PR out for comment to get feedback.

Part of envoyproxy#8082

Signed-off-by: Harvey Tuch <[email protected]>
@htuch htuch added the api/v3 Major version release @ end of Q3 2019 label Dec 27, 2019
@htuch
Copy link
Member Author

htuch commented Dec 27, 2019

Tests added, ready for review in full.

@htuch
Copy link
Member Author

htuch commented Dec 30, 2019

@mattklein123 @lizan would it be possible to get a review on this one? This is the last substantial non-tooling related PR prior to the mega-upgrade?

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

Very impressive. In general this makes sense to me and is conceptually a lot easier to understand. I'm flushing out some random small comments but will need to take one more pass through to make sure I understand it. Would definitely appreciate a review from @lizan also.

/wait

source/common/config/version_converter.cc Outdated Show resolved Hide resolved
source/common/config/version_converter.cc Outdated Show resolved Hide resolved
Comment on lines 21 to 22
message.SerializeToString(&s);
downgraded_message->msg_->ParseFromString(s);
Copy link
Member

Choose a reason for hiding this comment

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

Q: When we do this pattern is there any concern around non-deterministic ordering of the conversion? Might this get confusing when using dump tools or anything else which depends on the output? Should we be using the deterministic serialization options? Also maybe move this pattern to a utility function where we do it so we can better explain what we are doing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since both descriptors are fully known, as are any extensions/options that should be material to representation or other debug use, and we're remaining at the abstraction level of messages, I think it's safe to do this. But, I would be keen to hear what @lizan has to say on this. I'll factor it out to a separate utility meanwhile.

source/common/protobuf/utility.cc Outdated Show resolved Hide resolved
test/common/config/api_type_oracle_test.cc Outdated Show resolved Hide resolved
@htuch htuch merged commit d025ac0 into envoyproxy:master Jan 2, 2020
@htuch htuch deleted the shadow-encoding branch January 2, 2020 15:36
prakhag1 pushed a commit to prakhag1/envoy that referenced this pull request Jan 3, 2020
…nvoyproxy#9502)

* config: shadow-based upgrading/downgrading for versioned messages.

This PR replaces the previous unknown field smuggling style of upgrading
with shadow-based. Ultimately, we want to move away from shadows, but
for 1.13.0 this simplifies by removing smuggling.

In addition, we make two major changes that are backported from the
WiP v3alpha branch:

1. Rather than make translateOpaqueConfig() smart and version/type
   aware, we switch to an iterative loadFromJson() that first attempts
   to load as v2 and then falls back to v3. This relies on the property
   that any v3 configuration that is ingestible as v2 has the same
   semantics in v2/v3, which holds due to the highly structured
   vN/v(N+1) mechanical transforms.

2. Support for downgrading to earlier versions is introduced to make it
   easier for tests that are within the v(N-1) subset of vN to continue
   to validate v(N-1), while still mostly using vN messages. This is
   particularly useful for ensuring that e2e integration tests are using
   v2 resources. As new v3 tests are introduced, tests will need to
   eschew downgrading, but this should be a viable approach for 1.13.0.

Risk level: Low
Testing: additional unit tests added to cover opaque config conversion, Any unpacking, JSON loading and version conversion.

Part of envoyproxy#8082

Signed-off-by: Harvey Tuch <[email protected]>
Signed-off-by: Prakhar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api/v3 Major version release @ end of Q3 2019
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants