Skip to content

[v10] Make proxy routing and session control logic reusable#18918

Merged
rosstimothy merged 4 commits intobranch/v10from
tross/backport-resusable-components/v10
Dec 6, 2022
Merged

[v10] Make proxy routing and session control logic reusable#18918
rosstimothy merged 4 commits intobranch/v10from
tross/backport-resusable-components/v10

Conversation

@rosstimothy
Copy link
Copy Markdown
Contributor

Backport #18370 and #18565 to branch/v10

@rosstimothy rosstimothy force-pushed the tross/backport-resusable-components/v10 branch 2 times, most recently from 573f4dc to 50227cd Compare November 30, 2022 20:12
@rosstimothy rosstimothy marked this pull request as ready for review November 30, 2022 22:12
@github-actions github-actions Bot requested review from fspmarshall and zmb3 November 30, 2022 22:12
@rosstimothy
Copy link
Copy Markdown
Contributor Author

PTAL @fspmarshall @zmb3

* create  package to contain proxy peering code

* Refactor proxy routing logic into a reusable object

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.
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/v10 branch from 50227cd to 5d4c5cf Compare December 6, 2022 14:56
@rosstimothy rosstimothy enabled auto-merge (squash) December 6, 2022 15:07
@rosstimothy rosstimothy merged commit dd27ac9 into branch/v10 Dec 6, 2022
@rosstimothy rosstimothy deleted the tross/backport-resusable-components/v10 branch December 6, 2022 18:18
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