Only fail when we can
@@ -28,7 +28,7 @@ public class CapacityPolicies {
}
public int decideSize(Capacity requestedCapacity) {
- int requestedNodes = ensureRedundancy(requestedCapacity.nodeCount());
+ int requestedNodes = ensureRedundancy(requestedCapacity.nodeCount(), requestedCapacity.canFail());
if (requestedCapacity.isRequired()) return requestedNodes;
switch(zone.environment()) {
@@ -68,12 +68,11 @@ public class CapacityPolicies {
* Throw if the node count is 1 and we're in a production zone
*
* @return the argument node count
- * @throws IllegalArgumentException if only one node is requested
+ * @throws IllegalArgumentException if only one node is requested and we can fail
*/
- private int ensureRedundancy(int nodeCount) {
- if (nodeCount == 1 && zone.environment().isProduction() && zone.system() != SystemName.cd) {
+ private int ensureRedundancy(int nodeCount, boolean canFail) {
+ if (canFail && nodeCount == 1 && zone.environment().isProduction() && zone.system() != SystemName.cd)
throw new IllegalArgumentException("Deployments to prod require at least 2 nodes per cluster for redundancy");
- }
return nodeCount;
}
