Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/nix/host-modules/k8s/labels.nix

36 lines
1.3 KiB
Nix

# 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" ];
}
];
}
];
};
}