Skip to content

Commit

Permalink
Add cluster flag to tsh kube sessions (#23825)
Browse files Browse the repository at this point in the history
This PR adds the `--cluster` flag to easily switch between different
sitenames when listing kube sessions.
  • Loading branch information
tigrato committed Mar 30, 2023
1 parent c1ff2fa commit 595a41f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tool/tsh/kube.go
Expand Up @@ -475,19 +475,23 @@ func (c *kubeExecCommand) run(cf *CLIConf) error {

type kubeSessionsCommand struct {
*kingpin.CmdClause
format string
format string
siteName string
}

func newKubeSessionsCommand(parent *kingpin.CmdClause) *kubeSessionsCommand {
c := &kubeSessionsCommand{
CmdClause: parent.Command("sessions", "Get a list of active Kubernetes sessions."),
}
c.Flag("format", defaults.FormatFlagDescription(defaults.DefaultFormats...)).Short('f').Default(teleport.Text).EnumVar(&c.format, defaults.DefaultFormats...)

c.Flag("cluster", clusterHelp).Short('c').StringVar(&c.siteName)
return c
}

func (c *kubeSessionsCommand) run(cf *CLIConf) error {
if c.siteName != "" {
cf.SiteName = c.siteName
}
tc, err := makeClient(cf, true)
if err != nil {
return trace.Wrap(err)
Expand Down

0 comments on commit 595a41f

Please sign in to comment.