remove duplicated import

Kubernetes-commit: 217dbeafaf3293d193d6bdf3a8a220329d55dfe9
This commit is contained in:
stewart-yu 2018-11-13 20:08:39 +08:00 committed by Kubernetes Publisher
parent d17738308f
commit 4a9e8aba65

View File

@ -25,7 +25,6 @@ import (
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
appsinformers "k8s.io/client-go/informers/apps/v1" appsinformers "k8s.io/client-go/informers/apps/v1"
@ -150,7 +149,7 @@ func NewController(
// is closed, at which point it will shutdown the workqueue and wait for // is closed, at which point it will shutdown the workqueue and wait for
// workers to finish processing their current work items. // workers to finish processing their current work items.
func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error { func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error {
defer runtime.HandleCrash() defer utilruntime.HandleCrash()
defer c.workqueue.ShutDown() defer c.workqueue.ShutDown()
// Start the informer factories to begin populating the informer caches // Start the informer factories to begin populating the informer caches
@ -213,7 +212,7 @@ func (c *Controller) processNextWorkItem() bool {
// Forget here else we'd go into a loop of attempting to // Forget here else we'd go into a loop of attempting to
// process a work item that is invalid. // process a work item that is invalid.
c.workqueue.Forget(obj) c.workqueue.Forget(obj)
runtime.HandleError(fmt.Errorf("expected string in workqueue but got %#v", obj)) utilruntime.HandleError(fmt.Errorf("expected string in workqueue but got %#v", obj))
return nil return nil
} }
// Run the syncHandler, passing it the namespace/name string of the // Run the syncHandler, passing it the namespace/name string of the
@ -231,7 +230,7 @@ func (c *Controller) processNextWorkItem() bool {
}(obj) }(obj)
if err != nil { if err != nil {
runtime.HandleError(err) utilruntime.HandleError(err)
return true return true
} }
@ -245,7 +244,7 @@ func (c *Controller) syncHandler(key string) error {
// Convert the namespace/name string into a distinct namespace and name // Convert the namespace/name string into a distinct namespace and name
namespace, name, err := cache.SplitMetaNamespaceKey(key) namespace, name, err := cache.SplitMetaNamespaceKey(key)
if err != nil { if err != nil {
runtime.HandleError(fmt.Errorf("invalid resource key: %s", key)) utilruntime.HandleError(fmt.Errorf("invalid resource key: %s", key))
return nil return nil
} }
@ -255,7 +254,7 @@ func (c *Controller) syncHandler(key string) error {
// The Foo resource may no longer exist, in which case we stop // The Foo resource may no longer exist, in which case we stop
// processing. // processing.
if errors.IsNotFound(err) { if errors.IsNotFound(err) {
runtime.HandleError(fmt.Errorf("foo '%s' in work queue no longer exists", key)) utilruntime.HandleError(fmt.Errorf("foo '%s' in work queue no longer exists", key))
return nil return nil
} }
@ -267,7 +266,7 @@ func (c *Controller) syncHandler(key string) error {
// We choose to absorb the error here as the worker would requeue the // We choose to absorb the error here as the worker would requeue the
// resource otherwise. Instead, the next time the resource is updated // resource otherwise. Instead, the next time the resource is updated
// the resource will be queued again. // the resource will be queued again.
runtime.HandleError(fmt.Errorf("%s: deployment name must be specified", key)) utilruntime.HandleError(fmt.Errorf("%s: deployment name must be specified", key))
return nil return nil
} }
@ -340,7 +339,7 @@ func (c *Controller) enqueueFoo(obj interface{}) {
var key string var key string
var err error var err error
if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil { if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil {
runtime.HandleError(err) utilruntime.HandleError(err)
return return
} }
c.workqueue.AddRateLimited(key) c.workqueue.AddRateLimited(key)
@ -357,12 +356,12 @@ func (c *Controller) handleObject(obj interface{}) {
if object, ok = obj.(metav1.Object); !ok { if object, ok = obj.(metav1.Object); !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown) tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok { if !ok {
runtime.HandleError(fmt.Errorf("error decoding object, invalid type")) utilruntime.HandleError(fmt.Errorf("error decoding object, invalid type"))
return return
} }
object, ok = tombstone.Obj.(metav1.Object) object, ok = tombstone.Obj.(metav1.Object)
if !ok { if !ok {
runtime.HandleError(fmt.Errorf("error decoding object tombstone, invalid type")) utilruntime.HandleError(fmt.Errorf("error decoding object tombstone, invalid type"))
return return
} }
klog.V(4).Infof("Recovered deleted object '%s' from tombstone", object.GetName()) klog.V(4).Infof("Recovered deleted object '%s' from tombstone", object.GetName())