linkerd2/controller/api/destination
Oliver Gould 08f97cc26f
destination: Avoid sending spurious profile updates (#10517)
The GetProfile API endpoint does not behave as expected: when a profile
watch is established, the API server starts two separate profile
watches--a primary watch with the client's namespace and fallback watch
ignoring the client's namespace. These watches race to send data back to
the client. If the backup watch updates first, it may be sent to clients
before being corrected by a subsequent update. If the primary watch
updates with an empty value, the default profile may be served before
being corrected by an update to the backup watch.

From the proxy's perspective, we'd much prefer that the API provide a
single authoritative response when possible. It avoids needless
corrective work from distributing across the system on every watch
initiation.

To fix this, we modify the fallbackProfileListener to behave
predictably: it only emits updates once both its primary and fallback
listeners have been updated. This avoids emitting updates based on a
partial understanding of the cluster state.

Furthermore, the opaquePortsAdaptor is updated to avoid synthesizing a
default serviceprofile (surprising behavior) and, instead, this
defaulting logic is moved into a dedicated defaultProfileListener
helper. A dedupProfileListener is added to squelch obviously redundant
updates.

Finally, this newfound predictability allows us to simplify the API's
tests. Many of the API tests are not clear in what they test and
sometimes make assertions about the "incorrect" profile updates.
2023-03-13 13:36:18 -07:00
..
watcher destination: Avoid sending spurious profile updates (#10517) 2023-03-13 13:36:18 -07:00
client.go Add `--destination-pod flag` to `linkerd diagnostics endpoints` subcommand (#9200) 2022-08-18 15:37:29 -06:00
dedup_profile_listener.go destination: Avoid sending spurious profile updates (#10517) 2023-03-13 13:36:18 -07:00
default_profile_listener.go destination: Avoid sending spurious profile updates (#10517) 2023-03-13 13:36:18 -07:00
destination_fuzzer.go Fuzzing: Move fuzzers upstream (#7419) 2022-05-05 13:01:00 -06:00
endpoint_profile_translator.go Add `gosec` and `errcheck` lints (#7954) 2022-03-03 10:09:51 -07:00
endpoint_translator.go switched not actionable and are alarming log messages to Debugf from Errorf (#10388) 2023-03-02 15:12:36 -05:00
endpoint_translator_test.go Support service internal traffic policy (#10186) 2023-02-06 13:53:07 -07:00
fallback_profile_listener.go destination: Avoid sending spurious profile updates (#10517) 2023-03-13 13:36:18 -07:00
fallback_profile_listener_test.go destination: Avoid sending spurious profile updates (#10517) 2023-03-13 13:36:18 -07:00
opaque_ports_adaptor.go destination: Avoid sending spurious profile updates (#10517) 2023-03-13 13:36:18 -07:00
profile_translator.go destination: Avoid sending spurious profile updates (#10517) 2023-03-13 13:36:18 -07:00
profile_translator_test.go enable `staticcheck` (#8037) 2022-03-10 15:43:35 -08:00
server.go destination: Avoid sending spurious profile updates (#10517) 2023-03-13 13:36:18 -07:00
server_test.go destination: Avoid sending spurious profile updates (#10517) 2023-03-13 13:36:18 -07:00
test_util.go destination: Avoid sending spurious profile updates (#10517) 2023-03-13 13:36:18 -07:00