Skip to content

Only allow name-based profile discovery for inbound requests#695

Merged
olix0r merged 10 commits intomainfrom
ver/profile-no-timeout
Oct 6, 2020
Merged

Only allow name-based profile discovery for inbound requests#695
olix0r merged 10 commits intomainfrom
ver/profile-no-timeout

Conversation

@olix0r
Copy link
Member

@olix0r olix0r commented Oct 6, 2020

The proxy uses a single profile client for both inbound and outbound
resolutions. We now want to perform profile discovery for all outbound
traffic; but this is overkill for inbound traffic. We should only do
profile lookup for traffic that includes a valid service name and not,
for instance, healtchecks and prometheus scrapes.

This changes inbound to only do resolution for valid names, skipping
traffic that is not targetting a valid service name.

In order to do this, the following has changed:

  • An AddrMatch utility is introduced to core so that this logic need
    not be propagated.
  • app::dst now simply builds a profile client without filtering or
    recovery.
  • The profile client is no longer responsible for synthesizing a
    default profile on timeout -- this will be extracted into the stack in
    a followup.
  • The profiles::discovery::layer utility now applies filtering and
    discovery, so that the inbound and outbound proxies may supply their own
    filters.
  • When we reject discovery and handle failed discovery, we always use gRPC
    error codes now

olix0r added 5 commits October 6, 2020 16:23
The proxy uses a single profile client for both inbound and outbound
resolutions. We now want to perform profile discovery for all outbound
traffic; but this is overkill for inbound traffic. We should only do
profile lookup for traffic that includes a valid service name and not,
for instance, healtchecks and prometheus scrapes.

This changes inbound to only do resolution for valid names, skipping
traffic that is not targetting a valid service name.

In order to do this, the following has changed:

- An `AddrMatch` utility is introduced to `core` so that this logic need
  not be propagated.
- `app::dst` now simply builds a profile client without filtering or
  recovery.
- The profile client is no longer responsible for synthesizing a
  default profile on timeout -- this will be extracted into the stack in
  a followup.
- The `profiles::discovery::layer` utility now applies filtering and
  discovery, so that the inbound and outbound proxies may supply their own
  filters.
@olix0r olix0r requested a review from a team October 6, 2020 18:48
Copy link
Contributor

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this all looks good to me, i like how the filtering logic was factored out.

Comment on lines +27 to +28
Addr::Name(ref name) => self.0.matches(name.name()),
Addr::Socket(sa) => self.1.matches(sa.ip()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit/TIOLI: this might read nicer if we named the two fields of AddrMatch, but that's not a huge deal...

Comment on lines +250 to +251
// TODO: Profile resolution should be time-bounded so that slowness
// cannot cause inbound requests to fail.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we merge #694 first and use that here, or should we do that as a follow-up? probably fine either way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's fine either way. we'll need both in before the next release, but ordering doesn't really matter.

const DEFAULT_DESTINATION_GET_SUFFIXES: &str = "svc.cluster.local.";
const DEFAULT_DESTINATION_PROFILE_SUFFIXES: &str = "svc.cluster.local.";
const DEFAULT_DESTINATION_PROFILE_INITIAL_TIMEOUT: Duration = Duration::from_millis(500);
//const DEFAULT_DESTINATION_PROFILE_INITIAL_TIMEOUT: Duration = Duration::from_millis(500);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm assuming that we want to add this back once we start bounding the time it takes to become ready?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, probably

@olix0r olix0r merged commit a5e0b29 into main Oct 6, 2020
@olix0r olix0r deleted the ver/profile-no-timeout branch October 6, 2020 20:15
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Oct 10, 2020
This release overhauls the discovery and routing logic implemented by
the proxy: instead of looking at HTTP request metadata for service
discovery, the outbound proxy now exclusively use each connection's
target IP:PORT. This eager resolution eliminates per-request cache
binding; and supports using TrafficSplit with non-HTTP services.

This has a few side effects:

- The `l5d-dst-override` header is no longer honored.
- When the application attempts to connect to a pod IP, the proxy no
  longer load balances these requests among all pods in the service.
  The proxy will now honor session-stickiness as selected by an
  application-level load balancer.
- `TrafficSplits` are only applied when a client targets a service's IP.
- The proxy no longer performs DNS "canonicalization" to translate
  relative host header names to a fully-qualified form.

---

* Unify RequestFilter and Admit middlewares (linkerd/linkerd2-proxy#692)
* Only allow name-based profile discovery for inbound requests (linkerd/linkerd2-proxy#695)
* outbound: initial tests for TCP mTLS (with fewer moving parts) (linkerd/linkerd2-proxy#693)
* Stop honoring DESTINATION_GET_* configuration (linkerd/linkerd2-proxy#696)
* stack: add SwitchReady service (linkerd/linkerd2-proxy#694)
* telemetry: Remove trailing comma in build_info labels (linkerd/linkerd2-proxy#699)
* Update Rust to 1.47.0 (linkerd/linkerd2-proxy#701)
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Oct 12, 2020
This release overhauls the discovery and routing logic implemented by
the proxy: instead of looking at HTTP request metadata for service
discovery, the outbound proxy now exclusively use each connection's
target IP:PORT. This eager resolution eliminates per-request cache
binding; and supports using TrafficSplit with non-HTTP services.

This has a few side effects:

- The `l5d-dst-override` header is no longer honored.
- When the application attempts to connect to a pod IP, the proxy no
  longer load balances these requests among all pods in the service.
  The proxy will now honor session-stickiness as selected by an
  application-level load balancer.
- `TrafficSplits` are only applied when a client targets a service's IP.
- The proxy no longer performs DNS "canonicalization" to translate
  relative host header names to a fully-qualified form.

---

* Unify RequestFilter and Admit middlewares (linkerd/linkerd2-proxy#692)
* Only allow name-based profile discovery for inbound requests (linkerd/linkerd2-proxy#695)
* outbound: initial tests for TCP mTLS (with fewer moving parts) (linkerd/linkerd2-proxy#693)
* Stop honoring DESTINATION_GET_* configuration (linkerd/linkerd2-proxy#696)
* stack: add SwitchReady service (linkerd/linkerd2-proxy#694)
* telemetry: Remove trailing comma in build_info labels (linkerd/linkerd2-proxy#699)
* Update Rust to 1.47.0 (linkerd/linkerd2-proxy#701)
* cache: Delete benchmarks (linkerd/linkerd2-proxy#705)
* outbound: Discover profiles for each unique TCP target (linkerd/linkerd2-proxy#704)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants