From 0e3466b72ba4ba796772326cf04a8e4b5d8e76b1 Mon Sep 17 00:00:00 2001 From: Sergiusz Urbaniak Date: Wed, 5 Oct 2022 17:50:05 +0200 Subject: [PATCH] p/o/a/r/useroauthaccesstokens/delegate/proxywatcher: add support for cacheable object --- .../useroauthaccesstokens/delegate/proxywatcher.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/oauth/apiserver/registry/useroauthaccesstokens/delegate/proxywatcher.go b/pkg/oauth/apiserver/registry/useroauthaccesstokens/delegate/proxywatcher.go index 5aed872bb0..14dbfe9db6 100644 --- a/pkg/oauth/apiserver/registry/useroauthaccesstokens/delegate/proxywatcher.go +++ b/pkg/oauth/apiserver/registry/useroauthaccesstokens/delegate/proxywatcher.go @@ -6,6 +6,7 @@ import ( "sync" "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/watch" @@ -72,7 +73,11 @@ func (w *OAuthAccessTokenWatcher) Watch(ctx context.Context) { case watch.Error: w.outgoing <- event default: - tokenOrig, ok := event.Object.(*oauthapi.OAuthAccessToken) + obj := event.Object + if cacheable, ok := event.Object.(runtime.CacheableObject); ok { + obj = cacheable.GetObject() + } + tokenOrig, ok := obj.(*oauthapi.OAuthAccessToken) if !ok { w.outgoing <- createErrorEvent(errors.NewInternalError(fmt.Errorf("failed to convert incoming object to an OAuthAccessToken type"))) continue