Make Kubernetes capitalization consistent across cli (#19650)

This commit is contained in:
Steven Martin 2022-12-27 11:11:11 -05:00 committed by GitHub
parent be77dadd55
commit 8fe2a74d02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 14 deletions

View file

@ -46,8 +46,8 @@ type KubeCommand struct {
func (c *KubeCommand) Initialize(app *kingpin.Application, config *service.Config) {
c.config = config
kube := app.Command("kube", "Operate on registered kubernetes clusters.")
c.kubeList = kube.Command("ls", "List all kubernetes clusters registered with the cluster.")
kube := app.Command("kube", "Operate on registered Kubernetes clusters.")
c.kubeList = kube.Command("ls", "List all Kubernetes clusters registered with the cluster.")
c.kubeList.Flag("format", "Output format, 'text', 'json', or 'yaml'").Default(teleport.Text).StringVar(&c.format)
c.kubeList.Flag("verbose", "Verbose table output, shows full label output").Short('v').BoolVar(&c.verbose)
}

View file

@ -73,7 +73,7 @@ type kubeCommands struct {
}
func newKubeCommand(app *kingpin.Application) kubeCommands {
kube := app.Command("kube", "Manage available kubernetes clusters")
kube := app.Command("kube", "Manage available Kubernetes clusters")
cmds := kubeCommands{
credentials: newKubeCredentialsCommand(kube),
ls: newKubeLSCommand(kube),
@ -181,7 +181,7 @@ func (c *kubeJoinCommand) run(cf *CLIConf) error {
if tc.KubeProxyAddr == "" {
// Kubernetes support disabled, don't touch kubeconfig.
return trace.AccessDenied("this cluster does not support kubernetes")
return trace.AccessDenied("this cluster does not support Kubernetes")
}
kubeStatus, err := fetchKubeStatus(cf.Context, tc)
@ -413,7 +413,7 @@ type kubeExecCommand struct {
func newKubeExecCommand(parent *kingpin.CmdClause) *kubeExecCommand {
c := &kubeExecCommand{
CmdClause: parent.Command("exec", "Execute a command in a kubernetes pod"),
CmdClause: parent.Command("exec", "Execute a command in a Kubernetes pod"),
}
c.Flag("container", "Container name. If omitted, use the kubectl.kubernetes.io/default-container annotation for selecting the container to be attached or the first container in the pod will be chosen").Short('c').StringVar(&c.container)
@ -479,7 +479,7 @@ type kubeSessionsCommand struct {
func newKubeSessionsCommand(parent *kingpin.CmdClause) *kubeSessionsCommand {
c := &kubeSessionsCommand{
CmdClause: parent.Command("sessions", "Get a list of active kubernetes sessions."),
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...)
@ -564,7 +564,7 @@ func newKubeCredentialsCommand(parent *kingpin.CmdClause) *kubeCredentialsComman
CmdClause: parent.Command("credentials", "Get credentials for kubectl access").Hidden(),
}
c.Flag("teleport-cluster", "Name of the teleport cluster to get credentials for.").Required().StringVar(&c.teleportCluster)
c.Flag("kube-cluster", "Name of the kubernetes cluster to get credentials for.").Required().StringVar(&c.kubeCluster)
c.Flag("kube-cluster", "Name of the Kubernetes cluster to get credentials for.").Required().StringVar(&c.kubeCluster)
return c
}
@ -587,14 +587,14 @@ func (c *kubeCredentialsCommand) run(cf *CLIConf) error {
return trace.Wrap(err)
}
if crt != nil && time.Until(crt.NotAfter) > time.Minute {
log.Debugf("Re-using existing TLS cert for kubernetes cluster %q", c.kubeCluster)
log.Debugf("Re-using existing TLS cert for Kubernetes cluster %q", c.kubeCluster)
return c.writeResponse(cf.Stdout(), k, c.kubeCluster)
}
// Otherwise, cert for this k8s cluster is missing or expired. Request
// a new one.
}
log.Debugf("Requesting TLS cert for kubernetes cluster %q", c.kubeCluster)
log.Debugf("Requesting TLS cert for Kubernetes cluster %q", c.kubeCluster)
err = client.RetryWithRelogin(cf.Context, tc, func() error {
var err error
k, err = tc.IssueUserCertsWithMFA(cf.Context, client.ReissueParams{
@ -662,13 +662,13 @@ type kubeLSCommand struct {
func newKubeLSCommand(parent *kingpin.CmdClause) *kubeLSCommand {
c := &kubeLSCommand{
CmdClause: parent.Command("ls", "Get a list of kubernetes clusters"),
CmdClause: parent.Command("ls", "Get a list of Kubernetes clusters"),
}
c.Flag("cluster", clusterHelp).Short('c').StringVar(&c.siteName)
c.Flag("search", searchHelp).StringVar(&c.searchKeywords)
c.Flag("query", queryHelp).StringVar(&c.predicateExpr)
c.Flag("format", defaults.FormatFlagDescription(defaults.DefaultFormats...)).Short('f').Default(teleport.Text).EnumVar(&c.format, defaults.DefaultFormats...)
c.Flag("all", "List kubernetes clusters from all clusters and proxies.").Short('R').BoolVar(&c.listAll)
c.Flag("all", "List Kubernetes clusters from all clusters and proxies.").Short('R').BoolVar(&c.listAll)
c.Arg("labels", labelHelp).StringVar(&c.labels)
c.Flag("verbose", "Show an untruncated list of labels.").Short('v').BoolVar(&c.verbose)
c.Flag("quiet", "Quiet mode.").Short('q').BoolVar(&c.quiet)
@ -892,10 +892,10 @@ type kubeLoginCommand struct {
func newKubeLoginCommand(parent *kingpin.CmdClause) *kubeLoginCommand {
c := &kubeLoginCommand{
CmdClause: parent.Command("login", "Login to a kubernetes cluster"),
CmdClause: parent.Command("login", "Login to a Kubernetes cluster"),
}
c.Flag("cluster", clusterHelp).Short('c').StringVar(&c.siteName)
c.Arg("kube-cluster", "Name of the kubernetes cluster to login to. Check 'tsh kube ls' for a list of available clusters.").Required().StringVar(&c.kubeCluster)
c.Arg("kube-cluster", "Name of the Kubernetes cluster to login to. Check 'tsh kube ls' for a list of available clusters.").Required().StringVar(&c.kubeCluster)
c.Flag("as", "Configure custom Kubernetes user impersonation.").StringVar(&c.impersonateUser)
c.Flag("as-groups", "Configure custom Kubernetes group impersonation.").StringsVar(&c.impersonateGroups)
// TODO (tigrato): move this back to namespace once teleport drops the namespace flag.
@ -944,7 +944,7 @@ func (c *kubeLoginCommand) run(cf *CLIConf) error {
return trace.Wrap(err)
}
fmt.Printf("Logged into kubernetes cluster %q. Try 'kubectl version' to test the connection.\n", c.kubeCluster)
fmt.Printf("Logged into Kubernetes cluster %q. Try 'kubectl version' to test the connection.\n", c.kubeCluster)
return nil
}