diff options
author | HÃ¥kon Hallingstad <hakon.hallingstad@gmail.com> | 2021-01-06 10:30:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-06 10:30:28 +0100 |
commit | b943b03af2230a9c587ab1bd4bcd76d719bccd9d (patch) | |
tree | 062eb6ef31aac00302a522f6d18230dbcca7fb20 /controller-api | |
parent | c884724f349dc332ac514e9f0d0bc189f7f34410 (diff) |
Revert "Make clients use orchestratorStatus instead of allowedToBeDown"
Diffstat (limited to 'controller-api')
4 files changed, 11 insertions, 33 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java index b9a81ba8a02..04f1448bec1 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java @@ -263,9 +263,7 @@ public class Node { public enum ServiceState { expectedUp, allowedDown, - permanentlyDown, - unorchestrated, - unknown + unorchestrated } /** Known cluster types. */ diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java index 76055e4ddf2..7bbf0fb0578 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java @@ -13,7 +13,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeList import com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeMembership; import com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeRepositoryNode; import com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeState; -import com.yahoo.vespa.hosted.controller.api.integration.noderepository.OrchestratorStatus; import java.time.Duration; import java.time.Instant; @@ -119,7 +118,7 @@ public interface NodeRepository { versionFrom(node.getWantedOsVersion()), Optional.ofNullable(node.getCurrentFirmwareCheck()).map(Instant::ofEpochMilli), Optional.ofNullable(node.getWantedFirmwareCheck()).map(Instant::ofEpochMilli), - toServiceState(node.getOrchestratorStatus()), + fromBoolean(node.getAllowedToBeDown()), Optional.ofNullable(node.suspendedSinceMillis()).map(Instant::ofEpochMilli), toInt(node.getCurrentRestartGeneration()), toInt(node.getRestartGeneration()), @@ -205,15 +204,10 @@ public interface NodeRepository { } } - private static Node.ServiceState toServiceState(OrchestratorStatus orchestratorStatus) { - switch (orchestratorStatus) { - case ALLOWED_TO_BE_DOWN: return Node.ServiceState.allowedDown; - case PERMANENTLY_DOWN: return Node.ServiceState.permanentlyDown; - case NO_REMARKS: return Node.ServiceState.expectedUp; - case OTHER: return Node.ServiceState.unknown; - } - - return Node.ServiceState.unknown; + private static Node.ServiceState fromBoolean(Boolean allowedDown) { + return (allowedDown == null) + ? Node.ServiceState.unorchestrated + : allowedDown ? Node.ServiceState.allowedDown : Node.ServiceState.expectedUp; } private static double toDouble(Double d) { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryNode.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryNode.java index a63058572f9..0533d30b584 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryNode.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryNode.java @@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.JsonNode; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.stream.Stream; @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) @@ -83,8 +82,8 @@ public class NodeRepositoryNode { private Integer cost; @JsonProperty("history") private List<NodeHistory> history; - @JsonProperty("orchestratorStatus") - private String orchestratorStatus; + @JsonProperty("allowedToBeDown") + private Boolean allowedToBeDown; @JsonProperty("suspendedSinceMillis") private Long suspendedSinceMillis; @JsonProperty("reports") @@ -328,15 +327,8 @@ public class NodeRepositoryNode { this.history = history; } - public OrchestratorStatus getOrchestratorStatus() { - if (orchestratorStatus == null) { - return OrchestratorStatus.NO_REMARKS; - } - - return Stream.of(OrchestratorStatus.values()) - .filter(status -> status.name().equalsIgnoreCase(orchestratorStatus)) - .findAny() - .orElse(OrchestratorStatus.OTHER); + public Boolean getAllowedToBeDown() { + return allowedToBeDown; } public Long suspendedSinceMillis() { @@ -449,7 +441,7 @@ public class NodeRepositoryNode { ", wantToDeprovision=" + wantToDeprovision + ", cost=" + cost + ", history=" + history + - ", orchestratorStatus=" + orchestratorStatus + + ", allowedToBeDown=" + allowedToBeDown + ", reports=" + reports + ", modelName=" + modelName + ", reservedTo=" + reservedTo + diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/OrchestratorStatus.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/OrchestratorStatus.java deleted file mode 100644 index 51942b56b3d..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/OrchestratorStatus.java +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.controller.api.integration.noderepository; - -public enum OrchestratorStatus { - NO_REMARKS, ALLOWED_TO_BE_DOWN, PERMANENTLY_DOWN, OTHER -} |