mirror of
https://github.com/logos-storage/logos-storage-nim-cs-dist-tests.git
synced 2026-08-08 23:23:18 +00:00
force pod spread (#130)
Added required pod anti-affinity (kubernetes.io/hostname, pod-uuid Exists) to K8sController.cs so all pods within a test namespace are forced onto distinct nodes (Pending if unsatisfiable) to cover the worst-case pod counts per namespace. The anti-affinity TopologyKey of "kubernetes.io/hostname" specifies that the domain is the node, along with the "Exists" operator, specifies that "this Pod should not run on this node if this node is already running one or mode pods that have a "pod-uuid" key (they all do).
This commit is contained in:
parent
e8b2ad014b
commit
d6a9b9239a
@ -375,6 +375,7 @@ namespace KubernetesWorkflow
|
||||
PriorityClassName = GetPriorityClassName(containerRecipes),
|
||||
NodeSelector = CreateNodeSelector(location, containerRecipes),
|
||||
Tolerations = CreateTolerations(containerRecipes),
|
||||
Affinity = CreateSpreadAffinity(),
|
||||
Containers = CreateDeploymentContainers(containerRecipes),
|
||||
Volumes = CreateVolumes(containerRecipes)
|
||||
}
|
||||
@ -422,6 +423,34 @@ namespace KubernetesWorkflow
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private V1Affinity CreateSpreadAffinity()
|
||||
{
|
||||
return new V1Affinity
|
||||
{
|
||||
PodAntiAffinity = new V1PodAntiAffinity
|
||||
{
|
||||
RequiredDuringSchedulingIgnoredDuringExecution = new List<V1PodAffinityTerm>
|
||||
{
|
||||
new V1PodAffinityTerm
|
||||
{
|
||||
TopologyKey = "kubernetes.io/hostname",
|
||||
LabelSelector = new V1LabelSelector
|
||||
{
|
||||
MatchExpressions = new List<V1LabelSelectorRequirement>
|
||||
{
|
||||
new V1LabelSelectorRequirement
|
||||
{
|
||||
Key = PodLabelKey,
|
||||
OperatorProperty = "Exists"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private K8sNodeLabel? GetNodeLabelForLocation(ILocation location)
|
||||
{
|
||||
var l = (Location)location;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user