mirror of https://github.com/linkerd/linkerd2.git
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. |
||
|---|---|---|
| .. | ||
| watcher | ||
| client.go | ||
| dedup_profile_listener.go | ||
| default_profile_listener.go | ||
| destination_fuzzer.go | ||
| endpoint_profile_translator.go | ||
| endpoint_translator.go | ||
| endpoint_translator_test.go | ||
| fallback_profile_listener.go | ||
| fallback_profile_listener_test.go | ||
| opaque_ports_adaptor.go | ||
| profile_translator.go | ||
| profile_translator_test.go | ||
| server.go | ||
| server_test.go | ||
| test_util.go | ||