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

Display full list of DNS zones in VNet panel #43195

Merged
merged 16 commits into from
Jun 20, 2024
Merged

Conversation

ravicious
Copy link
Member

@ravicious ravicious commented Jun 18, 2024

Demo recording
dns-zones.mov

At the moment, Connect only shows proxy hostnames of root clusters in the VNet panel. This PR makes it so that it uses the same logic as the VNet admin process to list DNS zones of clusters the user is currently logged into.

The first half of commits is related to lib/teleterm, the rest is related to the UI code.

UX choices

The list is fetched each time the user opens the VNet panel.

To establish the DNS zones of a cluster, VNet needs to ping it and then fetch vnet_config. The response built from those two sources is cached for 5 minutes. For root clusters, VNet also needs to fetch the list of leaf clusters – this response isn't cached but could be in the future. So if someone repeatedly opens and closes the panel, we only ever fetch the list of leaf clusters.

The VNet admin process has its own ClusterConfigCache. Every 10 seconds, the admin process updates the DNS configuration based on the state of TELEPORT_HOME_DIR, so essentially it asks the cache every 10 seconds for a config. This also means that it is able to configure VNet for new clusters or deconfigure it for stale clusters as the user logs in and out of clusters.

For 95% of users, the DNS zones will always remain the same. They only ever use a single cluster. For the other 5% of users, the list should get updated whenever they log in or out of clusters. Hence why we fetch the list each time the panel gets opened, instead of maintaining a second layer of caching that reacts to cluster changes in the Electron app.

The fact that the list won't change for most users is also why on subsequent openings of the panel we optimistically show stale values. On top of that, the status indicator behind updating DNS zones does not kick in until a certain delay. All of this to make sure that those 95% of users have least annoying UI possible – they should observe no changes on subsequent openings of the panel.

Perf choices

In Connect, ClusterConfigCache is shared between the VNet service and NetworkStack. Since NetworkStack requests a config on each new connection and Connect is going to request config for each cluster whenever the panel is opened, I figured it'd be best to share the cache.

I'm not entirely sure if it's going to cause any issues, e.g. Connect wants to show the DNS zones in the UI, so it asks for a config, which causes NetworkStack to process a TCP connection for which it also needs a config. The reason it works is because NetworkStack short-circuits when a connection is made to the cluster proxy hostname itself and does not fetch a config in that case.


changelog: VNet panel in Teleport Connect now lists custom DNS zones and DNS zones from leaf clusters

@ravicious ravicious force-pushed the r7s/vnet-connect-zones branch from d0dd781 to ca1920b Compare June 18, 2024 16:12
@ravicious ravicious force-pushed the r7s/vnet-connect-zones branch from ca1920b to 3d9ef44 Compare June 18, 2024 16:17
@ravicious ravicious force-pushed the r7s/vnet-connect-zones branch from 3d9ef44 to 0987dd0 Compare June 18, 2024 16:19
@ravicious ravicious marked this pull request as ready for review June 18, 2024 16:19
@ravicious ravicious requested review from nklaassen and gzdunek June 18, 2024 16:19
@github-actions github-actions bot requested a review from kimlisa June 18, 2024 16:20
@github-actions github-actions bot added size/lg tsh tsh - Teleport's command line tool for logging into nodes running Teleport. ui labels Jun 18, 2024
@ravicious ravicious removed the request for review from kimlisa June 18, 2024 16:22
@ravicious
Copy link
Member Author

The PR includes both Go and JS changes, but I don't expect both of you to review both parts. I guess @nklaassen will be more interested in lib/teleterm changes and @gzdunek in the UI changes.

@ravicious ravicious force-pushed the r7s/vnet-connect-zones branch from 0987dd0 to 6ed1f58 Compare June 19, 2024 10:57
web/packages/shared/utils/wait.ts Outdated Show resolved Hide resolved
web/packages/shared/utils/wait.ts Outdated Show resolved Hide resolved
web/packages/teleterm/src/ui/Vnet/VnetSliderStep.story.tsx Outdated Show resolved Hide resolved
web/packages/teleterm/src/ui/Vnet/VnetSliderStep.tsx Outdated Show resolved Hide resolved
web/packages/shared/hooks/useAsync.ts Show resolved Hide resolved
I just copied stuff from the linked implementation of then.
// looks like, since the VNet admin process also fetches this data independently of the Electron
// app.
//
// Just like the admin process, it skips root and leaf clusters for which DNS couldn't be fetched
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Just like the admin process, it skips root and leaf clusters for which DNS couldn't be fetched
// Just like the admin process, it skips root and leaf clusters for which the vnet_config couldn't be fetched

@ravicious ravicious enabled auto-merge June 20, 2024 17:17
@ravicious ravicious added this pull request to the merge queue Jun 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 20, 2024
@ravicious ravicious added this pull request to the merge queue Jun 20, 2024
Merged via the queue into master with commit b58d3f9 Jun 20, 2024
41 checks passed
@ravicious ravicious deleted the r7s/vnet-connect-zones branch June 20, 2024 19:07
@public-teleport-github-review-bot

@ravicious See the table below for backport results.

Branch Result
branch/v16 Failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v16 size/lg tsh tsh - Teleport's command line tool for logging into nodes running Teleport. ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants