summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2018-04-27 09:42:17 +0200
committerMartin Polden <mpolden@mpolden.no>2018-05-02 11:33:38 +0200
commit92caa35f15a1c49f6a94bfd9b419b603a89161f1 (patch)
tree0bb64d5a16ec6fc3e66200bbde13dc39df541d36 /controller-api
parentbbb5bcd8fa10bde6d3275e68c54b0a83c2ab94ad (diff)
Define and upgrade system applications
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeployOptions.java4
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java11
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java67
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java24
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ArtifactRepository.java6
5 files changed, 104 insertions, 8 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeployOptions.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeployOptions.java
index 55215456379..31280076de4 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeployOptions.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeployOptions.java
@@ -40,4 +40,8 @@ public class DeployOptions {
", deployCurrentVersion=" + deployCurrentVersion +
'}';
}
+
+ public static DeployOptions none() {
+ return new DeployOptions(Optional.empty(), Optional.empty(), false, false);
+ }
}
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 86ae71f747c..a2b420c8090 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
@@ -2,7 +2,6 @@
package com.yahoo.vespa.hosted.controller.api.integration.configserver;
import com.fasterxml.jackson.databind.JsonNode;
-import com.yahoo.component.Version;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeployOptions;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.EndpointStatus;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
@@ -10,7 +9,6 @@ import com.yahoo.vespa.hosted.controller.api.identifiers.Hostname;
import com.yahoo.vespa.serviceview.bindings.ApplicationView;
import java.io.IOException;
-import java.net.URI;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -46,12 +44,6 @@ public interface ConfigServer {
Map<?,?> getServiceApiResponse(String tenantName, String applicationName, String instanceName, String environment, String region, String serviceName, String restPath);
- /** Returns the version of this config server */
- ConfigServerVersion version(URI configServerUri);
-
- /** Upgrade config server at URI to the given version */
- void upgrade(URI configServerUri, Version version);
-
/**
* Set new status on en endpoint in one zone.
*
@@ -72,4 +64,7 @@ public interface ConfigServer {
*/
EndpointStatus getGlobalRotationStatus(DeploymentId deployment, String endpoint) throws IOException;
+ /** The node repository on this config server */
+ NodeRepository nodeRepository();
+
}
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
new file mode 100644
index 00000000000..3de43e9040b
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java
@@ -0,0 +1,67 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.configserver;
+
+import com.yahoo.component.Version;
+import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.config.provision.HostName;
+import com.yahoo.config.provision.NodeType;
+
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * A node in hosted Vespa.
+ *
+ * @author mpolden
+ */
+public class Node {
+
+ private final HostName hostname;
+ private final Optional<ApplicationId> owner;
+ private final NodeType type;
+ private final Version currentVersion;
+ private final Version wantedVersion;
+
+ public Node(HostName hostname, NodeType type, Optional<ApplicationId> owner, Version currentVersion,
+ Version wantedVersion) {
+ this.hostname = hostname;
+ this.type = type;
+ this.owner = owner;
+ this.currentVersion = currentVersion;
+ this.wantedVersion = wantedVersion;
+ }
+
+ public HostName hostname() {
+ return hostname;
+ }
+
+ public NodeType type() {
+ return type;
+ }
+
+ public Optional<ApplicationId> owner() {
+ return owner;
+ }
+
+ public Version currentVersion() {
+ return currentVersion;
+ }
+
+ public Version wantedVersion() {
+ return wantedVersion;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Node node = (Node) o;
+ return Objects.equals(hostname, node.hostname);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(hostname);
+ }
+
+}
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
new file mode 100644
index 00000000000..ccf020b9af6
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java
@@ -0,0 +1,24 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.api.integration.configserver;
+
+import com.yahoo.component.Version;
+import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.config.provision.NodeType;
+import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId;
+
+import java.util.List;
+
+/**
+ * A minimal interface to the node repository, providing only the operations used by the controller.
+ *
+ * @author mpolden
+ */
+public interface NodeRepository {
+
+ /** List all nodes in zone owned by given application */
+ List<Node> list(ZoneId zone, ApplicationId application);
+
+ /** Upgrade all nodes of given type to a new version */
+ void upgrade(ZoneId zone, NodeType type, Version version);
+
+}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ArtifactRepository.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ArtifactRepository.java
index 6409298b3a5..b77e085e733 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ArtifactRepository.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/ArtifactRepository.java
@@ -1,7 +1,9 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.deployment;
+import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId;
/**
* A repository of application build artifacts.
@@ -10,6 +12,10 @@ import com.yahoo.config.provision.ApplicationId;
*/
public interface ArtifactRepository {
+ /** Get tenant application package of given version */
byte[] getApplicationPackage(ApplicationId application, String applicationVersion);
+ /** Get system application package of given version */
+ byte[] getSystemApplicationPackage(ApplicationId application, ZoneId zone, Version version);
+
}