diff options
author | HÃ¥kon Hallingstad <hakon.hallingstad@gmail.com> | 2023-11-02 18:44:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-02 18:44:15 +0100 |
commit | 1308e7c4a5fdd30c52de99792f8cf5c40f9a6628 (patch) | |
tree | 56966722be3707eb9457dd2ec2a9b6e0a4c77d9a /node-repository | |
parent | bd2cd6431506ea6becfed510af5a0d3295a62cc9 (diff) | |
parent | b02d1228c2e0d957651c094a3af367d6229d2ae3 (diff) |
Merge pull request #29207 from vespa-engine/hakonhall/retire-if-there-are-shared-hosts-dedicated-to-cluster-type
Retire if there are shared hosts dedicated to cluster type
Diffstat (limited to 'node-repository')
4 files changed, 13 insertions, 2 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java index 449e1c07bf8..dfbe41e31d7 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java @@ -201,6 +201,11 @@ public class NodeRepository extends AbstractComponent { /** The number of nodes we should ensure has free capacity for node failures whenever possible */ public int spareCount() { return spareCount; } + /** Returns whether nodes must be allocated to hosts that are exclusive to the cluster type. */ + public boolean exclusiveClusterType(ClusterSpec cluster) { + return sharedHosts.value().hasClusterType(cluster.type().name()); + } + /** * Returns whether nodes are allocated exclusively in this instance given this cluster spec. * Exclusive allocation requires that the wanted node resources matches the advertised resources of the node @@ -209,7 +214,7 @@ public class NodeRepository extends AbstractComponent { public boolean exclusiveAllocation(ClusterSpec clusterSpec) { return clusterSpec.isExclusive() || ( clusterSpec.type().isContainer() && zone.system().isPublic() && !zone.environment().isTest() ) || - ( !zone().cloud().allowHostSharing() && !sharedHosts.value().isEnabled(clusterSpec.type().name())); + ( !zone().cloud().allowHostSharing() && !sharedHosts.value().supportsClusterType(clusterSpec.type().name())); } /** Whether the nodes of this cluster must be running on hosts that are specifically provisioned for the application. */ diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainer.java index 3c42972ee0b..108f8d77837 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/HostCapacityMaintainer.java @@ -301,6 +301,7 @@ public class HostCapacityMaintainer extends NodeRepositoryMaintainer { .stream() .filter(node -> node.violatesExclusivity(cluster, application, + nodeRepository().exclusiveClusterType(cluster), nodeRepository().exclusiveAllocation(cluster), false, nodeRepository().zone().cloud().allowHostSharing(), diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java index e1be5b48e2d..21340baf273 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeAllocation.java @@ -198,6 +198,7 @@ class NodeAllocation { private NodeCandidate.ExclusivityViolation violatesExclusivity(NodeCandidate candidate) { return candidate.violatesExclusivity(cluster, application, + nodeRepository.exclusiveClusterType(cluster), nodeRepository.exclusiveAllocation(cluster), nodeRepository.exclusiveProvisioning(cluster), nodeRepository.zone().cloud().allowHostSharing(), allNodes, makeExclusive); diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java index 1547a266e15..8c29b40bc26 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeCandidate.java @@ -595,7 +595,7 @@ public abstract class NodeCandidate implements Nodelike, Comparable<NodeCandidat } public ExclusivityViolation violatesExclusivity(ClusterSpec cluster, ApplicationId application, - boolean exclusiveAllocation, boolean exclusiveProvisioning, + boolean exclusiveClusterType, boolean exclusiveAllocation, boolean exclusiveProvisioning, boolean hostSharing, NodeList allNodes, boolean makeExclusive) { if (parentHostname().isEmpty()) return ExclusivityViolation.NONE; if (type() != NodeType.tenant) return ExclusivityViolation.NONE; @@ -614,6 +614,10 @@ public abstract class NodeCandidate implements Nodelike, Comparable<NodeCandidat if ( ! emptyOrEqual(parent.flatMap(Node::exclusiveToClusterType), cluster.type())) return ExclusivityViolation.YES; + // this cluster requires a parent that was provisioned exclusively for this cluster type + if (exclusiveClusterType && parent.flatMap(Node::exclusiveToClusterType).isEmpty() && makeExclusive) + return ExclusivityViolation.YES; + // the parent is provisioned for another application if ( ! emptyOrEqual(parent.flatMap(Node::provisionedForApplicationId), application)) return ExclusivityViolation.YES; |