From 13af68e3fc419a2a44024850ec5e04af9868b183 Mon Sep 17 00:00:00 2001 From: vishal Date: Mon, 18 Jan 2021 15:40:39 -0500 Subject: [PATCH] Ignore deleted batch apis in cortex get --- pkg/operator/resources/batchapi/api.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/operator/resources/batchapi/api.go b/pkg/operator/resources/batchapi/api.go index 5c54193556..6e02cf5f55 100644 --- a/pkg/operator/resources/batchapi/api.go +++ b/pkg/operator/resources/batchapi/api.go @@ -192,6 +192,11 @@ func GetAllAPIs(virtualServices []istioclientnetworking.VirtualService, k8sJobs for _, jobKey := range inProgressJobKeys { alreadyAdded := false + if _, ok := batchAPIsMap[jobKey.APIName]; !ok { + // It is possible that the Batch API may have been deleted but the in progress job keys have not been deleted yet + continue + } + for _, jobStatus := range batchAPIsMap[jobKey.APIName].JobStatuses { if jobStatus.ID == jobKey.ID { alreadyAdded = true