summaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorOla Aunrønning <olaa@verizonmedia.com>2020-07-22 12:09:33 +0200
committerOla Aunrønning <olaa@verizonmedia.com>2020-07-22 12:12:23 +0200
commit0ae44fb99185aab6ad1d3fd50daef750dc2afaa1 (patch)
treea8bfb9ae3925502cc2d311f3bab5cf361ffc97df /controller-api
parent58d31227d188ee6a11b545851d6b152766cbc7cf (diff)
Allow restart filtering on cluster id and type
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java3
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/RestartFilter.java51
2 files changed, 53 insertions, 1 deletions
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 16464f7cea6..c04adcec594 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
@@ -12,6 +12,7 @@ import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.identifiers.Hostname;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud;
+import com.yahoo.vespa.hosted.controller.api.integration.noderepository.RestartFilter;
import com.yahoo.vespa.serviceview.bindings.ApplicationView;
import java.io.InputStream;
@@ -32,7 +33,7 @@ public interface ConfigServer {
PreparedApplication deploy(DeploymentData deployment);
- void restart(DeploymentId deployment, Optional<Hostname> hostname);
+ void restart(DeploymentId deployment, RestartFilter restartFilter);
void deactivate(DeploymentId deployment) throws NotFoundException;
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/RestartFilter.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/RestartFilter.java
new file mode 100644
index 00000000000..685ed392c00
--- /dev/null
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/RestartFilter.java
@@ -0,0 +1,51 @@
+// 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;
+
+import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.config.provision.HostName;
+import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
+import com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServer;
+
+import java.util.Optional;
+
+/**
+ * Attributes to filter when restarting nodes in a deployment.
+ * If all attributes are empty, all nodes are restarted.
+ * Used in {@link ConfigServer#restart(DeploymentId, RestartFilter)}
+ *
+ * @author olaa
+ */
+public class RestartFilter {
+
+ private Optional<HostName> hostName = Optional.empty();
+ private Optional<ClusterSpec.Type> clusterType = Optional.empty();
+ private Optional<ClusterSpec.Id> clusterId = Optional.empty();
+
+ public Optional<HostName> getHostName() {
+ return hostName;
+ }
+
+ public Optional<ClusterSpec.Type> getClusterType() {
+ return clusterType;
+ }
+
+ public Optional<ClusterSpec.Id> getClusterId() {
+ return clusterId;
+ }
+
+ public RestartFilter withHostName(Optional<HostName> hostName) {
+ this.hostName = hostName;
+ return this;
+ }
+
+ public RestartFilter withClusterType(Optional<ClusterSpec.Type> clusterType) {
+ this.clusterType = clusterType;
+ return this;
+ }
+
+ public RestartFilter withClusterId(Optional<ClusterSpec.Id> clusterId) {
+ this.clusterId = clusterId;
+ return this;
+ }
+
+}