Skip to content

[v9] Make proxy routing and session control logic reusable#18923

Merged
rosstimothy merged 4 commits intobranch/v9from
tross/backport-resusable-components/v9
Dec 7, 2022
Merged

[v9] Make proxy routing and session control logic reusable#18923
rosstimothy merged 4 commits intobranch/v9from
tross/backport-resusable-components/v9

Conversation

@rosstimothy
Copy link
Copy Markdown
Contributor

Backport #18370 and #18565 to branch/v9

This also includes lib/utils/proxyconn.go and lib/utils/proxyconn_test.go from #13455 which wasn't backported to v9.

@rosstimothy rosstimothy force-pushed the tross/backport-resusable-components/v9 branch 2 times, most recently from fe4f0ed to 6174404 Compare November 30, 2022 20:15
@rosstimothy rosstimothy marked this pull request as ready for review December 1, 2022 16:20
@github-actions github-actions Bot requested review from fspmarshall and zmb3 December 1, 2022 16:21
@rosstimothy
Copy link
Copy Markdown
Contributor Author

PTAL @fspmarshall @zmb3

Routing logic existed within an unexported handler of ssh subsystem
requests, which prevented it from being reused by other components
within the proxy, like the webapi server. This causes significant
latency issues for web sessions because the web apiserver is required
to dial the proxy ssh server to determine how to route to the host.
Since the web apiserver and the proxy ssh server exist in the same
process this is an entirely unnecesarry step that could be avoided
if the routing and ability to established connections were shared
throughout the proxy.

A new `proxy.Router` object is introduced which contains all the
logic that used to exist in `regular.proxySubsys` for determining
how to connect to servers and clusters. All routing within the
`regular.proxySubsys` now leverages the `proxy.Router` to dial
the target.

This is step 1 in addressing #15167. Now that the `proxy.Router`
exists `web.APIServer` will be able to make use of it to avoid
dialing the same process to establish connections.
@rosstimothy rosstimothy force-pushed the tross/backport-resusable-components/v9 branch from 6174404 to f0a1868 Compare December 6, 2022 15:07
@rosstimothy rosstimothy enabled auto-merge (squash) December 6, 2022 15:07
Session control logic existed within `HandleNewConn` of `srv/regular.Server`.
This prevented any of it from being used by other components that
also needed to enforce session control.

All the logic from within `HandleNewConn` was refactored to a new
`srv.SessionController` object which the `regular.Server` now uses
to perform session control. There were a few additional changes
needed to accomadate that session control now exists outside
the server and to make tests easier to write. Namely, altering
`srv.ComputLockTargets` to not take a `Server` as a parameter and
leveraging a clock within `services.SemaphoreLock`.

This is step 2 in addressing #15167. Before the web apiserver can
leverage the newly introduced proxy.Router and bypass making ssh
connections to the proxy ssh server it needs to be able to perfrom
session control.
@rosstimothy rosstimothy force-pushed the tross/backport-resusable-components/v9 branch from 36b05c9 to d2039f6 Compare December 7, 2022 17:07
@rosstimothy rosstimothy merged commit 4da0db8 into branch/v9 Dec 7, 2022
@rosstimothy rosstimothy deleted the tross/backport-resusable-components/v9 branch December 7, 2022 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants