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

feat: interactive tctl auth rotate #49171

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

nklaassen
Copy link
Contributor

@nklaassen nklaassen commented Nov 19, 2024

The PR adds an interactive mode for tctl auth rotate. The best way to describe it is probably to try it yourself, or check the demo video https://goteleport.zoom.us/clips/share/A2F3MRZsZGYyU09NRVIxMlFCS1YxOHAwaVZRAQ

I am using https://github.com/charmbracelet/bubbletea to handle the tricky parts of writing an interactive TUI. I recommend checking out the README there. The control loop is based on implementing bubbletea.Model which has methods Init(), Update(), and View(). We already have bubbletea as a dependency for tsh latency ssh.

changelog: Added an interactive mode for tctl auth rotate

@github-actions github-actions bot added size/lg tctl tctl - Teleport admin tool labels Nov 19, 2024
tool/tctl/common/auth_rotate_command.go Outdated Show resolved Hide resolved
@nklaassen
Copy link
Contributor Author

nklaassen commented Nov 22, 2024

I need to fix mfa prompts and logs, need prompts to potentially handle stdin and output to not mess with the bubbletea rendering

edit: done

@nklaassen
Copy link
Contributor Author

Copy link
Contributor

Choose a reason for hiding this comment

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

Pull these changes into a separate PR so that they can be backported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I plan to backport all this to 17, but I'm default-against backporting anything other than bugfixes unless there's a compelling reason to do so

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this result in any measurable difference rendering a table? If so, that would improve the UX for folks using tsh ls on a large cluster.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if it does, I made the change for dev ergonomics not performance, it's just nicer to write the table directly to a writer I already have than to get a buffer and copy it. Is table rendering a known problem on large clusters? I'd naively expect the network calls to dominate over the table rendering. For all I know buffering the writes in memory could actually be much faster than making a bunch of small writes to stdout. I just wouldn't backport something like this past the current release branch, I don't understand the value of backporting minor UX changes, if our users value stability on release branches and we value dev velocity it seems counterproductive

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess I am just used to having a very high bar for deciding what should be backported. I view every backport as a potential source of instability that we will ship out in a patch release with very little testing. Even if the change is trivial, the more changes we have the less obvious it is exactly what has changed in a given patch release and the more we (or our customers) have to look at if a patch happens to break something

Copy link
Contributor

Choose a reason for hiding this comment

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

Should these changes be backported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I plan to backport all this to 17, but I'm default-against backporting anything other than bugfixes unless there's a compelling reason to do so

Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be a UX improvement? Is that why you included them here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I included them here for selfish reasons, so I can use the same string in the text and in the example tctl get command. By default I wouldn't backport something like this but I can manually backport if you think it would be worthwhile

tool/tctl/common/status_command.go Outdated Show resolved Hide resolved
Comment on lines +784 to +786
targetPhase, "nodes", adaptServerGetter(func() ([]types.Server, error) {
return client.GetNodes(context.TODO(), apidefaults.Namespace)
})),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will cause the waiting for nodes spinner to spin indefinitely if there are any agentless nodes present. We probably want to hit ListUnifiedResources with a filter here instead.

tool/tctl/common/auth_rotate_command.go Outdated Show resolved Hide resolved
nklaassen and others added 3 commits December 2, 2024 18:50
WriterTo.WriteTo is supposed to return an int64, but fmt.Fprintf returns
a normal int, we never need this byte count anyway so I just removed it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v17 size/lg tctl tctl - Teleport admin tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants