From 328f78da048175a39068e38a1009e6e2ff2ee31e Mon Sep 17 00:00:00 2001 From: Andreas Gkizas Date: Tue, 9 Jan 2024 15:10:28 +0200 Subject: [PATCH] adding check for oldobjectreturn --- kubernetes/watcher.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kubernetes/watcher.go b/kubernetes/watcher.go index 5ae6be82a..cd786a42a 100644 --- a/kubernetes/watcher.go +++ b/kubernetes/watcher.go @@ -231,7 +231,11 @@ func (w *watcher) enqueue(obj interface{}, state string) { // oldobjectreturn returns the old version of cache objects before change on update events func (w *watcher) oldobjectreturn(o interface{}) { - w.oldobject = o.(runtime.Object) + if old, ok := o.(runtime.Object); !ok { + utilruntime.HandleError(fmt.Errorf("expected object in cache got %#v", o)) + } else { + w.oldobject = old + } } // process gets the top of the work queue and processes the object that is received.