-
Notifications
You must be signed in to change notification settings - Fork 5.4k
xDS: add xDS config tracker extension point #23485
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
Merged
mattklein123
merged 43 commits into
envoyproxy:main
from
botengyao:xds-metadata-extension-point
Dec 13, 2022
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
4d2c47e
intitial commit for xds tracer extension point
botengyao b5234d2
clean up
botengyao ba27917
clean up
botengyao 43b5983
add some docs
botengyao bdc4b16
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 12bb4f3
clean up
botengyao 51533cf
clean up
botengyao 7ac3748
clean up
botengyao a04823a
fix format
botengyao 5f4ed83
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 2ab302b
Add more comments
botengyao 340d71e
fix typo
botengyao ca58505
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao acfb636
make it more generic
botengyao fe3066e
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 2c11de7
clean up
botengyao f19005e
fix format
botengyao 8a4b472
changed name to onConfigReceivedOrFailed
botengyao 11c8def
changed name to onConfigReceivedOrFailed
botengyao a48502a
clean up
botengyao 3efd2b3
add unified mux xds
botengyao 1a65c33
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 6796419
add comments
botengyao 7aec7d1
fix spell
botengyao adaf244
fix ci
botengyao 621327d
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao a144dbd
fix ci
botengyao bf8105c
fix clang
botengyao 91dc002
fix intergration test
botengyao b897721
clean up
botengyao b805acb
fix comments
botengyao ac31b6e
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao a382c6d
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 9b23b37
simplify test
botengyao 41a3f13
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 27d1072
add more integration tests
botengyao 982cd9d
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao cf96f4b
fix typo
botengyao cb9dddb
modify comments and make test specific
botengyao e5a9acc
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao 348aa7f
fix typo
botengyao 7a90bcc
modify api comments and add release notes
botengyao 9003a4d
Merge remote-tracking branch 'upstream/main' into xds-metadata-extens…
botengyao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| #pragma once | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include "envoy/common/optref.h" | ||
| #include "envoy/config/subscription.h" | ||
| #include "envoy/config/typed_config.h" | ||
| #include "envoy/protobuf/message_validator.h" | ||
| #include "envoy/stats/scope.h" | ||
|
|
||
| #include "source/common/protobuf/protobuf.h" | ||
|
|
||
| #include "google/rpc/status.pb.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Config { | ||
|
|
||
| /** | ||
| * An interface for hooking into xDS update events to provide the ablility to use some external | ||
| * processor in xDS update. This tracker provides the process point when the discovery response | ||
| * is received, when the resources are successfully processed and applied, and when there is any | ||
| * failure. | ||
| * | ||
| * Instance of this interface get invoked on the main Envoy thread. Thus, it is important | ||
| * for implementations of this interface to not execute any blocking operations on the same | ||
| * thread. | ||
| */ | ||
| class XdsConfigTracker { | ||
| public: | ||
| virtual ~XdsConfigTracker() = default; | ||
|
|
||
| /** | ||
| * Invoked when SotW xDS configuration updates have been successfully parsed, applied on | ||
| * the Envoy instance, and are about to be ACK'ed. | ||
| * | ||
| * For SotW, the passed resources contain all the received resources except for the heart-beat | ||
| * ones in the original message. The call of this method means there is a subscriber for this | ||
| * type_url and the type of resource is same as the message's type_url. | ||
| * | ||
| * Note: this method is called when *all* the resources in a response are accepted. | ||
| * | ||
| * @param type_url The type url of xDS message. | ||
| * @param resources A list of decoded resources to add to the current state. | ||
| */ | ||
| virtual void onConfigAccepted(const absl::string_view type_url, | ||
| const std::vector<DecodedResourcePtr>& resources) PURE; | ||
|
|
||
| /** | ||
| * Invoked when Delta xDS configuration updates have been successfully accepted, applied on | ||
| * the Envoy instance, and are about to be ACK'ed. | ||
| * | ||
| * For Delta, added_resources contains all the received added resources except for the heart-beat | ||
| * ones in the original message, and the removed resources are the same in the xDS message. | ||
| * | ||
| * Note: this method is called when *all* the resources in a response are accepted. | ||
| * | ||
| * @param type_url The type url of xDS message. | ||
| * @param added_resources A list of decoded resources to add to the current state. | ||
|
botengyao marked this conversation as resolved.
|
||
| * @param removed_resources A list of resources to remove from the current state. | ||
| */ | ||
| virtual void onConfigAccepted( | ||
| const absl::string_view type_url, | ||
| const Protobuf::RepeatedPtrField<envoy::service::discovery::v3::Resource>& added_resources, | ||
| const Protobuf::RepeatedPtrField<std::string>& removed_resources) PURE; | ||
|
|
||
| /** | ||
| * Invoked when xds configs are rejected during xDS ingestion. | ||
| * | ||
| * @param message The SotW discovery response message body. | ||
| * @param details The process state and error details. | ||
| */ | ||
| virtual void onConfigRejected(const envoy::service::discovery::v3::DiscoveryResponse& message, | ||
| const absl::string_view error_detail) PURE; | ||
|
|
||
| /** | ||
| * Invoked when xds configs are rejected during xDS ingestion. | ||
| * | ||
| * @param message The Delta discovery response message body. | ||
| * @param details The process state and error details. | ||
| */ | ||
| virtual void | ||
| onConfigRejected(const envoy::service::discovery::v3::DeltaDiscoveryResponse& message, | ||
| const absl::string_view error_detail) PURE; | ||
| }; | ||
|
|
||
| using XdsConfigTrackerPtr = std::unique_ptr<XdsConfigTracker>; | ||
| using XdsConfigTrackerOptRef = OptRef<XdsConfigTracker>; | ||
|
|
||
| /** | ||
| * A factory abstract class for creating instances of XdsConfigTracker. | ||
| */ | ||
| class XdsConfigTrackerFactory : public Config::TypedFactory { | ||
| public: | ||
| ~XdsConfigTrackerFactory() override = default; | ||
|
|
||
| /** | ||
| * Creates an XdsConfigTracker using the given config. | ||
| */ | ||
| virtual XdsConfigTrackerPtr | ||
| createXdsConfigTracker(const ProtobufWkt::Any& config, | ||
| ProtobufMessage::ValidationVisitor& validation_visitor, | ||
| Event::Dispatcher& dispatcher, Stats::Scope& stats) PURE; | ||
|
|
||
| std::string category() const override { return "envoy.config.xds_tracker"; } | ||
| }; | ||
|
|
||
| } // namespace Config | ||
| } // namespace Envoy | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.