From 4d253838e0e92bd3fb405008e36e67c5d5176cca Mon Sep 17 00:00:00 2001 From: MichaelKatsoulis Date: Wed, 14 Feb 2024 11:10:11 +0200 Subject: [PATCH] Add method to return a watcher's event handler --- kubernetes/watcher.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kubernetes/watcher.go b/kubernetes/watcher.go index c18a6f468..9b02c93f2 100644 --- a/kubernetes/watcher.go +++ b/kubernetes/watcher.go @@ -54,6 +54,9 @@ type Watcher interface { // AddEventHandler add event handlers for corresponding event type watched AddEventHandler(ResourceEventHandler) + // GetEventHandler returns the event handlers for corresponding event type watched + GetEventHandler() ResourceEventHandler + // Store returns the store object for the watcher Store() cache.Store @@ -181,6 +184,11 @@ func (w *watcher) AddEventHandler(h ResourceEventHandler) { w.handler = h } +// GetEventHandler returns the watcher's event handler +func (w *watcher) GetEventHandler() ResourceEventHandler { + return w.handler +} + // Store returns the store object for the resource that is being watched func (w *watcher) Store() cache.Store { return w.store