@Override
    protected NodeList getExpiredNodes() {
        List<Node> deprovisioned = nodeRepository().nodes().list(Node.State.deprovisioned)
                                                   .sortedBy(comparing(node -> node.history().event(Type.deprovisioned)
                                                                                   .map(History.Event::at)
                                                                                   .orElse(Instant.EPOCH)))
                                                   .asList();
        Deque<Node> expired = new ArrayDeque<>(deprovisioned);
        int kept = 0;
        while ( ! expired.isEmpty()) {
            if (isExpired(expired.getLast()) || kept++ >= maxDeprovisionedNodes) break; // If we encounter an expired node, the rest are also expired.
            expired.removeLast();
        }
        return NodeList.copyOf(List.copyOf(expired));
    }
This removes hosts from {@link com.yahoo.vespa.hosted.provision.Node.State#deprovisioned}, in dynamically provisioned
zones, after a grace period.

@author mpolden
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/DeprovisionedExpirer.java