Skip to content

Commit

Permalink
p/o/a/r/useroauthaccesstokens/delegate/proxywatcher: add support for …
Browse files Browse the repository at this point in the history
…cacheable object
  • Loading branch information
s-urbaniak committed Oct 5, 2022
1 parent 7794b2c commit 0e3466b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0e3466b

Please sign in to comment.