forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
router: Create InternalRedirectPolicy in side RouteAction and extend …
…it with pluggable predicates (envoyproxy#10908) Description: router: Create InternalRedirectPolicy to capture all internal redirect related options and extend it with pluggable predicates similar to retry plugins. The previous_routes and whitelisted_routes predicate allow creating a DAG of routes for internal redirects. Each node in the DAG is a route. whitelisted_routes defines the edges of each node. previous_routes serves as visited status keeper for each of the edge. This prevents infinite loop, while allowing loop to exist in the DAG. Risk Level: Medium Testing: Unit tests. Integration tests. Docs Changes: Updated HCM architecture overview page. Added toctree for the predicates. Release Notes: Updated version history. Signed-off-by: pengg <[email protected]>
- Loading branch information
1 parent
3550a7a
commit 1ce0109
Showing
60 changed files
with
1,761 additions
and
177 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains 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 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 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 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
9 changes: 9 additions & 0 deletions
9
api/envoy/extensions/internal_redirect/allow_listed_routes/v3/BUILD
This file contains 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,9 @@ | ||
# DO NOT EDIT. This file is generated by tools/proto_sync.py. | ||
|
||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
||
licenses(["notice"]) # Apache 2 | ||
|
||
api_proto_package( | ||
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], | ||
) |
24 changes: 24 additions & 0 deletions
24
...nvoy/extensions/internal_redirect/allow_listed_routes/v3/allow_listed_routes_config.proto
This file contains 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,24 @@ | ||
syntax = "proto3"; | ||
|
||
package envoy.extensions.internal_redirect.allow_listed_routes.v3; | ||
|
||
import "udpa/annotations/status.proto"; | ||
import "udpa/annotations/versioning.proto"; | ||
import "validate/validate.proto"; | ||
|
||
option java_package = "io.envoyproxy.envoy.extensions.internal_redirect.allow_listed_routes.v3"; | ||
option java_outer_classname = "AllowListedRoutesConfigProto"; | ||
option java_multiple_files = true; | ||
option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
|
||
// [#protodoc-title: Allow listed routes internal redirect predicate] | ||
|
||
// An internal redirect predicate that accepts only explicitly allowed target routes. | ||
// [#extension: envoy.internal_redirect_predicates.allow_listed_routes] | ||
message AllowListedRoutesConfig { | ||
// The list of routes that's allowed as redirect target by this predicate, | ||
// identified by the route's :ref:`name <envoy_api_field_config.route.v3.Route.route>`. | ||
// Empty route names are not allowed. | ||
repeated string allowed_route_names = 1 | ||
[(validate.rules).repeated = {items {string {min_len: 1}}}]; | ||
} |
9 changes: 9 additions & 0 deletions
9
api/envoy/extensions/internal_redirect/previous_routes/v3/BUILD
This file contains 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,9 @@ | ||
# DO NOT EDIT. This file is generated by tools/proto_sync.py. | ||
|
||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
||
licenses(["notice"]) # Apache 2 | ||
|
||
api_proto_package( | ||
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], | ||
) |
19 changes: 19 additions & 0 deletions
19
api/envoy/extensions/internal_redirect/previous_routes/v3/previous_routes_config.proto
This file contains 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,19 @@ | ||
syntax = "proto3"; | ||
|
||
package envoy.extensions.internal_redirect.previous_routes.v3; | ||
|
||
import "udpa/annotations/status.proto"; | ||
import "udpa/annotations/versioning.proto"; | ||
|
||
option java_package = "io.envoyproxy.envoy.extensions.internal_redirect.previous_routes.v3"; | ||
option java_outer_classname = "PreviousRoutesConfigProto"; | ||
option java_multiple_files = true; | ||
option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
|
||
// [#protodoc-title: Previous routes internal redirect predicate] | ||
|
||
// An internal redirect predicate that rejects redirect targets that are pointing | ||
// to a route that has been followed by a previous redirect from the current route. | ||
// [#extension: envoy.internal_redirect_predicates.previous_routes] | ||
message PreviousRoutesConfig { | ||
} |
9 changes: 9 additions & 0 deletions
9
api/envoy/extensions/internal_redirect/safe_cross_scheme/v3/BUILD
This file contains 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,9 @@ | ||
# DO NOT EDIT. This file is generated by tools/proto_sync.py. | ||
|
||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
||
licenses(["notice"]) # Apache 2 | ||
|
||
api_proto_package( | ||
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], | ||
) |
24 changes: 24 additions & 0 deletions
24
api/envoy/extensions/internal_redirect/safe_cross_scheme/v3/safe_cross_scheme_config.proto
This file contains 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,24 @@ | ||
syntax = "proto3"; | ||
|
||
package envoy.extensions.internal_redirect.safe_cross_scheme.v3; | ||
|
||
import "udpa/annotations/status.proto"; | ||
import "udpa/annotations/versioning.proto"; | ||
import "validate/validate.proto"; | ||
|
||
option java_package = "io.envoyproxy.envoy.extensions.internal_redirect.safe_cross_scheme.v3"; | ||
option java_outer_classname = "SafeCrossSchemeConfigProto"; | ||
option java_multiple_files = true; | ||
option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
|
||
// [#protodoc-title: SafeCrossScheme internal redirect predicate] | ||
|
||
// An internal redirect predicate that checks the scheme between the | ||
// downstream url and the redirect target url and allows a) same scheme | ||
// redirect and b) safe cross scheme redirect, which means if the downstream | ||
// scheme is HTTPS, both HTTPS and HTTP redirect targets are allowed, but if the | ||
// downstream scheme is HTTP, only HTTP redirect targets are allowed. | ||
// [#extension: | ||
// envoy.internal_redirect_predicates.safe_cross_scheme] | ||
message SafeCrossSchemeConfig { | ||
} |
This file contains 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 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 |
---|---|---|
|
@@ -17,3 +17,4 @@ Extensions | |
grpc_credential/grpc_credential | ||
retry/retry | ||
trace/trace | ||
internal_redirect/internal_redirect |
8 changes: 8 additions & 0 deletions
8
docs/root/api-v3/config/internal_redirect/internal_redirect.rst
This file contains 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,8 @@ | ||
Internal Redirect Predicates | ||
============================ | ||
|
||
.. toctree:: | ||
:glob: | ||
:maxdepth: 2 | ||
|
||
../../extensions/internal_redirect/** |
This file contains 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.