summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/pom.xml7
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/EnvironmentResource.java3
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/ServiceViewResource.java32
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java5
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java18
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobId.java2
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java182
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/NodeRepositoryNode.java11
-rw-r--r--controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java45
9 files changed, 133 insertions, 172 deletions
diff --git a/controller-api/pom.xml b/controller-api/pom.xml
index 5b81b793534..dc2ec981e66 100644
--- a/controller-api/pom.xml
+++ b/controller-api/pom.xml
@@ -34,13 +34,6 @@
<dependency>
<groupId>com.yahoo.vespa</groupId>
- <artifactId>serviceview</artifactId>
- <scope>provided</scope>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
<artifactId>config-provisioning</artifactId>
<scope>provided</scope>
<version>${project.version}</version>
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/EnvironmentResource.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/EnvironmentResource.java
index 389cda605af..7953fbc4055 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/EnvironmentResource.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/EnvironmentResource.java
@@ -70,9 +70,6 @@ public interface EnvironmentResource {
@PathParam("instanceId") InstanceId instanceId,
@QueryParam("timeout") long timeoutInSeconds);
- @Path("{environmentId}/region/{regionId}/instance/{instanceId}/service")
- ServiceViewResource service();
-
@PUT
@Path("{environmentId}/region/{regionId}/instance/{instanceId}/global-rotation/override")
String setRotationOut(@PathParam("tenantId") TenantId tenantId,
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/ServiceViewResource.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/ServiceViewResource.java
deleted file mode 100644
index 1d2860f5dd3..00000000000
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/ServiceViewResource.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.hosted.controller.api.application.v4;
-
-import com.yahoo.vespa.serviceview.bindings.ApplicationView;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import java.util.HashMap;
-
-/**
- * @author Stian Kristoffersen
- */
-@Path("")
-@Produces(MediaType.APPLICATION_JSON)
-public interface ServiceViewResource {
-
- @GET
- @Path("")
- @Produces(MediaType.APPLICATION_JSON)
- ApplicationView getUserInfo();
-
- @GET
- @Path("{serviceIdentifier}/{apiParams: .*}")
- @Produces(MediaType.APPLICATION_JSON)
- @SuppressWarnings("rawtypes")
- HashMap singleService(@PathParam("serviceIdentifier") String identifier,
- @PathParam("apiParams") String apiParams);
-
-}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java
index 0b23f1c2f3f..97128d4c980 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java
@@ -18,7 +18,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.deployment.TestReport;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud;
import com.yahoo.vespa.hosted.controller.api.integration.noderepository.RestartFilter;
import com.yahoo.vespa.hosted.controller.api.integration.secrets.TenantSecretStore;
-import com.yahoo.vespa.serviceview.bindings.ApplicationView;
import java.io.InputStream;
import java.net.URI;
@@ -53,10 +52,6 @@ public interface ConfigServer {
boolean isSuspended(DeploymentId deployment);
- ApplicationView getApplicationView(String tenantName, String applicationName, String instanceName, String environment, String region);
-
- Map<?,?> getServiceApiResponse(DeploymentId deployment, String serviceName, Path restPath);
-
/** Returns a proxied response from a given path running on a given service and node */
ProxyResponse getServiceNodePage(DeploymentId deployment, String serviceName, DomainName node, Path subPath, Query query);
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 c5d3fd1374f..bb97349e5dd 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
@@ -61,6 +61,7 @@ public class Node {
private final boolean wantToRetire;
private final boolean wantToDeprovision;
private final boolean wantToRebuild;
+ private final boolean down;
private final Optional<TenantName> reservedTo;
private final Optional<ApplicationId> exclusiveTo;
private final Map<String, String> reports;
@@ -79,7 +80,7 @@ public class Node {
long restartGeneration, long wantedRestartGeneration, long rebootGeneration,
long wantedRebootGeneration, int cost, int failCount, Optional<String> flavor, String clusterId,
ClusterType clusterType, String group, boolean retired, boolean wantToRetire, boolean wantToDeprovision,
- boolean wantToRebuild, Optional<TenantName> reservedTo, Optional<ApplicationId> exclusiveTo,
+ boolean wantToRebuild, boolean down, Optional<TenantName> reservedTo, Optional<ApplicationId> exclusiveTo,
DockerImage wantedDockerImage, DockerImage currentDockerImage, Map<String, String> reports,
List<Event> history, Set<String> ipAddresses, Set<String> additionalIpAddresses,
Set<String> additionalHostnames, Optional<String> switchHostname,
@@ -117,6 +118,7 @@ public class Node {
this.wantedDockerImage = Objects.requireNonNull(wantedDockerImage, "wantedDockerImage must be non-null");
this.currentDockerImage = Objects.requireNonNull(currentDockerImage, "currentDockerImage must be non-null");
this.wantToRebuild = wantToRebuild;
+ this.down = down;
this.reports = Map.copyOf(Objects.requireNonNull(reports, "reports must be non-null"));
this.history = List.copyOf(Objects.requireNonNull(history, "history must be non-null"));
this.ipAddresses = Set.copyOf(Objects.requireNonNull(ipAddresses, "ipAddresses must be non-null"));
@@ -280,6 +282,11 @@ public class Node {
return wantToRebuild;
}
+ /** Whether this node is currently down */
+ public boolean down() {
+ return down;
+ }
+
/** The tenant this has been reserved to, if any */
public Optional<TenantName> reservedTo() { return reservedTo; }
@@ -467,6 +474,7 @@ public class Node {
private boolean wantToRetire = false;
private boolean wantToDeprovision = false;
private boolean wantToRebuild = false;
+ private boolean down = false;
private Optional<TenantName> reservedTo = Optional.empty();
private Optional<ApplicationId> exclusiveTo = Optional.empty();
private Map<String, String> reports = Map.of();
@@ -512,6 +520,7 @@ public class Node {
this.wantToRetire = node.wantToRetire;
this.wantToDeprovision = node.wantToDeprovision;
this.wantToRebuild = node.wantToRebuild;
+ this.down = node.down;
this.reservedTo = node.reservedTo;
this.exclusiveTo = node.exclusiveTo;
this.reports = node.reports;
@@ -687,6 +696,11 @@ public class Node {
return this;
}
+ public Builder down(boolean down) {
+ this.down = down;
+ return this;
+ }
+
public Builder reservedTo(TenantName tenant) {
this.reservedTo = Optional.of(tenant);
return this;
@@ -742,7 +756,7 @@ public class Node {
currentOsVersion, wantedOsVersion, currentFirmwareCheck, wantedFirmwareCheck, serviceState,
suspendedSince, restartGeneration, wantedRestartGeneration, rebootGeneration,
wantedRebootGeneration, cost, failCount, flavor, clusterId, clusterType, group, retired,
- wantToRetire, wantToDeprovision, wantToRebuild, reservedTo, exclusiveTo, wantedDockerImage,
+ wantToRetire, wantToDeprovision, wantToRebuild, down, reservedTo, exclusiveTo, wantedDockerImage,
currentDockerImage, reports, history, ipAddresses, additionalIpAddresses,
additionalHostnames, switchHostname, modelName, environment);
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobId.java
index 846f3784657..0ef9807270e 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobId.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobId.java
@@ -29,7 +29,7 @@ public class JobId {
if (o == null || getClass() != o.getClass()) return false;
JobId jobId = (JobId) o;
return application.equals(jobId.application) &&
- type == jobId.type;
+ type.equals(jobId.type);
}
@Override
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java
index e9231f80091..4505fe3ceb5 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobType.java
@@ -41,140 +41,91 @@ public final class JobType implements Comparable<JobType> {
PublicCd, ZoneId.from("staging", "aws-us-east-1c"),
Public , ZoneId.from("staging", "aws-us-east-1c")));
- public static final JobType productionUsEast3 = of("production-us-east-3",
- Map.of(main, ZoneId.from("prod" , "us-east-3")));
+ public static final JobType productionUsEast3 = prod("us-east-3");
- public static final JobType testUsEast3 = of("test-us-east-3",
- Map.of(main, ZoneId.from("prod" , "us-east-3")), true);
+ public static final JobType testUsEast3 = test("us-east-3");
- public static final JobType productionUsWest1 = of("production-us-west-1",
- Map.of(main, ZoneId.from("prod" , "us-west-1")));
+ public static final JobType productionUsWest1 = prod("us-west-1");
- public static final JobType testUsWest1 = of("test-us-west-1",
- Map.of(main, ZoneId.from("prod" , "us-west-1")), true);
+ public static final JobType testUsWest1 = test("us-west-1");
- public static final JobType productionUsCentral1 = of("production-us-central-1",
- Map.of(main, ZoneId.from("prod" , "us-central-1")));
+ public static final JobType productionUsCentral1 = prod("us-central-1");
- public static final JobType testUsCentral1 = of("test-us-central-1",
- Map.of(main, ZoneId.from("prod" , "us-central-1")), true);
+ public static final JobType testUsCentral1 = test("us-central-1");
- public static final JobType productionApNortheast1 = of("production-ap-northeast-1",
- Map.of(main, ZoneId.from("prod" , "ap-northeast-1")));
+ public static final JobType productionApNortheast1 = prod("ap-northeast-1");
- public static final JobType testApNortheast1 = of("test-ap-northeast-1",
- Map.of(main, ZoneId.from("prod" , "ap-northeast-1")), true);
+ public static final JobType testApNortheast1 = test("ap-northeast-1");
- public static final JobType productionApNortheast2 = of("production-ap-northeast-2",
- Map.of(main, ZoneId.from("prod" , "ap-northeast-2")));
+ public static final JobType productionApNortheast2 = prod("ap-northeast-2");
- public static final JobType testApNortheast2 = of("test-ap-northeast-2",
- Map.of(main, ZoneId.from("prod" , "ap-northeast-2")), true);
+ public static final JobType testApNortheast2 = test("ap-northeast-2");
- public static final JobType productionApSoutheast1 = of("production-ap-southeast-1",
- Map.of(main, ZoneId.from("prod" , "ap-southeast-1")));
+ public static final JobType productionApSoutheast1 = prod("ap-southeast-1");
- public static final JobType testApSoutheast1 = of("test-ap-southeast-1",
- Map.of(main, ZoneId.from("prod" , "ap-southeast-1")), true);
+ public static final JobType testApSoutheast1 = test("ap-southeast-1");
- public static final JobType productionEuWest1 = of("production-eu-west-1",
- Map.of(main, ZoneId.from("prod" , "eu-west-1")));
+ public static final JobType productionEuWest1 = prod("eu-west-1");
- public static final JobType testEuWest1 = of("test-eu-west-1",
- Map.of(main, ZoneId.from("prod" , "eu-west-1")), true);
+ public static final JobType testEuWest1 = test("eu-west-1");
- public static final JobType productionAwsUsEast1a= of("production-aws-us-east-1a",
- Map.of(main, ZoneId.from("prod" , "aws-us-east-1a")));
+ public static final JobType productionAwsUsEast1a= prod("aws-us-east-1a");
- public static final JobType testAwsUsEast1a = of("test-aws-us-east-1a",
- Map.of(main, ZoneId.from("prod" , "aws-us-east-1a")), true);
+ public static final JobType testAwsUsEast1a = test("aws-us-east-1a");
- public static final JobType productionAwsUsEast1c= of("production-aws-us-east-1c",
- Map.of(PublicCd, ZoneId.from("prod", "aws-us-east-1c"),
- Public, ZoneId.from("prod", "aws-us-east-1c")));
+ public static final JobType productionAwsUsEast1c= prod("aws-us-east-1c");
- public static final JobType testAwsUsEast1c = of("test-aws-us-east-1c",
- Map.of(PublicCd, ZoneId.from("prod", "aws-us-east-1c"),
- Public, ZoneId.from("prod", "aws-us-east-1c")), true);
+ public static final JobType testAwsUsEast1c = test("aws-us-east-1c");
- public static final JobType productionAwsApNortheast1a= of("production-aws-ap-northeast-1a",
- Map.of(Public, ZoneId.from("prod", "aws-ap-northeast-1a")));
+ public static final JobType productionAwsApNortheast1a= prod("aws-ap-northeast-1a");
- public static final JobType testAwsApNortheast1a = of("test-aws-ap-northeast-1a",
- Map.of(Public, ZoneId.from("prod", "aws-ap-northeast-1a")), true);
+ public static final JobType testAwsApNortheast1a = test("aws-ap-northeast-1a");
- public static final JobType productionAwsEuWest1a= of("production-aws-eu-west-1a",
- Map.of(Public, ZoneId.from("prod", "aws-eu-west-1a")));
+ public static final JobType productionAwsEuWest1a= prod("aws-eu-west-1a");
- public static final JobType testAwsEuWest1a = of("test-aws-eu-west-1a",
- Map.of(Public, ZoneId.from("prod", "aws-eu-west-1a")), true);
+ public static final JobType testAwsEuWest1a = test("aws-eu-west-1a");
- public static final JobType productionAwsUsWest2a= of("production-aws-us-west-2a",
- Map.of(main, ZoneId.from("prod", "aws-us-west-2a"),
- Public, ZoneId.from("prod", "aws-us-west-2a")));
+ public static final JobType productionAwsUsWest2a= prod("aws-us-west-2a");
- public static final JobType testAwsUsWest2a = of("test-aws-us-west-2a",
- Map.of(main, ZoneId.from("prod", "aws-us-west-2a"),
- Public, ZoneId.from("prod", "aws-us-west-2a")), true);
+ public static final JobType testAwsUsWest2a = test("aws-us-west-2a");
- public static final JobType productionAwsUsEast1b= of("production-aws-us-east-1b",
- Map.of(main, ZoneId.from("prod" , "aws-us-east-1b")));
+ public static final JobType productionAwsUsEast1b= prod("aws-us-east-1b");
- public static final JobType testAwsUsEast1b = of("test-aws-us-east-1b",
- Map.of(main, ZoneId.from("prod" , "aws-us-east-1b")), true);
+ public static final JobType testAwsUsEast1b = test("aws-us-east-1b");
- public static final JobType devUsEast1 = of("dev-us-east-1",
- Map.of(main, ZoneId.from("dev" , "us-east-1")));
+ public static final JobType devUsEast1 = dev("us-east-1");
- public static final JobType devAwsUsEast2a = of("dev-aws-us-east-2a",
- Map.of(main, ZoneId.from("dev" , "aws-us-east-2a")));
+ public static final JobType devAwsUsEast2a = dev("aws-us-east-2a");
- public static final JobType productionCdAwsUsEast1a = of("production-cd-aws-us-east-1a",
- Map.of(cd , ZoneId.from("prod" , "cd-aws-us-east-1a")));
+ public static final JobType productionCdAwsUsEast1a = prod("cd-aws-us-east-1a");
- public static final JobType testCdAwsUsEast1a = of("test-cd-aws-us-east-1a",
- Map.of(cd , ZoneId.from("prod" , "cd-aws-us-east-1a")), true);
+ public static final JobType testCdAwsUsEast1a = test("cd-aws-us-east-1a");
- public static final JobType productionCdUsCentral1 = of("production-cd-us-central-1",
- Map.of(cd , ZoneId.from("prod" , "cd-us-central-1")));
+ public static final JobType productionCdUsCentral1 = prod("cd-us-central-1");
- public static final JobType testCdUsCentral1 = of("test-cd-us-central-1",
- Map.of(cd , ZoneId.from("prod" , "cd-us-central-1")), true);
+ public static final JobType testCdUsCentral1 = test("cd-us-central-1");
- // TODO: Cannot remove production-cd-us-central-2 until we know there are no serialized data in controller referencing it
- public static final JobType productionCdUsCentral2 = of("production-cd-us-central-2",
- Map.of(cd , ZoneId.from("prod" , "cd-us-central-2")));
+ public static final JobType productionCdUsCentral2 = prod("cd-us-central-2");
- public static final JobType testCdUsCentral2 = of("test-cd-us-central-2",
- Map.of(cd , ZoneId.from("prod" , "cd-us-central-2")), true);
+ public static final JobType testCdUsCentral2 = test("cd-us-central-2");
- public static final JobType productionCdUsEast1= of("production-cd-us-east-1",
- Map.of(cd , ZoneId.from("prod" , "cd-us-east-1")));
+ public static final JobType productionCdUsEast1= prod("cd-us-east-1");
- public static final JobType testCdUsEast1 = of("test-cd-us-east-1",
- Map.of(cd , ZoneId.from("prod" , "cd-us-east-1")), true);
+ public static final JobType testCdUsEast1 = test("cd-us-east-1");
- public static final JobType productionCdUsWest1= of("production-cd-us-west-1",
- Map.of(cd , ZoneId.from("prod" , "cd-us-west-1")));
+ public static final JobType productionCdUsWest1= prod("cd-us-west-1");
- public static final JobType testCdUsWest1 = of("test-cd-us-west-1",
- Map.of(cd , ZoneId.from("prod" , "cd-us-west-1")), true);
+ public static final JobType testCdUsWest1 = test("cd-us-west-1");
- public static final JobType devCdUsCentral1 = of("dev-cd-us-central-1",
- Map.of(cd , ZoneId.from("dev" , "cd-us-central-1")));
+ public static final JobType devCdUsCentral1 = dev("cd-us-central-1");
- public static final JobType devCdUsWest1 = of("dev-cd-us-west-1",
- Map.of(cd , ZoneId.from("dev" , "cd-us-west-1")));
+ public static final JobType devCdUsWest1 = dev("cd-us-west-1");
- public static final JobType devAwsUsEast1c = of("dev-aws-us-east-1c",
- Map.of(Public, ZoneId.from("dev", "aws-us-east-1c"),
- PublicCd, ZoneId.from("dev", "aws-us-east-1c")));
+ public static final JobType devAwsUsEast1c = dev("aws-us-east-1c");
- public static final JobType perfAwsUsEast1c = of("perf-aws-us-east-1c",
- Map.of(Public, ZoneId.from("perf", "aws-us-east-1c")));
+ public static final JobType perfAwsUsEast1c = perf("aws-us-east-1c");
- public static final JobType perfUsEast3 = of("perf-us-east-3",
- Map.of(main, ZoneId.from("perf" , "us-east-3")));
+ public static final JobType perfUsEast3 = perf("us-east-3");
private static final JobType[] values = new JobType[] {
systemTest,
@@ -247,6 +198,11 @@ public final class JobType implements Comparable<JobType> {
public String jobName() { return jobName; }
+ /** Returns the zone for this job in the given system. */
+ public ZoneId zone() {
+ throw new UnsupportedOperationException();
+ }
+
/** Returns the zone for this job in the given system, or throws if this job does not have a zone */
public ZoneId zone(SystemName system) {
if ( ! zones.containsKey(system))
@@ -255,10 +211,12 @@ public final class JobType implements Comparable<JobType> {
return zones.get(system);
}
+ /** A system test in a test zone, or throws if no test zones are present.. */
public static JobType systemTest(ZoneRegistry zones) {
return testIn(test, zones);
}
+ /** A staging test in a staging zone, or throws if no staging zones are present. */
public static JobType stagingTest(ZoneRegistry zones){
return testIn(staging, zones);
}
@@ -268,18 +226,22 @@ public final class JobType implements Comparable<JobType> {
.findFirst().orElseThrow(() -> new IllegalArgumentException("no zones in " + environment + " among " + zones.zones().controllerUpgraded().zones()));
}
+ /** A deployment to the given dev region. */
public static JobType dev(String region) {
return deploymentTo(ZoneId.from("dev", region));
}
+ /** A deployment to the given perf region. */
public static JobType perf(String region) {
return deploymentTo(ZoneId.from("perf", region));
}
+ /** A deployment to the given prod region. */
public static JobType prod(String region) {
return deploymentTo(ZoneId.from("prod", region));
}
+ /** A production test in the given region. */
public static JobType test(String region) {
return productionTestOf(ZoneId.from("prod", region));
}
@@ -311,20 +273,16 @@ public final class JobType implements Comparable<JobType> {
throw new IllegalArgumentException("illegal serialized job type '" + raw + "'");
}
- // TODO jonmv: use for serialisation
- public String serialized() {
- throw new UnsupportedOperationException();
- // return zone.environment().value() + "." + zone.region().value() + (isProductionTest ? ".test");
+ public String serialized(SystemName system) {
+ ZoneId zone = zone(system);
+ return zone.environment().value() + "." + zone.region().value() + (isProductionTest ? ".test" : "");
}
public static List<JobType> allIn(ZoneRegistry zones) {
- return Stream.of(values).filter(job -> job.zones.containsKey(zones.system())).collect(Collectors.toUnmodifiableList());
- /*
return zones.zones().controllerUpgraded().zones().stream()
- .flatMap(zone -> zone.getEnvironment().isProduction() ? Stream.of(of(zone.getId()), ofTest(zone.getId()))
- : Stream.of(of(zone.getId())))
+ .flatMap(zone -> zone.getEnvironment().isProduction() ? Stream.of(deploymentTo(zone.getId()), productionTestOf(zone.getId()))
+ : Stream.of(deploymentTo(zone.getId())))
.collect(Collectors.toUnmodifiableList());
- */
}
static JobType[] values() {
@@ -367,6 +325,21 @@ public final class JobType implements Comparable<JobType> {
.orElseThrow(() -> new IllegalArgumentException("Unknown job name '" + jobName + "'"));
}
+ // TODO jonmv: require zones
+ public static JobType fromJobName(String jobName, ZoneRegistry zones) {
+ String[] parts = jobName.split("-", 2);
+ if (parts.length != 2) throw new IllegalArgumentException("job names must be 'system-test', 'staging-test', or environment and region parts, separated by '-', but got: " + jobName);
+ switch (parts[0]) {
+ case "system": return systemTest(zones);
+ case "staging": return stagingTest(zones);
+ case "production": return prod(parts[1]);
+ case "test": return test(parts[1]);
+ case "dev": return dev(parts[1]);
+ case "perf": return perf(parts[1]);
+ default: throw new IllegalArgumentException("job names must begin with one of: system, staging, production, test, dev, perf; but got: " + jobName);
+ }
+ }
+
/** Returns the job type for the given zone */
public static Optional<JobType> from(SystemName system, ZoneId zone, boolean isTest) {
return Stream.of(values)
@@ -412,7 +385,12 @@ public final class JobType implements Comparable<JobType> {
@Override
public int hashCode() {
- return Objects.hash(jobName);
+ return jobName.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return jobName;
}
}
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 71f08f7318d..8964e1b5127 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
@@ -85,6 +85,8 @@ public class NodeRepositoryNode {
private Boolean wantToDeprovision;
@JsonProperty("wantToRebuild")
private Boolean wantToRebuild;
+ @JsonProperty("down")
+ private Boolean down;
@JsonProperty("cost")
private Integer cost;
@JsonProperty("history")
@@ -318,6 +320,14 @@ public class NodeRepositoryNode {
this.wantToRebuild = wantToRebuild;
}
+ public Boolean getDown() {
+ return down;
+ }
+
+ public void setDown(Boolean down) {
+ this.down = down;
+ }
+
public Integer getCost() {
return cost;
}
@@ -465,6 +475,7 @@ public class NodeRepositoryNode {
", wantToRetire=" + wantToRetire +
", wantToDeprovision=" + wantToDeprovision +
", wantToRebuild=" + wantToRebuild +
+ ", down=" + down +
", cost=" + cost +
", history=" + history +
", orchestratorStatus='" + orchestratorStatus + '\'' +
diff --git a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java
index 990e8911e91..64f4d6150dd 100644
--- a/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java
+++ b/controller-api/src/test/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/JobTypeTest.java
@@ -30,32 +30,37 @@ public class JobTypeTest {
}
}
- assertEquals(JobType.testUsEast3, JobType.fromJobName("prod.us-east-3.test"));
- assertEquals(JobType.devAwsUsEast1c, JobType.fromJobName("dev.aws-us-east-1c"));
+ assertEquals(JobType.testUsEast3, JobType.ofSerialized("prod.us-east-3.test"));
+ assertEquals(JobType.devAwsUsEast1c, JobType.ofSerialized("dev.aws-us-east-1c"));
- assertFalse(JobType.dev("snøhetta").isTest());
- assertTrue(JobType.dev("snøhetta").isDeployment());
- assertFalse(JobType.dev("snøhetta").isProduction());
+ assertEquals(JobType.fromJobName("production-my-zone", null), JobType.prod("my-zone"));
+ assertEquals(JobType.fromJobName("test-my-zone", null), JobType.test("my-zone"));
+ assertEquals(JobType.fromJobName("dev-my-zone", null), JobType.dev("my-zone"));
+ assertEquals(JobType.fromJobName("perf-my-zone", null), JobType.perf("my-zone"));
- assertFalse(JobType.perf("snøhetta").isTest());
- assertTrue(JobType.perf("snøhetta").isDeployment());
- assertFalse(JobType.perf("snøhetta").isProduction());
+ assertFalse(JobType.dev("snohetta").isTest());
+ assertTrue(JobType.dev("snohetta").isDeployment());
+ assertFalse(JobType.dev("snohetta").isProduction());
- assertTrue(JobType.deploymentTo(ZoneId.from("test", "snøhetta")).isTest());
- assertTrue(JobType.deploymentTo(ZoneId.from("test", "snøhetta")).isDeployment());
- assertFalse(JobType.deploymentTo(ZoneId.from("test", "snøhetta")).isProduction());
+ assertFalse(JobType.perf("snohetta").isTest());
+ assertTrue(JobType.perf("snohetta").isDeployment());
+ assertFalse(JobType.perf("snohetta").isProduction());
- assertTrue(JobType.deploymentTo(ZoneId.from("staging", "snøhetta")).isTest());
- assertTrue(JobType.deploymentTo(ZoneId.from("staging", "snøhetta")).isDeployment());
- assertFalse(JobType.deploymentTo(ZoneId.from("staging", "snøhetta")).isProduction());
+ assertTrue(JobType.deploymentTo(ZoneId.from("test", "snohetta")).isTest());
+ assertTrue(JobType.deploymentTo(ZoneId.from("test", "snohetta")).isDeployment());
+ assertFalse(JobType.deploymentTo(ZoneId.from("test", "snohetta")).isProduction());
- assertFalse(JobType.prod("snøhetta").isTest());
- assertTrue(JobType.prod("snøhetta").isDeployment());
- assertTrue(JobType.prod("snøhetta").isProduction());
+ assertTrue(JobType.deploymentTo(ZoneId.from("staging", "snohetta")).isTest());
+ assertTrue(JobType.deploymentTo(ZoneId.from("staging", "snohetta")).isDeployment());
+ assertFalse(JobType.deploymentTo(ZoneId.from("staging", "snohetta")).isProduction());
- assertTrue(JobType.test("snøhetta").isTest());
- assertFalse(JobType.test("snøhetta").isDeployment());
- assertTrue(JobType.test("snøhetta").isProduction());
+ assertFalse(JobType.prod("snohetta").isTest());
+ assertTrue(JobType.prod("snohetta").isDeployment());
+ assertTrue(JobType.prod("snohetta").isProduction());
+
+ assertTrue(JobType.test("snohetta").isTest());
+ assertFalse(JobType.test("snohetta").isDeployment());
+ assertTrue(JobType.test("snohetta").isProduction());
}
}