summaryrefslogtreecommitdiffstats
path: root/node-admin
diff options
context:
space:
mode:
authorHarald Musum <musum@oath.com>2018-02-16 22:01:44 +0100
committerHarald Musum <musum@oath.com>2018-02-16 22:01:44 +0100
commite16bc2b1ff6aaf82bcd9caf72eb5f9bfc085d2f1 (patch)
tree1685c48d7d41ac59289cbfc929ea8eec81c52825 /node-admin
parent2f573fb8d57226406ae8c51518d81ca010ade411 (diff)
Add node type 'confighost' and use it in Environment
Diffstat (limited to 'node-admin')
-rw-r--r--node-admin/pom.xml8
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/component/Environment.java45
2 files changed, 36 insertions, 17 deletions
diff --git a/node-admin/pom.xml b/node-admin/pom.xml
index 3bd7eb04e8b..034db16b4e4 100644
--- a/node-admin/pom.xml
+++ b/node-admin/pom.xml
@@ -25,7 +25,13 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>com.yahoo.vespa</groupId>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>config-provisioning</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
<artifactId>node-repository</artifactId>
<version>${project.version}</version>
</dependency>
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 5581415fec2..06663b3f0f5 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
@@ -2,6 +2,7 @@
package com.yahoo.vespa.hosted.node.admin.component;
import com.google.common.base.Strings;
+import com.yahoo.config.provision.NodeType;
import com.yahoo.vespa.athenz.api.AthenzIdentity;
import com.yahoo.vespa.athenz.api.AthenzService;
import com.yahoo.vespa.defaults.Defaults;
@@ -41,7 +42,7 @@ public class Environment {
private static final String LOGSTASH_NODES = "LOGSTASH_NODES";
private static final String COREDUMP_FEED_ENDPOINT = "COREDUMP_FEED_ENDPOINT";
- private final List<URI> configServerHosts;
+ private final List<URI> configServerURIs;
private final String environment;
private final String region;
private final String parentHostHostname;
@@ -52,6 +53,7 @@ public class Environment {
private final Optional<KeyStoreOptions> keyStoreOptions;
private final Optional<KeyStoreOptions> trustStoreOptions;
private final Optional<AthenzIdentity> athenzIdentity;
+ private final NodeType nodeType;
static {
filenameFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
@@ -62,14 +64,16 @@ public class Environment {
getEnvironmentVariable(ENVIRONMENT),
getEnvironmentVariable(REGION),
new PathResolver(),
- Optional.of(getEnvironmentVariable(COREDUMP_FEED_ENDPOINT)));
+ Optional.of(getEnvironmentVariable(COREDUMP_FEED_ENDPOINT)),
+ NodeType.host);
}
public Environment(ConfigServerConfig configServerConfig,
String hostedEnvironment,
String hostedRegion,
PathResolver pathResolver,
- Optional<String> coreDumpFeedEndpoint) {
+ Optional<String> coreDumpFeedEndpoint,
+ NodeType nodeType) {
this(createConfigServerUris(
configServerConfig.scheme(),
configServerConfig.hosts(),
@@ -95,11 +99,12 @@ public class Environment {
null),
createAthenzIdentity(
configServerConfig.athenzDomain(),
- configServerConfig.serviceName())
+ configServerConfig.serviceName()),
+ nodeType
);
}
- public Environment(List<URI> configServerHosts,
+ public Environment(List<URI> configServerURIs,
String environment,
String region,
String parentHostHostname,
@@ -109,8 +114,9 @@ public class Environment {
Optional<String> feedEndpoint,
Optional<KeyStoreOptions> keyStoreOptions,
Optional<KeyStoreOptions> trustStoreOptions,
- Optional<AthenzIdentity> athenzIdentity) {
- this.configServerHosts = configServerHosts;
+ Optional<AthenzIdentity> athenzIdentity,
+ NodeType nodeType) {
+ this.configServerURIs = configServerURIs;
this.environment = environment;
this.region = region;
this.parentHostHostname = parentHostHostname;
@@ -121,9 +127,10 @@ public class Environment {
this.keyStoreOptions = keyStoreOptions;
this.trustStoreOptions = trustStoreOptions;
this.athenzIdentity = athenzIdentity;
+ this.nodeType = nodeType;
}
- public List<URI> getConfigServerUris() { return configServerHosts; }
+ public List<URI> getConfigServerUris() { return configServerURIs; }
public String getEnvironment() {
return environment;
@@ -149,7 +156,7 @@ public class Environment {
return getEnvironment() + "." + getRegion();
}
- private static List<URI> createConfigServerUris(String scheme, List<String> configServerHosts, int port) {
+ public static List<URI> createConfigServerUris(String scheme, List<String> configServerHosts, int port) {
return configServerHosts.stream()
.map(hostname -> URI.create(scheme + "://" + hostname + ":" + port))
.collect(Collectors.toList());
@@ -252,9 +259,10 @@ public class Environment {
return athenzIdentity;
}
+ public NodeType getNodeType() { return nodeType; }
public static class Builder {
- private List<URI> configServerHosts = Collections.emptyList();
+ private List<URI> configServerURIs = Collections.emptyList();
private String environment;
private String region;
private String parentHostHostname;
@@ -265,11 +273,10 @@ public class Environment {
private KeyStoreOptions keyStoreOptions;
private KeyStoreOptions trustStoreOptions;
private AthenzIdentity athenzIdentity;
+ private NodeType nodeType = NodeType.tenant;
- public Builder configServerUris(String... hosts) {
- configServerHosts = Arrays.stream(hosts)
- .map(URI::create)
- .collect(Collectors.toList());
+ public Builder configServerUris(List<URI> uris) {
+ configServerURIs = uris;
return this;
}
@@ -323,11 +330,17 @@ public class Environment {
return this;
}
+ public Builder nodeType(NodeType nodeType) {
+ this.nodeType = nodeType;
+ return this;
+ }
+
public Environment build() {
- return new Environment(configServerHosts, environment, region, parentHostHostname, inetAddressResolver,
+ return new Environment(configServerURIs, environment, region, parentHostHostname, inetAddressResolver,
pathResolver, logstashNodes, feedEndpoint,
Optional.ofNullable(keyStoreOptions), Optional.ofNullable(trustStoreOptions),
- Optional.ofNullable(athenzIdentity));
+ Optional.ofNullable(athenzIdentity),
+ nodeType);
}
}
}