From 4a9e8aba65f4a8f7cc0b26f74035d3b5b0fe4ac0 Mon Sep 17 00:00:00 2001 From: stewart-yu Date: Tue, 13 Nov 2018 20:08:39 +0800 Subject: [PATCH] remove duplicated import Kubernetes-commit: 217dbeafaf3293d193d6bdf3a8a220329d55dfe9 --- controller.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/controller.go b/controller.go index e9d1d838..bea78e72 100644 --- a/controller.go +++ b/controller.go @@ -25,7 +25,6 @@ import ( "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" 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 // workers to finish processing their current work items. func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error { - defer runtime.HandleCrash() + defer utilruntime.HandleCrash() defer c.workqueue.ShutDown() // 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 // process a work item that is invalid. 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 } // Run the syncHandler, passing it the namespace/name string of the @@ -231,7 +230,7 @@ func (c *Controller) processNextWorkItem() bool { }(obj) if err != nil { - runtime.HandleError(err) + utilruntime.HandleError(err) return true } @@ -245,7 +244,7 @@ func (c *Controller) syncHandler(key string) error { // Convert the namespace/name string into a distinct namespace and name namespace, name, err := cache.SplitMetaNamespaceKey(key) if err != nil { - runtime.HandleError(fmt.Errorf("invalid resource key: %s", key)) + utilruntime.HandleError(fmt.Errorf("invalid resource key: %s", key)) 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 // processing. 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 } @@ -267,7 +266,7 @@ func (c *Controller) syncHandler(key string) error { // We choose to absorb the error here as the worker would requeue the // resource otherwise. Instead, the next time the resource is updated // 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 } @@ -340,7 +339,7 @@ func (c *Controller) enqueueFoo(obj interface{}) { var key string var err error if key, err = cache.MetaNamespaceKeyFunc(obj); err != nil { - runtime.HandleError(err) + utilruntime.HandleError(err) return } c.workqueue.AddRateLimited(key) @@ -357,12 +356,12 @@ func (c *Controller) handleObject(obj interface{}) { if object, ok = obj.(metav1.Object); !ok { tombstone, ok := obj.(cache.DeletedFinalStateUnknown) if !ok { - runtime.HandleError(fmt.Errorf("error decoding object, invalid type")) + utilruntime.HandleError(fmt.Errorf("error decoding object, invalid type")) return } object, ok = tombstone.Obj.(metav1.Object) if !ok { - runtime.HandleError(fmt.Errorf("error decoding object tombstone, invalid type")) + utilruntime.HandleError(fmt.Errorf("error decoding object tombstone, invalid type")) return } klog.V(4).Infof("Recovered deleted object '%s' from tombstone", object.GetName())