From cb2db4a4133d3d1e41d5a0a5dbd20311fe01834d Mon Sep 17 00:00:00 2001 From: guoxudong Date: Sun, 7 Feb 2021 10:21:21 +0800 Subject: [PATCH] fix bug (#42) --- cmd/clear.go | 2 +- cmd/create.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/clear.go b/cmd/clear.go index d2475c98..4857cad2 100644 --- a/cmd/clear.go +++ b/cmd/clear.go @@ -14,7 +14,7 @@ type ClearCommand struct { BaseCommand } -// Init AliasCommand +// Init ClearCommand func (cl *ClearCommand) Init() { cl.command = &cobra.Command{ Use: "clear", diff --git a/cmd/create.go b/cmd/create.go index 185b1a11..6c301825 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -16,7 +16,7 @@ import ( clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ) -// ClearCommand clean command struct +// CreateCommand clean command struct type CreateCommand struct { BaseCommand } @@ -31,7 +31,7 @@ type CreateOptions struct { namespace string } -// Init AliasCommand +// Init CreateCommand func (ce *CreateCommand) Init() { ce.command = &cobra.Command{ Use: "create", @@ -132,7 +132,6 @@ func (co *CreateOptions) chooseNamespace() error { func (co *CreateOptions) createServiceAccounts() error { saName := co.userName - // TODO 判断 sa 是否存在 userServiceAccount, err := co.clientSet.CoreV1().ServiceAccounts(co.namespace).Get(context.TODO(), saName, metav1.GetOptions{}) if err != nil { saObj := &coreV1.ServiceAccount{ @@ -188,7 +187,6 @@ func (co *CreateOptions) selectClusterRole() error { } func (co *CreateOptions) createRoleBinding() error { - co.role = "view" rb := &rbacV1.RoleBinding{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("%s-%s", co.userName, co.role),