Skip to content
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

Improve tsh host resolution #50175

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Improve tsh host resolution #50175

wants to merge 3 commits into from

Conversation

rosstimothy
Copy link
Contributor

@rosstimothy rosstimothy commented Dec 12, 2024

Host resolution performed because labels, fuzzy search, or predicate expressions were supplied to commands that establish connections to a single host has historically been performed client side in tsh. While that works in most cases, it can prevent correctly resolving hosts in some situations, i.e. when there are ambiguous hosts and tsh is unaware that the cluster routing strategy is set to ROUTE_TO_MOST_RECENT.

To improve the experience, a new ResolveSSHTarget was added to Auth to allow host resolution to be performed server side. The resolution works in a similar manner to, and was inspired by GetSSHTargets. In the event that the new RPC is not implemented, because the client is newer than Auth, tsh has also been updated to pull the cluster networking config and address any host ambiguity if allowed.

As a result tsh scp and tsh proxy ssh should be much more tolerant to, and still permit access in situations where ambiguous hosts are present for some amount of time. Prior to this the only way to connect in these situations was to find the UUID of the correct target instance and try again after seeing an ambiguous host error.

@rosstimothy rosstimothy force-pushed the tross/host_resolution branch 4 times, most recently from 8d74d56 to 41254a8 Compare December 13, 2024 18:25
Update tsh to prefer using ResolveSSHTarget to resolve the target
if labels, search, or predicate expressions were supplied. In the
event that the RPC is not implemented, tsh falls back to the
previous behavior of calling ListUnifiedResources, with one slight
addition. In the event that resolution is ambiguous tsh now
consults the cluster networking config to determine the
ROUTE_TO_MOST_RECENT strategy is in place. If so, the returned
server with the expiry the farthest in the future will be used.
@rosstimothy rosstimothy force-pushed the tross/host_resolution branch from 41254a8 to 69fc44e Compare December 13, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant