summaryrefslogtreecommitdiffstats
path: root/config-provisioning
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-10-23 20:42:58 +0200
committerJon Bratseth <bratseth@oath.com>2018-10-23 20:42:58 +0200
commit098f7fd34dfb3cdbb7f05c0bfe635c2f39cea2b3 (patch)
tree1bd87252dfb71c39e1dc448349a22579eefe06f2 /config-provisioning
parente678ffc025674df331f478064542db22fd7e4dd5 (diff)
parent1a8bbf7434e13271f10862aa3c0057f30122ad0c (diff)
Merge with master
Diffstat (limited to 'config-provisioning')
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java34
1 files changed, 22 insertions, 12 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java
index d56a7c3e298..44bd7ec3708 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java
@@ -9,43 +9,53 @@ package com.yahoo.config.provision;
public enum NodeType {
/** A node to be assigned to a tenant to run application workloads */
- tenant(false, "Tenant node"),
+ tenant(null, "Tenant node"),
/** A host of a set of (Docker) tenant nodes */
- host(true, "Tenant docker host"),
+ host(tenant, "Tenant docker host"),
/** Nodes running the shared proxy layer */
- proxy(false, "Proxy node"),
+ proxy(null, "Proxy node"),
/** A host of a (Docker) proxy node */
- proxyhost(true, "Proxy docker host"),
+ proxyhost(proxy, "Proxy docker host"),
/** A config server */
- config(false, "Config server"),
+ config(null, "Config server"),
/** A host of a (Docker) config server node */
- confighost(true, "Config docker host"),
+ confighost(config, "Config docker host"),
/** A controller */
- controller(false, "Controller"),
+ controller(null, "Controller"),
/** A host of a (Docker) controller node */
- controllerhost(true, "Controller host");
+ controllerhost(controller, "Controller host");
- private final boolean isDockerHost;
+ private final NodeType childNodeType;
private final String description;
- NodeType(boolean isDockerHost, String description) {
- this.isDockerHost = isDockerHost;
+ NodeType(NodeType childNodeType, String description) {
+ this.childNodeType = childNodeType;
this.description = description;
}
public boolean isDockerHost() {
- return isDockerHost;
+ return childNodeType != null;
}
public String description() {
return description;
}
+ /**
+ * @return {@link NodeType} of the node(s) that run on this host
+ * @throws IllegalStateException if this type is not a host
+ */
+ public NodeType childNodeType() {
+ if (! isDockerHost())
+ throw new IllegalStateException(this + " has no children");
+
+ return childNodeType;
+ }
}