-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify control plane client construction #638
Conversation
We construct three control plane clients. All of the clients are basically the same (at least with regard to the stack/configuration). Rather than duplicate this logic throughout the code, we can unify it in the `control` module (hiding the details of how the client is built). This change modifies how the OpenCensus collector client is instantiated. The `SpanExporter` no longer constructs a new client each time it wishes to initiate a stream, opting to just clone a single client instead. This change also fixes reconnect logic for these clients. When the control client balancer was introduced, the reconnect layer incorrectly wrapped the balancer (instead of the endpoint). This has been corrected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, thank you!
svc::connect(self.connect.keepalive) | ||
.push(tls::ConnectLayer::new(identity)) | ||
.push_timeout(self.connect.timeout) | ||
.push(self::client::layer()) | ||
.push(reconnect::layer({ | ||
let backoff = self.connect.backoff; | ||
move |_| Ok(backoff.stream()) | ||
})) | ||
.push_spawn_ready() | ||
.push(self::resolve::layer(dns)) | ||
.push_on_response(self::control::balance::layer()) | ||
.push(metrics.into_layer::<classify::Response>()) | ||
.push(self::add_origin::Layer::new()) | ||
.into_new_service() | ||
.check_new_service() | ||
.push_on_response(svc::layers().push_spawn_buffer(self.buffer_capacity)) | ||
.new_service(self.addr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we maybe stick an instrument
in this stack somewhere, or does that happen elsewhere?
This release includes internal changes to the service discovery system, especially when discovering control plane components (like the destination and identity controllers). Now, the proxy attempts to balance requests across all pods in each control plane service. This requires control plane changes to use "headless" services so that SRV records are exposed. When the control plane services have a `clusterIP` set, the proxy falls back to using normal A-record lookups. --- * tracing: add richer verbose spans to http clients (linkerd/linkerd2-proxy#622) * trace: update tracing dependencies (linkerd/linkerd2-proxy#623) * Remove `Resolution` trait (linkerd/linkerd2-proxy#606) * Update proxy-identity to edge-20.8.2 (linkerd/linkerd2-proxy#627) * Add build arg for skipping identity wrapper (linkerd/linkerd2-proxy#624) * Wait for proxy thread to terminate in integration tests (linkerd/linkerd2-proxy#625) * Remove scrubbing for unused headers (linkerd/linkerd2-proxy#628) * Split orig-proto tests out of discovery tests (linkerd/linkerd2-proxy#629) * Re-enable outbound timeout test (linkerd/linkerd2-proxy#630) * profiles: perform profile resolution for IP addresses (linkerd/linkerd2-proxy#626) * Move resolve api to async-stream (linkerd/linkerd2-proxy#599) * Decouple discovery buffering from endpoint conversion (linkerd/linkerd2-proxy#631) * resolve: Add a Reset state (linkerd/linkerd2-proxy#633) * resolve: Eagerly fail resolutions (linkerd/linkerd2-proxy#634) * test: replace `net2` dependency with `socket2` (linkerd/linkerd2-proxy#635) * dns: Run DNS resolutions on the main runtime (linkerd/linkerd2-proxy#637) * Load balance requests to the control plane (linkerd/linkerd2-proxy#594) * Unify control plane client construction (linkerd/linkerd2-proxy#638)
This release includes internal changes to the service discovery system, especially when discovering control plane components (like the destination and identity controllers). Now, the proxy attempts to balance requests across all pods in each control plane service. This requires control plane changes to use "headless" services so that SRV records are exposed. When the control plane services have a `clusterIP` set, the proxy falls back to using normal A-record lookups. --- * tracing: add richer verbose spans to http clients (linkerd/linkerd2-proxy#622) * trace: update tracing dependencies (linkerd/linkerd2-proxy#623) * Remove `Resolution` trait (linkerd/linkerd2-proxy#606) * Update proxy-identity to edge-20.8.2 (linkerd/linkerd2-proxy#627) * Add build arg for skipping identity wrapper (linkerd/linkerd2-proxy#624) * Wait for proxy thread to terminate in integration tests (linkerd/linkerd2-proxy#625) * Remove scrubbing for unused headers (linkerd/linkerd2-proxy#628) * Split orig-proto tests out of discovery tests (linkerd/linkerd2-proxy#629) * Re-enable outbound timeout test (linkerd/linkerd2-proxy#630) * profiles: perform profile resolution for IP addresses (linkerd/linkerd2-proxy#626) * Move resolve api to async-stream (linkerd/linkerd2-proxy#599) * Decouple discovery buffering from endpoint conversion (linkerd/linkerd2-proxy#631) * resolve: Add a Reset state (linkerd/linkerd2-proxy#633) * resolve: Eagerly fail resolutions (linkerd/linkerd2-proxy#634) * test: replace `net2` dependency with `socket2` (linkerd/linkerd2-proxy#635) * dns: Run DNS resolutions on the main runtime (linkerd/linkerd2-proxy#637) * Load balance requests to the control plane (linkerd/linkerd2-proxy#594) * Unify control plane client construction (linkerd/linkerd2-proxy#638)
We construct three control plane clients. All of the clients are
basically the same (at least with regard to the stack/configuration).
Rather than duplicate this logic throughout the code, we can unify it in
the
control
module (hiding the details of how the client is built).This change modifies how the OpenCensus collector client is
instantiated. The
SpanExporter
no longer constructs a new client eachtime it wishes to initiate a stream, opting to just clone a single
client instead.
This change also fixes reconnect logic for these clients. When the
control client balancer was introduced, the reconnect layer incorrectly
wrapped the balancer (instead of the endpoint). This has been corrected.