pin queue and poller state to per-service node labels instead of the hostname
This commit is contained in:
parent
ab6a180e79
commit
79c06cdcb0
1 changed files with 348 additions and 40 deletions
36
nix/host-modules/k8s/labels.nix
Normal file
36
nix/host-modules/k8s/labels.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# The node labels that pin pods to a node, and the selectors that find them.
|
||||
# ./node.nix puts the labels on the node; the renderer and the queue's module
|
||||
# select on them. docs/4-implementation/k8s/node.md has the scheme.
|
||||
rec {
|
||||
# The node that holds the data a service keeps in the cluster. One label per
|
||||
# service, so moving one service's data moves one label.
|
||||
stateLabel = service: "hyperhive.darkest.space/state-${service}";
|
||||
|
||||
# The node the hosts' DNS points at: the pods that hosts dial run there.
|
||||
entryLabel = "hyperhive.darkest.space/entry";
|
||||
|
||||
# k3s's own (docs.k3s.io/networking/networking-services, "Controlling servicelb
|
||||
# node selection"): once any node carries it, the service load balancer binds
|
||||
# a published port on the labelled nodes only.
|
||||
loadBalancerLabel = "svccontroller.k3s.cattle.io/enablelb";
|
||||
|
||||
# A pod's `nodeSelector` for a service's state label.
|
||||
stateSelector = service: {
|
||||
${stateLabel service} = "true";
|
||||
};
|
||||
|
||||
# A static local volume's `nodeAffinity` for the same label.
|
||||
stateAffinity = service: {
|
||||
required.nodeSelectorTerms = [
|
||||
{
|
||||
matchExpressions = [
|
||||
{
|
||||
key = stateLabel service;
|
||||
operator = "In";
|
||||
values = [ "true" ];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue