class ReapPodLookupFilter implements Producer<Pod> {

    protected static boolean isPodPastAge(Pod pod, Instant reapUpperBoundUTC)
    {
        String finishedAtString;
        if(pod.getStatus().getContainerStatuses() != null && pod.getStatus().getContainerStatuses().size() > 0)
        {
            // normal operation completion (pod started and exited)
            // the end time of the 0 index container within the pod is acceptable for our use
            finishedAtString = pod.getStatus().getContainerStatuses().get(0).getState().getTerminated().getFinishedAt();
        }
        else
        {
            // abnormal operation, we only have the start time on a failed pod (might have run out of CPU or was never scheduled)
            logger.warn("Abnormal pod exit detected. Using start time for reap evaluation. Pod={} ExitReason={}", pod.getMetadata().getName(), pod.getStatus().getReason());
            finishedAtString = pod.getStatus().getStartTime();
        }

        Instant finishedInstant;
        try
        {
            finishedInstant = Instant.from(DateTimeFormatter.ISO_INSTANT.parse(finishedAtString));
        }
        catch(DateTimeParseException e)
        {
            logger.error("Failed to parse the finished time [{}]. Skipping reap for pod={}", finishedAtString, pod.getMetadata().getName());
            return false;
        }

        return InstantUtil.isAfterOrEqual(reapUpperBoundUTC, finishedInstant);
    }

    public  ReapPodLookupFilter(KubernetesPodFacade kubernetesPodFacade, Instant reapUpperBoundUTC);

}