pin queue and poller state to per-service node labels instead of the hostname
This commit is contained in:
parent
cafbf3262f
commit
ff2bdea78d
1 changed files with 348 additions and 40 deletions
|
|
@ -25,6 +25,8 @@ let
|
|||
|
||||
machine = "swarm-nats";
|
||||
|
||||
labels = import ./k8s/labels.nix;
|
||||
|
||||
# The container's journal forwarder pushes to its own receiver on the swarm
|
||||
# collector, the route `serviceProducers.swarm-nats` in
|
||||
# ./swarm-otel-service.nix declares, by the collector's gateway name.
|
||||
|
|
@ -958,10 +960,16 @@ let
|
|||
}
|
||||
];
|
||||
|
||||
podSpec = {
|
||||
shareProcessNamespace = true;
|
||||
# Only the node with the queue's state label runs the pod: the volume's
|
||||
# affinity says the same, and a node without it shows as no match
|
||||
# instead of a volume that cannot bind.
|
||||
nodeSelector = labels.stateSelector "nats";
|
||||
};
|
||||
|
||||
# The server and the responder dial the queue by its name, which the pod
|
||||
# answers with its own loopback: the leaf carries the name and no IP.
|
||||
podSpec.shareProcessNamespace = true;
|
||||
|
||||
hostAliases = [
|
||||
{
|
||||
ip = "127.0.0.1";
|
||||
|
|
@ -1056,17 +1064,7 @@ let
|
|||
persistentVolumeReclaimPolicy = "Retain";
|
||||
storageClassName = stateClass;
|
||||
local.path = hostStoreDir;
|
||||
nodeAffinity.required.nodeSelectorTerms = [
|
||||
{
|
||||
matchExpressions = [
|
||||
{
|
||||
key = "kubernetes.io/hostname";
|
||||
operator = "In";
|
||||
values = [ (lib.toLower config.networking.hostName) ];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
nodeAffinity = labels.stateAffinity "nats";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue