forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
subcommand.go
35 lines (26 loc) · 1.25 KB
/
subcommand.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package serviceaccounts
import (
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
)
const ServiceAccountsRecommendedName = "serviceaccounts"
var serviceAccountsLong = templates.LongDesc(`Manage service accounts in your project
Service accounts allow system components to access the API.`)
const (
serviceAccountsShort = `Manage service accounts in your project`
)
func NewCmdServiceAccounts(name, fullName string, f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
cmds := &cobra.Command{
Use: name,
Short: serviceAccountsShort,
Long: serviceAccountsLong,
Aliases: []string{"sa"},
Run: kcmdutil.DefaultSubCommandRun(streams.ErrOut),
}
cmds.AddCommand(NewCommandCreateKubeconfig(CreateKubeconfigRecommendedName, fullName+" "+CreateKubeconfigRecommendedName, f, streams))
cmds.AddCommand(NewCommandGetServiceAccountToken(GetServiceAccountTokenRecommendedName, fullName+" "+GetServiceAccountTokenRecommendedName, f, streams))
cmds.AddCommand(NewCommandNewServiceAccountToken(NewServiceAccountTokenRecommendedName, fullName+" "+NewServiceAccountTokenRecommendedName, f, streams))
return cmds
}