Skip to content

Commit

Permalink
Merge pull request #1297 from vincepri/bug-uncached-lists
Browse files Browse the repository at this point in the history
🐛 Cache bypass should take into account List types
  • Loading branch information
k8s-ci-robot committed Dec 15, 2020
2 parents 280bb8a + 330c6e1 commit 355962a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/client/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package client

import (
"context"
"strings"

"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down Expand Up @@ -99,6 +100,11 @@ func (d *delegatingReader) shouldBypassCache(obj runtime.Object) (bool, error) {
if err != nil {
return false, err
}
// TODO: this is producing unsafe guesses that don't actually work,
// but it matches ~99% of the cases out there.
if meta.IsListType(obj) {
gvk.Kind = strings.TrimSuffix(gvk.Kind, "List")
}
_, isUncached := d.uncachedGVKs[gvk]
_, isUnstructured := obj.(*unstructured.Unstructured)
_, isUnstructuredList := obj.(*unstructured.UnstructuredList)
Expand Down

0 comments on commit 355962a

Please sign in to comment.