private void validateBudget(BigDecimal budget, Context context,
                                CapacityPolicies capacityPolicies) {
        var zone = context.deployState().zone();
        var application = context.model().applicationPackage().getApplicationId();

        var maxSpend = 0.0;
        for (var spec : context.model().allClusters()) {
            if (adminClusterIds(context.model()).contains(spec.id())) continue;
            var cluster = context.model().provisioned().clusters().get(spec.id());
            var capacity = context.model().provisioned().capacities().getOrDefault(spec.id(), zeroCapacity);
            maxSpend += capacityPolicies.applyOn(capacity, cluster.isExclusive()).maxResources().cost();
        }

        var actualSpend = context.model().allocatedHosts().getHosts().stream()
                         .filter(hostSpec -> hostSpec.membership().get().cluster().type() != ClusterSpec.Type.admin)
                         .mapToDouble(hostSpec -> hostSpec.advertisedResources().cost())
                         .sum();

        if (Math.abs(actualSpend) < 0.01) {
            log.warning("Deploying application " + application + " with zero budget use.  This is suspicious, but not blocked");
            return;
        }

        throwIfBudgetNegative(actualSpend, budget, zone.system());
        throwIfBudgetExceeded(actualSpend, budget, zone.system(), true);
        if ( ! zone.environment().isTest()) // Usage is constant after deploy in test zones
            throwIfBudgetExceeded(maxSpend, budget, zone.system(), false);
    }
Checks that the generated model does not have resources that exceeds the given quota.

@author ogronnesby
config-model/src/main/java/com/yahoo/vespa/model/application/validation/QuotaValidator.java