diff options
author | Morten Tokle <mortent@verizonmedia.com> | 2021-02-24 14:43:12 +0100 |
---|---|---|
committer | Morten Tokle <mortent@verizonmedia.com> | 2021-02-24 15:39:37 +0100 |
commit | bb7594acd3d55225ba44691e9c76d826cba7274a (patch) | |
tree | 6778d4d118c720dedb2c69fa641cbdf063a2345e /node-admin/src | |
parent | e356a69e30c5bb7f74fe3ca3772fe4dfac4427f3 (diff) |
Expose hostExclusiveTo field in NodeAgentContext
Diffstat (limited to 'node-admin/src')
2 files changed, 22 insertions, 2 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContext.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContext.java index c33b084c213..646e5bd7773 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContext.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContext.java @@ -1,6 +1,7 @@ // Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.admin.nodeagent; +import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.NodeType; import com.yahoo.config.provision.zone.ZoneApi; @@ -13,6 +14,7 @@ import com.yahoo.vespa.hosted.node.admin.docker.ContainerNetworkMode; import java.nio.file.FileSystem; import java.nio.file.Path; +import java.util.Optional; public interface NodeAgentContext extends TaskContext { @@ -94,4 +96,6 @@ public interface NodeAgentContext extends TaskContext { default Path pathInNodeUnderVespaHome(String relativePath) { return pathInNodeUnderVespaHome(fileSystem().getPath(relativePath)); } + + Optional<ApplicationId> hostExclusiveTo(); } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java index 6ab2469cd64..dc2b9fbb670 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentContextImpl.java @@ -1,6 +1,7 @@ // Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.admin.nodeagent; +import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.CloudName; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.zone.ZoneApi; @@ -46,12 +47,14 @@ public class NodeAgentContextImpl implements NodeAgentContext { private final String vespaUserOnHost; private final double cpuSpeedup; private final Set<NodeAgentTask> disabledNodeAgentTasks; + private final Optional<ApplicationId> hostExclusiveTo; public NodeAgentContextImpl(NodeSpec node, Acl acl, AthenzIdentity identity, ContainerNetworkMode containerNetworkMode, ZoneApi zone, FileSystem fileSystem, FlagSource flagSource, Path pathToContainerStorage, Path pathToVespaHome, - String vespaUser, String vespaUserOnHost, double cpuSpeedup) { + String vespaUser, String vespaUserOnHost, double cpuSpeedup, + Optional<ApplicationId> hostExclusiveTo) { if (cpuSpeedup <= 0) throw new IllegalArgumentException("cpuSpeedUp must be positive, was: " + cpuSpeedup); @@ -70,6 +73,7 @@ public class NodeAgentContextImpl implements NodeAgentContext { this.cpuSpeedup = cpuSpeedup; this.disabledNodeAgentTasks = NodeAgentTask.fromString( PermanentFlags.DISABLED_HOST_ADMIN_TASKS.bindTo(flagSource).with(FetchVector.Dimension.HOSTNAME, node.hostname()).value()); + this.hostExclusiveTo = hostExclusiveTo; } @Override @@ -161,6 +165,11 @@ public class NodeAgentContextImpl implements NodeAgentContext { } @Override + public Optional<ApplicationId> hostExclusiveTo() { + return hostExclusiveTo; + } + + @Override public void recordSystemModification(Logger logger, String message) { log(logger, message); } @@ -188,6 +197,7 @@ public class NodeAgentContextImpl implements NodeAgentContext { ", pathToVespaHome=" + pathToVespaHome + ", vespaUser='" + vespaUser + '\'' + ", vespaUserOnHost='" + vespaUserOnHost + '\'' + + ", hostExclusiveTo='" + hostExclusiveTo + '\'' + '}'; } @@ -216,6 +226,7 @@ public class NodeAgentContextImpl implements NodeAgentContext { private FlagSource flagSource; private double cpuSpeedUp = 1; private Path containerStorage; + private Optional<ApplicationId> hostExclusiveTo = Optional.empty(); public Builder(NodeSpec node) { this.nodeSpecBuilder = new NodeSpec.Builder(node); @@ -286,6 +297,11 @@ public class NodeAgentContextImpl implements NodeAgentContext { return this; } + public Builder hostExclusiveTo(ApplicationId applicationId) { + this.hostExclusiveTo = Optional.ofNullable(applicationId); + return this; + } + public NodeAgentContextImpl build() { return new NodeAgentContextImpl( nodeSpecBuilder.build(), @@ -319,7 +335,7 @@ public class NodeAgentContextImpl implements NodeAgentContext { fileSystem.getPath("/opt/vespa"), Optional.ofNullable(vespaUser).orElse("vespa"), Optional.ofNullable(vespaUserOnHost).orElse("container_vespa"), - cpuSpeedUp); + cpuSpeedUp, hostExclusiveTo); } } } |