pomerium/authorize/evaluator
Caleb Doxsey 7a6d7c5a3c
config: use stable route ids for authorize matching and order xds responses (#5618)
## Summary
Update the `RouteID` to use the `policy.ID` if it is set. This makes it
so that updated routes use a stable identifier between updates so if the
envoy control plane is updated before the authorize service's internal
definitions (or vice-versa) the authorize service will still be able to
match the route.

The current behavior results in a 404 if envoy passes the old route id.
The new behavior will result in inconsistency, but it should be quickly
remedied. To help with debugging 4 new fields were added to the
authorize check log. The `route-id` and `route-checksum` as the
authorize sees it and the `envoy-route-id` and `envoy-route-checksum` as
envoy sees it.

I also updated the way we send updates to envoy to try and model their
recommended approach:

> In general, to avoid traffic drop, sequencing of updates should follow
a make before break model, wherein:
> 
> - CDS updates (if any) must always be pushed first.
> - EDS updates (if any) must arrive after CDS updates for the
respective clusters.
> - LDS updates must arrive after corresponding CDS/EDS updates.
> - RDS updates related to the newly added listeners must arrive after
CDS/EDS/LDS updates.
> - VHDS updates (if any) related to the newly added RouteConfigurations
must arrive after RDS updates.
> - Stale CDS clusters and related EDS endpoints (ones no longer being
referenced) can then be removed.

This should help avoid 404s when configuration is being updated.

## Related issues
-
[ENG-2386](https://linear.app/pomerium/issue/ENG-2386/large-number-of-routes-leads-to-404s-and-slowness)

## Checklist
- [x] reference any related issues
- [x] updated unit tests
- [x] add appropriate label (`enhancement`, `bug`, `breaking`,
`dependencies`, `ci`)
- [x] ready for review
2025-05-19 10:52:15 -06:00
..
config.go mcp: handle and pass upstream oauth2 tokens (#5595) 2025-05-01 12:42:31 -04:00
evaluator.go config: use stable route ids for authorize matching and order xds responses (#5618) 2025-05-19 10:52:15 -06:00
evaluator_test.go authorize: refactor logAuthorizeCheck() (#5576) 2025-04-23 09:21:52 -07:00
functions.go logging: remove ctx from global log methods (#5337) 2024-10-23 14:18:52 -06:00
functions_test.go add mTLS UserPrincipalName SAN match (#5177) 2024-07-26 10:23:19 -07:00
gen-test-certs.go add mTLS UserPrincipalName SAN match (#5177) 2024-07-26 10:23:19 -07:00
google_cloud_serverless.go core/logging: change log.Error function (#5251) 2024-09-05 15:42:46 -06:00
google_cloud_serverless_test.go upgrade to go v1.24 (#5562) 2025-04-02 15:53:09 -06:00
headers_evaluator.go move internal/telemetry/trace => pkg/telemetry/trace (#5541) 2025-03-25 10:43:04 -04:00
headers_evaluator_evaluation.go mcp: handle and pass upstream oauth2 tokens (#5595) 2025-05-01 12:42:31 -04:00
headers_evaluator_test.go add support for pomerium.request.headers for set_request_headers (#5563) 2025-04-07 10:32:03 -06:00
log.go core/authorize: add support for rego print statements (#5049) 2024-04-01 14:17:14 -06:00
log_test.go core/authorize: add support for rego print statements (#5049) 2024-04-01 14:17:14 -06:00
policy_evaluator.go move internal/telemetry/trace => pkg/telemetry/trace (#5541) 2025-03-25 10:43:04 -04:00
policy_evaluator_test.go config: add new mTLS enforcement setting (#4443) 2023-08-09 07:53:11 -07:00