diff options
author | Harald Musum <musum@yahooinc.com> | 2022-03-15 10:45:28 +0100 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-03-15 10:45:28 +0100 |
commit | d6f599c41830a79614197158b13cdfb86e3b9777 (patch) | |
tree | 14d4924595a3220a982a012029ee7c0b1c86fbee /config-model | |
parent | 6d62c41e5c1a341930419d6e80769f2825e37ea4 (diff) |
Less hardcoding of cluster name
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java index 0d8f7148758..80514d9698a 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java @@ -62,6 +62,8 @@ import java.util.Set; import java.util.TreeMap; import java.util.logging.Level; +import static com.yahoo.config.provision.NodeResources.DiskSpeed; +import static com.yahoo.config.provision.NodeResources.StorageType; import static java.util.stream.Collectors.toList; /** @@ -282,9 +284,11 @@ public class ContentCluster extends AbstractConfigProducer<AbstractConfigProduce DeployState deployState) { if (admin == null) return; // only in tests if (contentCluster.getPersistence() == null) return; + ClusterControllerContainerCluster clusterControllers; + String clusterName = "cluster-controllers"; if (context.properties().hostedVespa()) { - clusterControllers = getDedicatedSharedControllers(contentElement, admin, context, deployState); + clusterControllers = getDedicatedSharedControllers(contentElement, admin, context, deployState, clusterName); } else if (admin.multitenant()) { // system tests: Put on logserver if (admin.getClusterControllers() == null) { @@ -292,7 +296,7 @@ public class ContentCluster extends AbstractConfigProducer<AbstractConfigProduce List<HostResource> host = admin.getLogserver() == null ? List.of() : List.of(admin.getLogserver().getHostResource()); admin.setClusterControllers(createClusterControllers(new ClusterControllerCluster(admin, "standalone", deployState), host, - "cluster-controllers", + clusterName, true, deployState), deployState); @@ -324,26 +328,27 @@ public class ContentCluster extends AbstractConfigProducer<AbstractConfigProduce } } - public static final NodeResources clusterControllerResources = new NodeResources(0.25, 1, 10, 0.3, NodeResources.DiskSpeed.any, NodeResources.StorageType.any); + public static final NodeResources clusterControllerResources = new NodeResources(0.25, 1, 10, 0.3, DiskSpeed.any, StorageType.any); - private ClusterControllerContainerCluster getDedicatedSharedControllers(ModelElement contentElement, Admin admin, - ConfigModelContext context, DeployState deployState) { + private ClusterControllerContainerCluster getDedicatedSharedControllers(ModelElement contentElement, + Admin admin, + ConfigModelContext context, + DeployState deployState, + String clusterName) { if (admin.getClusterControllers() == null) { NodesSpecification spec = NodesSpecification.requiredFromSharedParents(deployState.zone().environment().isProduction() ? 3 : 1, clusterControllerResources, contentElement, context); - Collection<HostResource> hosts = spec.provision(admin.hostSystem(), ClusterSpec.Type.admin, - ClusterSpec.Id.from("cluster-controllers"), + ClusterSpec.Id.from(clusterName), context.getDeployLogger(), true) .keySet(); - admin.setClusterControllers(createClusterControllers(new ClusterControllerCluster(admin, "standalone", deployState), hosts, - "cluster-controllers", + clusterName, true, context.getDeployState()), deployState); |