Skip to content

Commit 355962a

Browse files
authored
Merge pull request #1297 from vincepri/bug-uncached-lists
🐛 Cache bypass should take into account List types
2 parents 280bb8a + 330c6e1 commit 355962a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/client/split.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package client
1818

1919
import (
2020
"context"
21+
"strings"
2122

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

0 commit comments

Comments
 (0)