summaryrefslogtreecommitdiffstats
path: root/node-admin
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@oath.com>2018-08-30 10:52:09 +0200
committerValerij Fredriksen <valerijf@oath.com>2018-08-30 10:52:09 +0200
commitb7eb953bbc89f1e8f4155af27bba25409ef6b778 (patch)
treeede4719fb976bb979c99fe016b9436b45bcb8496 /node-admin
parenta4095d49eda6a7da77d695e4e01d6e9f0d0fc604 (diff)
Fix ZPE TODO
Diffstat (limited to 'node-admin')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/Environment.java21
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java13
2 files changed, 25 insertions, 9 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/Environment.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/Environment.java
index bc15cddb607..c9f17b7cbf6 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/Environment.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/Environment.java
@@ -63,6 +63,7 @@ public class Environment {
private final URI ztsUri;
private final AthenzService nodeAthenzIdentity;
private final boolean nodeAgentCertEnabled;
+ private final boolean isRunningOnHost;
private final Path trustStorePath;
static {
@@ -86,7 +87,8 @@ public class Environment {
getEnvironmentVariable(CERTIFICATE_DNS_SUFFIX),
URI.create(getEnvironmentVariable(ZTS_URI)),
(AthenzService)AthenzIdentities.from(getEnvironmentVariable(NODE_ATHENZ_IDENTITY)),
- Boolean.valueOf(getEnvironmentVariable(ENABLE_NODE_AGENT_CERT)));
+ Boolean.valueOf(getEnvironmentVariable(ENABLE_NODE_AGENT_CERT)),
+ false);
}
private Environment(ConfigServerConfig configServerConfig,
@@ -105,7 +107,8 @@ public class Environment {
String certificateDnsSuffix,
URI ztsUri,
AthenzService nodeAthenzIdentity,
- boolean nodeAgentCertEnabled) {
+ boolean nodeAgentCertEnabled,
+ boolean isRunningOnHost) {
Objects.requireNonNull(configServerConfig, "configServerConfig cannot be null");
Objects.requireNonNull(environment, "environment cannot be null");
Objects.requireNonNull(region, "region cannot be null");
@@ -128,6 +131,7 @@ public class Environment {
this.ztsUri = ztsUri;
this.nodeAthenzIdentity = nodeAthenzIdentity;
this.nodeAgentCertEnabled = nodeAgentCertEnabled;
+ this.isRunningOnHost = isRunningOnHost;
this.trustStorePath = trustStorePath;
}
@@ -272,6 +276,10 @@ public class Environment {
return nodeAgentCertEnabled;
}
+ public boolean isRunningOnHost() {
+ return isRunningOnHost;
+ }
+
public static class Builder {
private ConfigServerConfig configServerConfig;
private String environment;
@@ -289,6 +297,7 @@ public class Environment {
private URI ztsUri;
private AthenzService nodeAthenzIdentity;
private boolean nodeAgentCertEnabled;
+ private boolean isRunningOnHost;
private Path trustStorePath;
public Builder configServerConfig(ConfigServerConfig configServerConfig) {
@@ -371,6 +380,11 @@ public class Environment {
return this;
}
+ public Builder isRunningOnHost(boolean isRunningOnHost) {
+ this.isRunningOnHost = isRunningOnHost;
+ return this;
+ }
+
public Builder trustStorePath(Path trustStorePath) {
this.trustStorePath = trustStorePath;
return this;
@@ -393,7 +407,8 @@ public class Environment {
certificateDnsSuffix,
ztsUri,
nodeAthenzIdentity,
- nodeAgentCertEnabled);
+ nodeAgentCertEnabled,
+ isRunningOnHost);
}
}
}
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java
index 625feb034e4..f3b5dc9342a 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java
@@ -97,12 +97,13 @@ public class DockerOperationsImpl implements DockerOperations {
command.withVolume("/var/lib/sia", "/var/lib/sia");
}
- // TODO When rolling out host-admin on-prem: Always map in /var/zpe from host + make sure zpu is configured on host
- if (environment.getCloud().equalsIgnoreCase("yahoo")) {
- Path pathInNode = environment.pathInNodeUnderVespaHome("var/zpe");
- command.withVolume(environment.pathInHostFromPathInNode(containerName, pathInNode).toString(), pathInNode.toString());
- } else if (environment.getNodeType() == NodeType.host) {
- command.withVolume("/var/zpe", environment.pathInNodeUnderVespaHome("var/zpe").toString());
+ if (environment.getNodeType() == NodeType.host) {
+ Path zpePathInNode = environment.pathInNodeUnderVespaHome("var/zpe");
+ if (environment.isRunningOnHost()) {
+ command.withVolume("/var/zpe", zpePathInNode.toString());
+ } else {
+ command.withVolume(environment.pathInHostFromPathInNode(containerName, zpePathInNode).toString(), zpePathInNode.toString());
+ }
}
if (environment.getNodeType() == NodeType.proxyhost) {