K8s: Get trash fixes (#106411)

This commit is contained in:
Stephanie Hingtgen
2025-06-11 13:54:38 -05:00
committed by GitHub
parent 8fdf86e56f
commit 7864c1660f
12 changed files with 367 additions and 4 deletions
+8 -1
View File
@@ -780,7 +780,14 @@ func (b *backend) getHistory(ctx context.Context, req *resourcepb.ListRequest, c
listReq.MinRV = latestDeletedRV + 1
}
rows, err := dbutil.QueryRows(ctx, tx, sqlResourceHistoryGet, listReq)
var rows db.Rows
if listReq.Trash {
// unlike history, trash will not return an object if an object of the same name is live
// (i.e. in the resource table)
rows, err = dbutil.QueryRows(ctx, tx, sqlResourceTrash, listReq)
} else {
rows, err = dbutil.QueryRows(ctx, tx, sqlResourceHistoryGet, listReq)
}
if rows != nil {
defer func() {
if err := rows.Close(); err != nil {