diff --git a/pkg/mgmt/lvmnode/builder.go b/pkg/mgmt/lvmnode/builder.go index c2405882..10ad9ab9 100644 --- a/pkg/mgmt/lvmnode/builder.go +++ b/pkg/mgmt/lvmnode/builder.go @@ -83,12 +83,13 @@ type NodeController struct { //This function returns controller object with all required keys set to watch over lvmnode object func newNodeController(kubeClient kubernetes.Interface, client dynamic.Interface, dynInformer dynamicinformer.DynamicSharedInformerFactory, ownerRef metav1.OwnerReference) *NodeController { + //Creating informer for lvm node resource nodeInformer := dynInformer.ForResource(noderesource).Informer() - klog.Infof("Creating event broadcaster") eventBroadcaster := record.NewBroadcaster() eventBroadcaster.StartLogging(klog.Infof) eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")}) recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerAgentName}) + klog.Infof("Creating lvm node controller object") nodeContrller := &NodeController{ kubeclientset: kubeClient, @@ -100,6 +101,8 @@ func newNodeController(kubeClient kubernetes.Interface, client dynamic.Interface pollInterval: 60 * time.Second, ownerRef: ownerRef, } + + klog.Infof("Adding Event handler functions for lvm node controller") nodeInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: nodeContrller.addNode, UpdateFunc: nodeContrller.updateNode, diff --git a/pkg/mgmt/snapshot/builder.go b/pkg/mgmt/snapshot/builder.go index aaa0883e..a109efbc 100644 --- a/pkg/mgmt/snapshot/builder.go +++ b/pkg/mgmt/snapshot/builder.go @@ -77,22 +77,23 @@ func newSnapController(kubeClient kubernetes.Interface, client dynamic.Interface dynInformer dynamicinformer.DynamicSharedInformerFactory) *SnapController { //Creating informer for lvmsnapshot resource snapInformer := dynInformer.ForResource(snapresource).Informer() - klog.Infoln("Using new rate limiter") + //This ratelimiter requeues failed items after 5 secs for first 12 attempts. Then objects are requeued after 30 secs. rateLimiter := workqueue.NewItemFastSlowRateLimiter(5*time.Second, 30*time.Second, 12) + klog.Infof("Creating event broadcaster") eventBroadcaster := record.NewBroadcaster() eventBroadcaster.StartLogging(klog.Infof) eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeClient.CoreV1().Events("")}) recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerAgentName}) + klog.Infof("Creating lvm snapshot controller object") snapCtrller := &SnapController{ kubeclientset: kubeClient, clientset: client, snapLister: dynamiclister.New(snapInformer.GetIndexer(), snapresource), snapSynced: snapInformer.HasSynced, - //workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "Snap"), - workqueue: workqueue.NewNamedRateLimitingQueue(rateLimiter, "Snap"), - recorder: recorder, + workqueue: workqueue.NewNamedRateLimitingQueue(rateLimiter, "Snap"), + recorder: recorder, } klog.Infof("Adding Event handler functions for lvm snapshot controller") snapInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ diff --git a/pkg/mgmt/volume/builder.go b/pkg/mgmt/volume/builder.go index 18c53a72..76016cc9 100644 --- a/pkg/mgmt/volume/builder.go +++ b/pkg/mgmt/volume/builder.go @@ -17,6 +17,8 @@ limitations under the License. package volume import ( + "time" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/dynamic" @@ -73,8 +75,11 @@ type VolController struct { //This function returns controller object with all required keys set to watch over lvmvolume object func newVolController(kubeClient kubernetes.Interface, client dynamic.Interface, dynInformer dynamicinformer.DynamicSharedInformerFactory) *VolController { - + //Creating informer for lvmvolume resource volInformer := dynInformer.ForResource(volresource).Informer() + //This ratelimiter requeues failed items after 5 secs for first 12 attempts. Then objects are requeued after 30 secs. + rateLimiter := workqueue.NewItemFastSlowRateLimiter(5*time.Second, 30*time.Second, 12) + klog.Infof("Creating event broadcaster") eventBroadcaster := record.NewBroadcaster() eventBroadcaster.StartLogging(klog.Infof) @@ -87,9 +92,10 @@ func newVolController(kubeClient kubernetes.Interface, client dynamic.Interface, clientset: client, VolLister: dynamiclister.New(volInformer.GetIndexer(), volresource), VolSynced: volInformer.HasSynced, - workqueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "Vol"), + workqueue: workqueue.NewNamedRateLimitingQueue(rateLimiter, "Vol"), recorder: recorder, } + klog.Infof("Adding Event handler functions for lvm volume controller") volInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: volCtrller.addVol,