diff options
author | Ola Aunronning <olaa@yahooinc.com> | 2023-04-14 11:21:26 +0200 |
---|---|---|
committer | Ola Aunronning <olaa@yahooinc.com> | 2023-04-14 11:21:26 +0200 |
commit | 155063573ae57c682e9208bac6a2fd2f9f0592c4 (patch) | |
tree | 7368be056292f4c461cb777fdfec2c4316b87c9d | |
parent | b353e521fd996a8062abe43e25dca03572ed1b0b (diff) |
Automatically approve CMR if only one proxy node impacted
2 files changed, 13 insertions, 3 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/vcmr/HostAction.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/vcmr/HostAction.java index f3bee721343..85c7f78eabc 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/vcmr/HostAction.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/vcmr/HostAction.java @@ -67,6 +67,7 @@ public class HostAction { OUT_OF_SYNC, NONE, RETIRING, + READY, RETIRED, COMPLETE } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VcmrMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VcmrMaintainer.java index 3e535b28b43..e1d9e5fdedb 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VcmrMaintainer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/VcmrMaintainer.java @@ -139,7 +139,10 @@ public class VcmrMaintainer extends ControllerMaintainer { return Stream.empty(); } var spareCapacity = hasSpareCapacity(zone, nodes); - return nodes.stream().map(node -> nextAction(zone, node, changeRequest, spareCapacity)); + var impactedProxyCount = nodes.stream() + .filter(node -> node.type() == NodeType.proxy) + .count(); + return nodes.stream().map(node -> nextAction(zone, node, changeRequest, spareCapacity, impactedProxyCount)); }).toList(); } @@ -162,7 +165,7 @@ public class VcmrMaintainer extends ControllerMaintainer { .findFirst(); } - private HostAction nextAction(ZoneId zoneId, Node node, VespaChangeRequest changeRequest, boolean spareCapacity) { + private HostAction nextAction(ZoneId zoneId, Node node, VespaChangeRequest changeRequest, boolean spareCapacity, long impactedProxyCount) { var hostAction = getPreviousAction(node, changeRequest) .orElse(new HostAction(node.hostname().value(), State.NONE, Instant.now())); @@ -188,7 +191,13 @@ public class VcmrMaintainer extends ControllerMaintainer { return hostAction.withState(State.PENDING_RETIREMENT); } - if (node.type() != NodeType.host || !spareCapacity) { + if (!spareCapacity) { + return hostAction.withState(State.REQUIRES_OPERATOR_ACTION); + } + + if (node.type() != NodeType.host) { + if (node.type() == NodeType.proxy && impactedProxyCount == 1) + return hostAction.withState(State.READY); return hostAction.withState(State.REQUIRES_OPERATOR_ACTION); } |