fix: return empty instead of error if cache unavailable (#25072)

Signed-off-by: Peter Jiang <peterjiang823@gmail.com>
Signed-off-by: Peter Jiang <35584807+pjiang-dev@users.noreply.github.com>
Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
This commit is contained in:
Peter Jiang 2025-11-04 04:26:19 -08:00 committed by github-actions[bot]
parent dabdf39772
commit 7eb53dbe32

View file

@ -1759,7 +1759,8 @@ func (s *Server) ManagedResources(ctx context.Context, q *application.ResourcesQ
return s.cache.GetAppManagedResources(a.InstanceName(s.ns), &items)
})
if err != nil {
return nil, fmt.Errorf("error getting cached app managed resources: %w", err)
log.Warnf("error getting cached app managed resources for %s/%s, cache unavailable, returning empty managed resources: %v", a.Namespace, a.Name, err)
return &application.ManagedResourcesResponse{Items: []*v1alpha1.ResourceDiff{}}, nil
}
res := &application.ManagedResourcesResponse{}
for i := range items {