Alias api/errors instead of stdlib errors

This commit is contained in:
Timo Reimann 2022-10-21 14:08:29 +02:00
parent a179203bdb
commit ea4ce5dc28

View File

@ -18,14 +18,14 @@ package service
import (
"context"
stderrors "errors"
"errors"
"fmt"
"reflect"
"sync"
"time"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/sets"
@ -291,7 +291,7 @@ func (c *Controller) processNextServiceItem(ctx context.Context) bool {
}
var re *api.RetryError
if stderrors.As(err, &re) {
if errors.As(err, &re) {
klog.V(4).Infof("Retrying processing for service %v in %s", key, re.RetryAfter())
c.serviceQueue.AddAfter(key, re.RetryAfter())
} else {
@ -424,7 +424,7 @@ func (c *Controller) syncLoadBalancerIfNeeded(ctx context.Context, service *v1.S
// - Not found error mostly happens when service disappears right after
// we remove the finalizer.
// - We can't patch status on non-exist service anyway.
if !errors.IsNotFound(err) {
if !apierrors.IsNotFound(err) {
return op, fmt.Errorf("failed to update load balancer status: %v", err)
}
}
@ -846,7 +846,7 @@ func (c *Controller) syncService(ctx context.Context, key string) error {
// service holds the latest service info from apiserver
service, err := c.serviceLister.Services(namespace).Get(name)
switch {
case errors.IsNotFound(err):
case apierrors.IsNotFound(err):
// service absence in store means watcher caught the deletion, ensure LB info is cleaned
err = c.processServiceDeletion(ctx, key)
case err != nil: