Skip to content

Commit c89861c

Browse files
authored
Merge pull request #279 from mortent/CachingStatusReaderContinue
CachingClusterReader should continue on all list errors
2 parents d3e1ad2 + 9525154 commit c89861c

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

pkg/kstatus/polling/clusterreader/caching_reader.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,13 @@ func (c *CachingClusterReader) Sync(ctx context.Context) error {
239239
list.SetGroupVersionKind(mapping.GroupVersionKind)
240240
err = c.reader.List(ctx, &list, listOptions...)
241241
if err != nil {
242-
// If we get an IsNotFound error here, it means the type
243-
// we are listing doesn't exist on the server. This is ok,
244-
// because it might be that a CRD is part of the set of
245-
// resources that are being applied.
246-
if errors.IsNotFound(err) {
247-
cache[gn] = cacheEntry{
248-
err: err,
249-
}
250-
continue
242+
// We continue even if there is an error. Whenever any pollers
243+
// request a resource covered by this gns, we just return the
244+
// error.
245+
cache[gn] = cacheEntry{
246+
err: err,
251247
}
252-
return err
248+
continue
253249
}
254250
cache[gn] = cacheEntry{
255251
resources: list,

pkg/kstatus/polling/clusterreader/caching_reader_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ func TestSync_Errors(t *testing.T) {
138138
apiextv1.SchemeGroupVersion.WithKind("CustomResourceDefinition"),
139139
),
140140
readerError: errors.NewInternalError(fmt.Errorf("testing")),
141-
expectSyncError: true,
141+
expectSyncError: false,
142142
cacheError: true,
143-
cacheErrorText: "not found",
143+
cacheErrorText: "Internal error occurred: testing",
144144
},
145145
"mapping not found": {
146146
mapper: testutil.NewFakeRESTMapper(),

0 commit comments

Comments
 (0)