diff options
6 files changed, 53 insertions, 21 deletions
diff --git a/configdefinitions/src/vespa/orchestrator.def b/configdefinitions/src/vespa/orchestrator.def index ab52c777398..9d524065a55 100644 --- a/configdefinitions/src/vespa/orchestrator.def +++ b/configdefinitions/src/vespa/orchestrator.def @@ -3,3 +3,13 @@ namespace=vespa.orchestrator.config # TODO: Change the default to actual latency in real setup. serviceMonitorConvergenceLatencySeconds int default=0 + +numProxies int default=0 + +# Application ID of the form TENANT:NAME:INSTANCE. +application[].applicationId string +application[].cluster[].clusterId string +application[].cluster[].serviceType string +# The expected number of services in the cluster: If the number of services is less than this count, the missing +# services must be assumed to be down. +application[].cluster[].clusterSize int diff --git a/configserver/src/main/resources/configserver-app/services.xml b/configserver/src/main/resources/configserver-app/services.xml index 13a660221fd..a1ff737f2f9 100644 --- a/configserver/src/main/resources/configserver-app/services.xml +++ b/configserver/src/main/resources/configserver-app/services.xml @@ -59,7 +59,9 @@ <component id="com.yahoo.vespa.service.duper.DuperModelManager" bundle="service-monitor" /> <component id="com.yahoo.vespa.orchestrator.status.ZkStatusService" bundle="orchestrator" /> <component id="com.yahoo.vespa.orchestrator.controller.RetryingClusterControllerClientFactory" bundle="orchestrator" /> - <component id="com.yahoo.vespa.orchestrator.OrchestratorImpl" bundle="orchestrator" /> + <component id="com.yahoo.vespa.orchestrator.OrchestratorImpl" bundle="orchestrator"> + <preprocess:include file="orchestrator-config.xml" required="false" /> + </component> <handler id="com.yahoo.vespa.orchestrator.resources.ApplicationSuspensionRequestHandler" bundle="orchestrator"> <binding>http://*/orchestrator/v1/suspensions/applications</binding> @@ -155,5 +157,6 @@ <preprocess:include file='configserver-components.xml' required='false' /> <preprocess:include file='zookeeper-server-config.xml' required='false' /> + </container> </services> diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/OrchestratorImpl.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/OrchestratorImpl.java index 6d50002669d..f54f6606000 100644 --- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/OrchestratorImpl.java +++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/OrchestratorImpl.java @@ -70,24 +70,45 @@ public class OrchestratorImpl implements Orchestrator { private final ApplicationApiFactory applicationApiFactory; @Inject - public OrchestratorImpl(ClusterControllerClientFactory clusterControllerClientFactory, + public OrchestratorImpl(OrchestratorConfig orchestratorConfig, + ConfigserverConfig configServerConfig, + ClusterControllerClientFactory clusterControllerClientFactory, StatusService statusService, - OrchestratorConfig orchestratorConfig, ServiceMonitor serviceMonitor, - ConfigserverConfig configServerConfig, FlagSource flagSource, Zone zone) { + this(clusterControllerClientFactory, + statusService, + serviceMonitor, + flagSource, + zone, + Clock.systemUTC(), + new ApplicationApiFactory(configServerConfig.zookeeperserver().size(), + orchestratorConfig.numProxies(), + Clock.systemUTC()), + orchestratorConfig.serviceMonitorConvergenceLatencySeconds()); + } + + private OrchestratorImpl(ClusterControllerClientFactory clusterControllerClientFactory, + StatusService statusService, + ServiceMonitor serviceMonitor, + FlagSource flagSource, + Zone zone, + Clock clock, + ApplicationApiFactory applicationApiFactory, + int serviceMonitorConvergenceLatencySeconds) + { this(new HostedVespaPolicy(new HostedVespaClusterPolicy(flagSource, zone), clusterControllerClientFactory, - new ApplicationApiFactory(configServerConfig.zookeeperserver().size(), Clock.systemUTC())), - clusterControllerClientFactory, - statusService, - serviceMonitor, - orchestratorConfig.serviceMonitorConvergenceLatencySeconds(), - Clock.systemUTC(), - new ApplicationApiFactory(configServerConfig.zookeeperserver().size(), Clock.systemUTC()), - flagSource); + applicationApiFactory), + clusterControllerClientFactory, + statusService, + serviceMonitor, + serviceMonitorConvergenceLatencySeconds, + clock, + applicationApiFactory, + flagSource); } public OrchestratorImpl(Policy policy, 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 a3f2fd6e235..82791d3b305 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 @@ -18,11 +18,17 @@ public class ApplicationApiFactory { private final OrchestrationParams orchestrationParams; private final Clock clock; + // TODO: REMOVE public ApplicationApiFactory(int numberOfConfigServers, Clock clock) { this.orchestrationParams = HostedVespaOrchestration.create(numberOfConfigServers, 0); this.clock = clock; } + public ApplicationApiFactory(int numberOfConfigServers, int numProxies, Clock clock) { + this.orchestrationParams = HostedVespaOrchestration.create(numberOfConfigServers, numProxies); + this.clock = clock; + } + public ApplicationApi create(NodeGroup nodeGroup, ApplicationLock lock, ClusterControllerClientFactory clusterControllerClientFactory) { 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 index e9a27cddaeb..e2c0c337dae 100644 --- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/HostedVespaOrchestration.java +++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/HostedVespaOrchestration.java @@ -1,7 +1,6 @@ // 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; @@ -12,11 +11,6 @@ import com.yahoo.vespa.applicationmodel.ServiceType; * @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 diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionRequestHandlerTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionRequestHandlerTest.java index 76d00943e07..20dfd03a86f 100644 --- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionRequestHandlerTest.java +++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionRequestHandlerTest.java @@ -44,11 +44,9 @@ class ApplicationSuspensionRequestHandlerTest { void createHandler() { DummyServiceMonitor serviceMonitor = new DummyServiceMonitor(); Orchestrator orchestrator = new OrchestratorImpl( - new ClusterControllerClientFactoryMock(), + new OrchestratorConfig(new OrchestratorConfig.Builder()), new ConfigserverConfig(new ConfigserverConfig.Builder()), new ClusterControllerClientFactoryMock(), new ZkStatusService(new MockCurator(), new MockMetric(), new SystemTimer(), serviceMonitor), - new OrchestratorConfig(new OrchestratorConfig.Builder()), serviceMonitor, - new ConfigserverConfig(new ConfigserverConfig.Builder()), new InMemoryFlagSource(), Zone.defaultZone()); var handler = new ApplicationSuspensionRequestHandler(RestApiTestDriver.createHandlerTestContext(), orchestrator); |