refactor: upstream host override struct#43944
Conversation
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
7894d9b to
d5a9919
Compare
aaa0098 to
12b45da
Compare
|
Please resolve merge conflicts; do not rebase, instead do a merge of the conflicts. |
| // <envoy_v3_api_field_extensions.filters.http.stateful_session.v3.StatefulSession.strict>` is enabled | ||
| // and the requested destination is unavailable. | ||
| // | ||
| // This allows clients to distinguish between transient failures and errors from upstream. |
There was a problem hiding this comment.
From a high-level view, it doesn't seem that the feature addresses the description here. Specifically the error-code could be originating from the upstream or from Envoy, and the downstream client will not know what was the cause, no?
There was a problem hiding this comment.
While the status itself wouldn't be enough to determine whether it was due to no available upstream or status from the upstream itself, it would let users configure it to something that is considered safe to retry. For example, it is safe for the downstream client to retry on 425 irrespective of where the status is coming from unlike 503 which might not be safe to retry due to idempotency as pointed out in the issue.
There was a problem hiding this comment.
I think this implies that the downstream client knows what the config knob (strict) value is on the proxy, which seems like a broken abstraction that I'm not sure is needed here.
I prefer removing this, and updating the strict description to say that Envoy will return the error code set by this field.
|
/retest |
| // | ||
| // This field only takes effect when ``strict`` is set to ``true``. In non-strict mode, | ||
| // requests are routed according to the load balancer and this status code is not used. | ||
| type.v3.HttpStatus status_on_missing_destination = 4; |
There was a problem hiding this comment.
| type.v3.HttpStatus status_on_missing_destination = 4; | |
| type.v3.HttpStatus status_on_strict_unavailable_destination = 4; |
There was a problem hiding this comment.
Will go with status_on_missing_strict_destination in the follow up PR. Didn't want to use the term unavailable as it might be conflated with availability as in non-5XX responses, but we mean the destination not being present for it to connect to.
| // <envoy_v3_api_field_extensions.filters.http.stateful_session.v3.StatefulSession.strict>` is enabled | ||
| // and the requested destination is unavailable. | ||
| // | ||
| // This allows clients to distinguish between transient failures and errors from upstream. |
There was a problem hiding this comment.
I think this implies that the downstream client knows what the config knob (strict) value is on the proxy, which seems like a broken abstraction that I'm not sure is needed here.
I prefer removing this, and updating the strict description to say that Envoy will return the error code set by this field.
713aa72 to
e132250
Compare
e132250 to
ccc35ea
Compare
| Network::Socket::OptionsSharedPtr upstream_options_ = | ||
| std::make_shared<Network::Socket::Options>(); | ||
| std::pair<std::string, bool> upstream_override_host_; | ||
| struct UpstreamOverrideHostStorage { |
There was a problem hiding this comment.
I wonder whether the "storage" (UpstreamOverrideHostStorage) and "non-storage" (UpstreamOverrideHost) should just be a plain object (just like the storage one), and references to the plain object.
cc @wbpcode who wrote the original code and probably has more context.
There was a problem hiding this comment.
I agree with @adisuissa. I can use the UpstreamOverrideHost to store the string and also bool.
And we can update the upstreamOverrideHost() method to return a OptRef rather then current absl::optional<Upstream::LoadBalancerContext::OverrideHost>.
wbpcode
left a comment
There was a problem hiding this comment.
LGTM overall with some minor comments. Thanks for the update.
/wait
22d3729 to
57b41de
Compare
Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com>
Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com>
Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com>
57b41de to
4fb16f9
Compare
|
/retest |
|
Please don't use force push once the review started. You could merge main rather than rebase which would be more friendly to reviewer. :) |
<!-- !!!ATTENTION!!! If you are fixing *any* crash or *any* potential security issue, *do not* open a pull request in this repo. Please report the issue via emailing envoy-security@googlegroups.com where the issue will be triaged appropriately. Thank you in advance for helping to keep Envoy secure. !!!ATTENTION!!! For an explanation of how to fill out the fields, please see the relevant section in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/main/PULL_REQUESTS.md) !!!ATTENTION!!! Please check the [use of generative AI policy](https://github.com/envoyproxy/envoy/blob/main/CONTRIBUTING.md?plain=1#L41). You may use generative AI only if you fully understand the code. You need to disclose this usage in the PR description to ensure transparency. --> Commit Message: refactor: upstream host override struct Additional Description: Refactor is required for a subsequent change proposed to add a status to return if strict destination is missing. Risk Level: Low (internal refactor) Testing: Unit tests Docs Changes: No Release Notes: No Related envoyproxy#42686 --------- Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com> Signed-off-by: Xuyang Tao <taoxuy@google.com>
<!-- !!!ATTENTION!!! If you are fixing *any* crash or *any* potential security issue, *do not* open a pull request in this repo. Please report the issue via emailing envoy-security@googlegroups.com where the issue will be triaged appropriately. Thank you in advance for helping to keep Envoy secure. !!!ATTENTION!!! For an explanation of how to fill out the fields, please see the relevant section in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/main/PULL_REQUESTS.md) !!!ATTENTION!!! Please check the [use of generative AI policy](https://github.com/envoyproxy/envoy/blob/main/CONTRIBUTING.md?plain=1#L41). You may use generative AI only if you fully understand the code. You need to disclose this usage in the PR description to ensure transparency. --> Commit Message: refactor: upstream host override struct Additional Description: Refactor is required for a subsequent change proposed to add a status to return if strict destination is missing. Risk Level: Low (internal refactor) Testing: Unit tests Docs Changes: No Release Notes: No Related envoyproxy#42686 --------- Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com> Signed-off-by: Jonathan Wu <jtwu@google.com>
<!-- !!!ATTENTION!!! If you are fixing *any* crash or *any* potential security issue, *do not* open a pull request in this repo. Please report the issue via emailing envoy-security@googlegroups.com where the issue will be triaged appropriately. Thank you in advance for helping to keep Envoy secure. !!!ATTENTION!!! For an explanation of how to fill out the fields, please see the relevant section in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/main/PULL_REQUESTS.md) !!!ATTENTION!!! Please check the [use of generative AI policy](https://github.com/envoyproxy/envoy/blob/main/CONTRIBUTING.md?plain=1#L41). You may use generative AI only if you fully understand the code. You need to disclose this usage in the PR description to ensure transparency. --> Commit Message: refactor: upstream host override struct Additional Description: Refactor is required for a subsequent change proposed to add a status to return if strict destination is missing. Risk Level: Low (internal refactor) Testing: Unit tests Docs Changes: No Release Notes: No Related envoyproxy#42686 --------- Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com> Signed-off-by: Nick Shipilov <nick.shipilov.n@gmail.com>
<!-- !!!ATTENTION!!! If you are fixing *any* crash or *any* potential security issue, *do not* open a pull request in this repo. Please report the issue via emailing envoy-security@googlegroups.com where the issue will be triaged appropriately. Thank you in advance for helping to keep Envoy secure. !!!ATTENTION!!! For an explanation of how to fill out the fields, please see the relevant section in [PULL_REQUESTS.md](https://github.com/envoyproxy/envoy/blob/main/PULL_REQUESTS.md) !!!ATTENTION!!! Please check the [use of generative AI policy](https://github.com/envoyproxy/envoy/blob/main/CONTRIBUTING.md?plain=1#L41). You may use generative AI only if you fully understand the code. You need to disclose this usage in the PR description to ensure transparency. --> Commit Message: refactor: upstream host override struct Additional Description: Refactor is required for a subsequent change proposed to add a status to return if strict destination is missing. Risk Level: Low (internal refactor) Testing: Unit tests Docs Changes: No Release Notes: No Related envoyproxy#42686 --------- Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com>
Commit Message: refactor: upstream host override struct
Additional Description: Refactor is required for a subsequent change proposed to add a status to return if strict destination is missing.
Risk Level: Low (internal refactor)
Testing: Unit tests
Docs Changes: No
Release Notes: No
Related #42686