From 0ae44fb99185aab6ad1d3fd50daef750dc2afaa1 Mon Sep 17 00:00:00 2001 From: Ola Aunrønning Date: Wed, 22 Jul 2020 12:09:33 +0200 Subject: Allow restart filtering on cluster id and type --- .../api/integration/configserver/ConfigServer.java | 3 +- .../integration/noderepository/RestartFilter.java | 51 ++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/noderepository/RestartFilter.java (limited to 'controller-api') 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); + 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 = Optional.empty(); + private Optional clusterType = Optional.empty(); + private Optional clusterId = Optional.empty(); + + public Optional getHostName() { + return hostName; + } + + public Optional getClusterType() { + return clusterType; + } + + public Optional getClusterId() { + return clusterId; + } + + public RestartFilter withHostName(Optional hostName) { + this.hostName = hostName; + return this; + } + + public RestartFilter withClusterType(Optional clusterType) { + this.clusterType = clusterType; + return this; + } + + public RestartFilter withClusterId(Optional clusterId) { + this.clusterId = clusterId; + return this; + } + +} -- cgit v1.2.3