aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHÃ¥kon Hallingstad <hakon@verizonmedia.com>2021-07-30 14:47:09 +0200
committerGitHub <noreply@github.com>2021-07-30 14:47:09 +0200
commit664f635fb91a06472dec6bf77dc727ebe80e683c (patch)
treebc661d70192907ff3f9ea60114870f6cb9f82e96
parent606b4590cd66dd104ca04ce11cef9466dcfcfe74 (diff)
parentcf8fe2952ef7133d9fa4d769d8dec47984422734 (diff)
Merge pull request #18654 from vespa-engine/revert-18653-revert-18650-hakonhall/orc-of-proxies
Pass around orchestration parameters, try 2
-rw-r--r--application-model/src/main/java/com/yahoo/vespa/applicationmodel/ApplicationInstanceId.java3
-rw-r--r--application-model/src/main/java/com/yahoo/vespa/applicationmodel/ClusterId.java2
-rw-r--r--application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java16
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ApplicationApiFactory.java11
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ApplicationApiImpl.java9
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApiImpl.java8
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ApplicationParams.java68
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ClusterParams.java61
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/HostedVespaOrchestration.java101
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/OrchestrationParams.java53
-rw-r--r--orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ClusterApiImplTest.java17
-rw-r--r--orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ModelTestUtils.java17
-rw-r--r--service-monitor/src/main/java/com/yahoo/vespa/service/duper/InfraApplication.java2
13 files changed, 350 insertions, 18 deletions
diff --git a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ApplicationInstanceId.java b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ApplicationInstanceId.java
index 801213dcf40..ed2b06a18f3 100644
--- a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ApplicationInstanceId.java
+++ b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ApplicationInstanceId.java
@@ -16,6 +16,9 @@ public class ApplicationInstanceId {
public boolean isConfigServerHost() { return id.startsWith("configserver-host:"); }
public static final ApplicationInstanceId CONTROLLER_HOST = new ApplicationInstanceId("controller-host:prod:default:default");
public boolean isTenantHost() { return id.startsWith("tenant-host:"); }
+ public boolean isProxyHost() { return id.startsWith("proxy-host:"); }
+ // Routing application instance ID is of the form: routing:prod:eu-west-1:default
+ public boolean isProxy() { return id.startsWith("routing:"); }
private final String id;
diff --git a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ClusterId.java b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ClusterId.java
index d7995b41616..40fdbd52a92 100644
--- a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ClusterId.java
+++ b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ClusterId.java
@@ -14,6 +14,8 @@ public class ClusterId {
public static final ClusterId CONTROLLER = new ClusterId("controller");
public static final ClusterId CONFIG_SERVER_HOST = new ClusterId("configserver-host");
public static final ClusterId CONTROLLER_HOST = new ClusterId("controller-host");
+ public static final ClusterId PROXY_HOST = new ClusterId("proxy-host");
+ public static final ClusterId ROUTING = new ClusterId("routing");
public static final ClusterId TENANT_HOST = new ClusterId("tenant-host");
private final String id;
diff --git a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java
index baede298896..f7398d0478f 100644
--- a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java
+++ b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceCluster.java
@@ -98,12 +98,28 @@ public class ServiceCluster {
Objects.equals(serviceType, ServiceType.HOST_ADMIN);
}
+ @JsonIgnore
+ public boolean isProxy() {
+ return isHostedVespaApplicationWithPredicate(ApplicationInstanceId::isProxy) &&
+ Objects.equals(clusterId, ClusterId.ROUTING) &&
+ Objects.equals(serviceType, ServiceType.CONTAINER);
+ }
+
+ @JsonIgnore
+ public boolean isProxyHost() {
+ return isHostedVespaApplicationWithPredicate(ApplicationInstanceId::isProxyHost) &&
+ Objects.equals(clusterId, ClusterId.PROXY_HOST) &&
+ Objects.equals(serviceType, ServiceType.HOST_ADMIN);
+ }
+
public String nodeDescription(boolean plural) {
String pluralSuffix = plural ? "s" : "";
return isConfigServer() ? "config server" + pluralSuffix :
isConfigServerHost() ? "config server host" + pluralSuffix :
isController() ? "controller" + pluralSuffix :
isControllerHost() ? "controller host" + pluralSuffix :
+ isProxy() ? (plural ? "proxies" : "proxy") :
+ isProxyHost() ? "proxy host" + pluralSuffix :
isTenantHost() ? "tenant host" + pluralSuffix :
"node" + pluralSuffix + " of {" + serviceType + "," + clusterId + "}";
}
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ApplicationApiFactory.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ApplicationApiFactory.java
index d913a1791ba..a3f2fd6e235 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ApplicationApiFactory.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ApplicationApiFactory.java
@@ -1,7 +1,11 @@
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.orchestrator.model;
+import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.vespa.orchestrator.OrchestratorUtil;
import com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactory;
+import com.yahoo.vespa.orchestrator.policy.HostedVespaOrchestration;
+import com.yahoo.vespa.orchestrator.policy.OrchestrationParams;
import com.yahoo.vespa.orchestrator.status.ApplicationLock;
import java.time.Clock;
@@ -11,19 +15,20 @@ import java.time.Clock;
*/
public class ApplicationApiFactory {
- private final int numberOfConfigServers;
+ private final OrchestrationParams orchestrationParams;
private final Clock clock;
public ApplicationApiFactory(int numberOfConfigServers, Clock clock) {
- this.numberOfConfigServers = numberOfConfigServers;
+ this.orchestrationParams = HostedVespaOrchestration.create(numberOfConfigServers, 0);
this.clock = clock;
}
public ApplicationApi create(NodeGroup nodeGroup,
ApplicationLock lock,
ClusterControllerClientFactory clusterControllerClientFactory) {
+ ApplicationId applicationId = OrchestratorUtil.toApplicationId(lock.getApplicationInstanceReference());
return new ApplicationApiImpl(nodeGroup, lock, clusterControllerClientFactory,
- numberOfConfigServers, clock);
+ orchestrationParams.getApplicationParams(applicationId), clock);
}
}
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ApplicationApiImpl.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ApplicationApiImpl.java
index efbf9ff7981..804aff70a7f 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ApplicationApiImpl.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ApplicationApiImpl.java
@@ -9,6 +9,7 @@ import com.yahoo.vespa.applicationmodel.ServiceInstance;
import com.yahoo.vespa.orchestrator.OrchestratorContext;
import com.yahoo.vespa.orchestrator.OrchestratorUtil;
import com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactory;
+import com.yahoo.vespa.orchestrator.policy.ApplicationParams;
import com.yahoo.vespa.orchestrator.status.ApplicationInstanceStatus;
import com.yahoo.vespa.orchestrator.status.ApplicationLock;
import com.yahoo.vespa.orchestrator.status.HostInfos;
@@ -38,13 +39,13 @@ public class ApplicationApiImpl implements ApplicationApi {
public ApplicationApiImpl(NodeGroup nodeGroup,
ApplicationLock lock,
ClusterControllerClientFactory clusterControllerClientFactory,
- int numberOfConfigServers, Clock clock) {
+ ApplicationParams params, Clock clock) {
this.applicationInstance = nodeGroup.getApplication();
this.nodeGroup = nodeGroup;
this.lock = lock;
this.clock = clock;
this.hostInfos = lock.getHostInfos();
- this.clusterInOrder = makeClustersInOrder(nodeGroup, hostInfos, clusterControllerClientFactory, numberOfConfigServers);
+ this.clusterInOrder = makeClustersInOrder(nodeGroup, hostInfos, clusterControllerClientFactory, params);
}
@Override
@@ -113,7 +114,7 @@ public class ApplicationApiImpl implements ApplicationApi {
private List<ClusterApi> makeClustersInOrder(NodeGroup nodeGroup,
HostInfos hostInfos,
ClusterControllerClientFactory clusterControllerClientFactory,
- int numberOfConfigServers) {
+ ApplicationParams params) {
Set<ServiceCluster> clustersInGroup = getServiceClustersInGroup(nodeGroup);
return clustersInGroup.stream()
.map(serviceCluster -> new ClusterApiImpl(
@@ -122,7 +123,7 @@ public class ApplicationApiImpl implements ApplicationApi {
nodeGroup,
hostInfos,
clusterControllerClientFactory,
- numberOfConfigServers,
+ params.clusterParamsFor(serviceCluster.clusterId(), serviceCluster.serviceType()),
clock))
.sorted(ApplicationApiImpl::compareClusters)
.collect(Collectors.toList());
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApiImpl.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApiImpl.java
index 57dcb5f3069..6e88b227e61 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApiImpl.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApiImpl.java
@@ -8,6 +8,7 @@ import com.yahoo.vespa.applicationmodel.ServiceInstance;
import com.yahoo.vespa.applicationmodel.ServiceStatus;
import com.yahoo.vespa.applicationmodel.ServiceType;
import com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactory;
+import com.yahoo.vespa.orchestrator.policy.ClusterParams;
import com.yahoo.vespa.orchestrator.policy.SuspensionReasons;
import com.yahoo.vespa.orchestrator.status.HostInfos;
import com.yahoo.vespa.orchestrator.status.HostStatus;
@@ -59,7 +60,7 @@ class ClusterApiImpl implements ClusterApi {
NodeGroup nodeGroup,
HostInfos hostInfos,
ClusterControllerClientFactory clusterControllerClientFactory,
- int numberOfConfigServers,
+ ClusterParams clusterParams,
Clock clock) {
this.applicationApi = applicationApi;
this.serviceCluster = serviceCluster;
@@ -81,9 +82,8 @@ class ClusterApiImpl implements ClusterApi {
servicesDownAndNotInGroup = servicesNotInGroup.stream().filter(this::serviceEffectivelyDown).collect(Collectors.toSet());
int serviceInstances = serviceCluster.serviceInstances().size();
- if ((serviceCluster.isConfigServerLike() || serviceCluster.isConfigServerHostLike()) &&
- serviceInstances < numberOfConfigServers) {
- missingServices = numberOfConfigServers - serviceInstances;
+ if (clusterParams.size().isPresent() && serviceInstances < clusterParams.size().getAsInt()) {
+ missingServices = clusterParams.size().getAsInt() - serviceInstances;
descriptionOfMissingServices = missingServices + " missing " + serviceCluster.nodeDescription(missingServices > 1);
} else {
missingServices = 0;
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ApplicationParams.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ApplicationParams.java
new file mode 100644
index 00000000000..97574fc90ce
--- /dev/null
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ApplicationParams.java
@@ -0,0 +1,68 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.orchestrator.policy;
+
+import com.yahoo.vespa.applicationmodel.ClusterId;
+import com.yahoo.vespa.applicationmodel.ServiceCluster;
+import com.yahoo.vespa.applicationmodel.ServiceClusterKey;
+import com.yahoo.vespa.applicationmodel.ServiceType;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Per-application parameters controlling the orchestration.
+ *
+ * @author hakonhall
+ */
+public class ApplicationParams {
+
+ private static final ApplicationParams DEFAULT = new ApplicationParams.Builder().build();
+
+ private final Map<ServiceClusterKey, ClusterParams> clusterParams;
+
+ public static class Builder {
+ private final Map<ServiceClusterKey, ClusterParams> clusterParams = new HashMap<>();
+
+ public Builder() {}
+
+ public Builder add(ClusterId clusterId, ServiceType serviceType, ClusterParams clusterParams) {
+ this.clusterParams.put(new ServiceClusterKey(clusterId, serviceType), clusterParams);
+ return this;
+ }
+
+ public ApplicationParams build() {
+ return new ApplicationParams(clusterParams);
+ }
+ }
+
+ public static ApplicationParams getDefault() {
+ return DEFAULT;
+ }
+
+ private ApplicationParams(Map<ServiceClusterKey, ClusterParams> clusterParams) {
+ this.clusterParams = Map.copyOf(clusterParams);
+ }
+
+ public ClusterParams clusterParamsFor(ServiceCluster serviceCluster) {
+ return clusterParamsFor(serviceCluster.clusterId(), serviceCluster.serviceType());
+ }
+
+ public ClusterParams clusterParamsFor(ClusterId clusterId, ServiceType serviceType) {
+ var key = new ServiceClusterKey(clusterId, serviceType);
+ return clusterParams.getOrDefault(key, ClusterParams.getDefault());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ApplicationParams that = (ApplicationParams) o;
+ return clusterParams.equals(that.clusterParams);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(clusterParams);
+ }
+}
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ClusterParams.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ClusterParams.java
new file mode 100644
index 00000000000..b6f90ab7302
--- /dev/null
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ClusterParams.java
@@ -0,0 +1,61 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.orchestrator.policy;
+
+import java.util.Objects;
+import java.util.OptionalInt;
+
+/**
+ * Parameters controlling orchestration of a particular service cluster of an implied application.
+ *
+ * @author hakonhall
+ */
+public class ClusterParams {
+
+ private static final ClusterParams DEFAULT = new ClusterParams.Builder().build();
+
+ private final int size;
+
+ public static class Builder {
+ private int size = 0;
+
+ public Builder() {}
+
+ public Builder setSize(int size) {
+ this.size = size;
+ return this;
+ }
+
+ public ClusterParams build() {
+ return new ClusterParams(size);
+ }
+ }
+
+ public static ClusterParams getDefault() {
+ return DEFAULT;
+ }
+
+ private ClusterParams(int size) {
+ this.size = size;
+ }
+
+ /**
+ * The expected and ideal number of members of the cluster: Count missing services as down,
+ * and expected to be added to the application soon.
+ */
+ public OptionalInt size() {
+ return size > 0 ? OptionalInt.of(size) : OptionalInt.empty();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ClusterParams that = (ClusterParams) o;
+ return size == that.size;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(size);
+ }
+}
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/HostedVespaOrchestration.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/HostedVespaOrchestration.java
new file mode 100644
index 00000000000..e9a27cddaeb
--- /dev/null
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/HostedVespaOrchestration.java
@@ -0,0 +1,101 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.orchestrator.policy;
+
+import com.yahoo.cloud.config.ConfigserverConfig;
+import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.vespa.applicationmodel.ClusterId;
+import com.yahoo.vespa.applicationmodel.ServiceType;
+
+/**
+ * Creates orchestration parameters for hosted Vespa.
+ *
+ * @author hakonhall
+ */
+public class HostedVespaOrchestration {
+ public static OrchestrationParams create(ConfigserverConfig configserverConfig) {
+ // todo: get the number of proxy nodes
+ return create(configserverConfig.zookeeperserver().size(), 0);
+ }
+
+ public static OrchestrationParams create(int numConfigServers, int numProxies) {
+ // We'll create parameters for both the controller and config server applications, even though
+ // only one of them is present, as (a) no harm is done by having the extra parameters, and
+ // (b) it leads to simpler code below.
+
+ return new OrchestrationParams.Builder()
+
+ // Controller host
+ .addApplicationParams(ApplicationId.fromSerializedForm("hosted-vespa:controller-host:default"),
+ new ApplicationParams
+ .Builder()
+ .add(ClusterId.CONTROLLER,
+ ServiceType.HOST_ADMIN,
+ new ClusterParams
+ .Builder()
+ .setSize(numConfigServers)
+ .build())
+ .build())
+
+ // Controller
+ .addApplicationParams(ApplicationId.fromSerializedForm("hosted-vespa:controller:default"),
+ new ApplicationParams
+ .Builder()
+ .add(ClusterId.CONTROLLER,
+ ServiceType.CONTROLLER,
+ new ClusterParams
+ .Builder()
+ .setSize(numConfigServers)
+ .build())
+ .build())
+
+ // Config server host
+ .addApplicationParams(ApplicationId.fromSerializedForm("hosted-vespa:configserver-host:default"),
+ new ApplicationParams
+ .Builder()
+ .add(ClusterId.CONFIG_SERVER_HOST,
+ ServiceType.HOST_ADMIN,
+ new ClusterParams
+ .Builder()
+ .setSize(numConfigServers)
+ .build())
+ .build())
+
+ // Config server
+ .addApplicationParams(ApplicationId.fromSerializedForm("hosted-vespa:zone-config-servers:default"),
+ new ApplicationParams
+ .Builder()
+ .add(ClusterId.CONFIG_SERVER,
+ ServiceType.CONFIG_SERVER,
+ new ClusterParams
+ .Builder()
+ .setSize(numConfigServers)
+ .build())
+ .build())
+
+ // Proxy host
+ .addApplicationParams(ApplicationId.fromSerializedForm("hosted-vespa:proxy-host:default"),
+ new ApplicationParams
+ .Builder()
+ .add(ClusterId.PROXY_HOST,
+ ServiceType.HOST_ADMIN,
+ new ClusterParams
+ .Builder()
+ .setSize(numProxies)
+ .build())
+ .build())
+
+ // Proxy
+ .addApplicationParams(ApplicationId.fromSerializedForm("hosted-vespa:routing:default"),
+ new ApplicationParams
+ .Builder()
+ .add(ClusterId.ROUTING,
+ ServiceType.CONTAINER,
+ new ClusterParams
+ .Builder()
+ .setSize(numProxies)
+ .build())
+ .build())
+
+ .build();
+ }
+}
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/OrchestrationParams.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/OrchestrationParams.java
new file mode 100644
index 00000000000..7519564b080
--- /dev/null
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/OrchestrationParams.java
@@ -0,0 +1,53 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.orchestrator.policy;
+
+import com.yahoo.config.provision.ApplicationId;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Parameters controlling orchestration.
+ *
+ * @author hakonhall
+ */
+public class OrchestrationParams {
+ private final Map<ApplicationId, ApplicationParams> applicationParams;
+
+ public static class Builder {
+ private final Map<ApplicationId, ApplicationParams> applicationParams = new HashMap<>();
+
+ public Builder() {}
+
+ public Builder addApplicationParams(ApplicationId applicationId, ApplicationParams params) {
+ this.applicationParams.put(applicationId, params);
+ return this;
+ }
+
+ public OrchestrationParams build() {
+ return new OrchestrationParams(applicationParams);
+ }
+ }
+
+ private OrchestrationParams(Map<ApplicationId, ApplicationParams> applicationParams) {
+ this.applicationParams = Map.copyOf(applicationParams);
+ }
+
+ public ApplicationParams getApplicationParams(ApplicationId applicationId) {
+ return applicationParams.getOrDefault(applicationId, ApplicationParams.getDefault());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ OrchestrationParams that = (OrchestrationParams) o;
+ return applicationParams.equals(that.applicationParams);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(applicationParams);
+ }
+}
diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ClusterApiImplTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ClusterApiImplTest.java
index 6bf46052933..237d418aae5 100644
--- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ClusterApiImplTest.java
+++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ClusterApiImplTest.java
@@ -13,6 +13,7 @@ import com.yahoo.vespa.applicationmodel.ServiceType;
import com.yahoo.vespa.flags.Flags;
import com.yahoo.vespa.flags.InMemoryFlagSource;
import com.yahoo.vespa.orchestrator.OrchestratorUtil;
+import com.yahoo.vespa.orchestrator.policy.ClusterParams;
import com.yahoo.vespa.orchestrator.policy.HostStateChangeDeniedException;
import com.yahoo.vespa.orchestrator.policy.HostedVespaClusterPolicy;
import com.yahoo.vespa.orchestrator.policy.SuspensionReasons;
@@ -88,7 +89,9 @@ public class ClusterApiImplTest {
serviceCluster,
new NodeGroup(modelUtils.createApplicationInstance(new ArrayList<>()), hostName5),
modelUtils.getHostInfos(),
- modelUtils.getClusterControllerClientFactory(), ModelTestUtils.NUMBER_OF_CONFIG_SERVERS, clock);
+ modelUtils.getClusterControllerClientFactory(),
+ ModelTestUtils.APPLICATION_PARAMS.clusterParamsFor(serviceCluster),
+ clock);
assertEquals("{ clusterId=cluster, serviceType=service-type }", clusterApi.clusterInfo());
assertFalse(clusterApi.isStorageCluster());
@@ -274,7 +277,9 @@ public class ClusterApiImplTest {
serviceCluster,
new NodeGroup(modelUtils.createApplicationInstance(new ArrayList<>()), groupNodes),
modelUtils.getHostInfos(),
- modelUtils.getClusterControllerClientFactory(), ModelTestUtils.NUMBER_OF_CONFIG_SERVERS, clock);
+ modelUtils.getClusterControllerClientFactory(),
+ ModelTestUtils.APPLICATION_PARAMS.clusterParamsFor(serviceCluster),
+ clock);
assertEquals(expectedNoServicesInGroupIsUp.map(SuspensionReasons::getMessagesInOrder),
clusterApi.reasonsForNoServicesInGroupIsUp().map(SuspensionReasons::getMessagesInOrder));
@@ -305,7 +310,9 @@ public class ClusterApiImplTest {
serviceCluster,
new NodeGroup(applicationInstance, hostName1, hostName3),
new HostInfos(),
- modelUtils.getClusterControllerClientFactory(), ModelTestUtils.NUMBER_OF_CONFIG_SERVERS, clock);
+ modelUtils.getClusterControllerClientFactory(),
+ ModelTestUtils.APPLICATION_PARAMS.clusterParamsFor(serviceCluster),
+ clock);
assertTrue(clusterApi.isStorageCluster());
assertEquals(Optional.of(hostName1), clusterApi.storageNodeInGroup().map(storageNode -> storageNode.hostName()));
@@ -353,7 +360,9 @@ public class ClusterApiImplTest {
serviceCluster,
new NodeGroup(application, hostnames.get(0)),
modelUtils.getHostInfos(),
- modelUtils.getClusterControllerClientFactory(), clusterSize, clock);
+ modelUtils.getClusterControllerClientFactory(),
+ new ClusterParams.Builder().setSize(clusterSize).build(),
+ clock);
assertEquals(clusterSize - serviceStatusList.size(), clusterApi.missingServices());
assertEquals(clusterSize == serviceStatusList.size(), clusterApi.noServicesOutsideGroupIsDown());
diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ModelTestUtils.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ModelTestUtils.java
index 7cb20350845..6ec03ba3c44 100644
--- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ModelTestUtils.java
+++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ModelTestUtils.java
@@ -24,10 +24,14 @@ import com.yahoo.vespa.orchestrator.OrchestrationException;
import com.yahoo.vespa.orchestrator.Orchestrator;
import com.yahoo.vespa.orchestrator.OrchestratorContext;
import com.yahoo.vespa.orchestrator.OrchestratorImpl;
+import com.yahoo.vespa.orchestrator.OrchestratorUtil;
import com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactory;
import com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactoryMock;
+import com.yahoo.vespa.orchestrator.policy.ApplicationParams;
import com.yahoo.vespa.orchestrator.policy.HostedVespaClusterPolicy;
+import com.yahoo.vespa.orchestrator.policy.HostedVespaOrchestration;
import com.yahoo.vespa.orchestrator.policy.HostedVespaPolicy;
+import com.yahoo.vespa.orchestrator.policy.OrchestrationParams;
import com.yahoo.vespa.orchestrator.status.ApplicationLock;
import com.yahoo.vespa.orchestrator.status.HostInfo;
import com.yahoo.vespa.orchestrator.status.HostInfos;
@@ -54,7 +58,16 @@ import static org.mockito.Mockito.mock;
*/
class ModelTestUtils {
+ private static final TenantId TENANT_ID = new TenantId("tenant");
+ private static final ApplicationInstanceId APPLICATION_INSTANCE_ID =
+ new ApplicationInstanceId("application-name:foo:bar:default");
+
public static final int NUMBER_OF_CONFIG_SERVERS = 3;
+ public static final OrchestrationParams ORCHESTRATION_PARAMS =
+ HostedVespaOrchestration.create(NUMBER_OF_CONFIG_SERVERS, 0);
+ public static final ApplicationParams APPLICATION_PARAMS = ORCHESTRATION_PARAMS
+ .getApplicationParams(OrchestratorUtil.toApplicationId(
+ new ApplicationInstanceReference(TENANT_ID, APPLICATION_INSTANCE_ID)));
private final InMemoryFlagSource flagSource = new InMemoryFlagSource();
private final Map<ApplicationInstanceReference, ApplicationInstance> applications = new HashMap<>();
@@ -134,8 +147,8 @@ class ModelTestUtils {
Set<ServiceCluster> serviceClusterSet = new HashSet<>(serviceClusters);
ApplicationInstance application = new ApplicationInstance(
- new TenantId("tenant"),
- new ApplicationInstanceId("application-name:foo:bar:default"),
+ TENANT_ID,
+ APPLICATION_INSTANCE_ID,
serviceClusterSet);
applications.put(application.reference(), application);
diff --git a/service-monitor/src/main/java/com/yahoo/vespa/service/duper/InfraApplication.java b/service-monitor/src/main/java/com/yahoo/vespa/service/duper/InfraApplication.java
index 1bdf1ff67d9..c53d47ee6a3 100644
--- a/service-monitor/src/main/java/com/yahoo/vespa/service/duper/InfraApplication.java
+++ b/service-monitor/src/main/java/com/yahoo/vespa/service/duper/InfraApplication.java
@@ -35,7 +35,7 @@ import java.util.stream.Collectors;
*/
public abstract class InfraApplication implements InfraApplicationApi {
- private static final TenantName TENANT_NAME = TenantName.from("hosted-vespa");
+ static final TenantName TENANT_NAME = TenantName.from("hosted-vespa");
private final ApplicationId applicationId;
private final Capacity capacity;