unify alias of api errors under pkg and staging

This commit is contained in:
danielqsj
2019-11-12 16:26:59 +08:00
parent fc738cbb1d
commit 5bc0e26c19
23 changed files with 116 additions and 116 deletions

View File

@@ -21,7 +21,7 @@ import (
"time"
"k8s.io/api/core/v1"
apierrs "k8s.io/apimachinery/pkg/api/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
@@ -188,7 +188,7 @@ func (c *ServiceAccountsController) syncNamespace(key string) error {
}()
ns, err := c.nsLister.Get(key)
if apierrs.IsNotFound(err) {
if apierrors.IsNotFound(err) {
return nil
}
if err != nil {
@@ -204,7 +204,7 @@ func (c *ServiceAccountsController) syncNamespace(key string) error {
switch _, err := c.saLister.ServiceAccounts(ns.Name).Get(sa.Name); {
case err == nil:
continue
case apierrs.IsNotFound(err):
case apierrors.IsNotFound(err):
case err != nil:
return err
}
@@ -212,9 +212,9 @@ func (c *ServiceAccountsController) syncNamespace(key string) error {
// TODO eliminate this once the fake client can handle creation without NS
sa.Namespace = ns.Name
if _, err := c.client.CoreV1().ServiceAccounts(ns.Name).Create(&sa); err != nil && !apierrs.IsAlreadyExists(err) {
if _, err := c.client.CoreV1().ServiceAccounts(ns.Name).Create(&sa); err != nil && !apierrors.IsAlreadyExists(err) {
// we can safely ignore terminating namespace errors
if !apierrs.HasStatusCause(err, v1.NamespaceTerminatingCause) {
if !apierrors.HasStatusCause(err, v1.NamespaceTerminatingCause) {
createFailures = append(createFailures, err)
}
}