Fix UpdateOrCreateToken get secrets err handling optimization
Signed-off-by: lonelyCZ <chengzhe@zju.edu.cn>
This commit is contained in:
parent
a9089325dc
commit
8b67d22786
|
@ -322,7 +322,7 @@ func UpdateOrCreateToken(client kubeclient.Interface, failIfExists bool, token *
|
|||
if err != nil && !apierrors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
if secret != nil && failIfExists {
|
||||
if secret != nil && err == nil && failIfExists {
|
||||
return fmt.Errorf("a token with id %q already exists", token.Token.ID)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue