swarm-nats: order the host queue's callout-key unit after the prune
A switch back deletes the queue's pod with --wait, so the pod is still ending while swarm-nats-k8s-prune runs. swarm-bao-nats-callout-xkey was ordered before the container but not after the prune, so on a slow apiserver its ensure-callout-keys ran beside the pod's responder and the switch test saw two responders. On a host with the cluster node the unit now starts after the prune. The prune names the unit nowhere, so there is no cycle, and without the node nothing changes. Closes #6831
This commit is contained in:
parent
f89d289a9f
commit
f658b2c770
2 changed files with 23 additions and 0 deletions
|
|
@ -1769,6 +1769,12 @@ in
|
||||||
# (./glue-bao-readers-store-order.nix); elsewhere the timeout below
|
# (./glue-bao-readers-store-order.nix); elsewhere the timeout below
|
||||||
# bounds the attempt.
|
# bounds the attempt.
|
||||||
before = [ "container@${machine}.service" ];
|
before = [ "container@${machine}.service" ];
|
||||||
|
# On a host with the cluster node, also after the prune that deletes the
|
||||||
|
# queue's pod on a switch back. The prune waits for the pod to end, and
|
||||||
|
# `ensure-callout-keys` must not run beside a pod still terminating: its
|
||||||
|
# responder is a second one against the same store. The prune names
|
||||||
|
# this unit nowhere, so the order has no cycle.
|
||||||
|
after = lib.optional deployCfg.k8s.enable "${machine}-k8s-prune.service";
|
||||||
wantedBy = [
|
wantedBy = [
|
||||||
"multi-user.target"
|
"multi-user.target"
|
||||||
"container@${machine}.service"
|
"container@${machine}.service"
|
||||||
|
|
|
||||||
|
|
@ -1910,6 +1910,23 @@ let
|
||||||
&& (u onCluster).environment == (u withNode).environment
|
&& (u onCluster).environment == (u withNode).environment
|
||||||
&& (u onCluster).serviceConfig.LoadCredential == (u withNode).serviceConfig.LoadCredential;
|
&& (u onCluster).serviceConfig.LoadCredential == (u withNode).serviceConfig.LoadCredential;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
# A switch back deletes the queue's pod with `--wait`, so the pod is
|
||||||
|
# still ending while the prune runs. The host copy's key step must wait
|
||||||
|
# for the prune, or it runs beside the pod's responder; and the prune must
|
||||||
|
# not name the key unit, which would be a cycle. Without the node there is
|
||||||
|
# no prune, so nothing orders the key unit after one.
|
||||||
|
name = "the host queue's callout-key unit starts after the prune that waits for the queue's pod, and the prune does not name it";
|
||||||
|
ok =
|
||||||
|
let
|
||||||
|
xkey = withNode.systemd.services.swarm-bao-nats-callout-xkey;
|
||||||
|
prune = withNode.systemd.services.swarm-nats-k8s-prune;
|
||||||
|
names = u: u.after ++ u.before ++ u.requires ++ u.wants ++ u.requiredBy ++ u.wantedBy;
|
||||||
|
in
|
||||||
|
lib.elem "swarm-nats-k8s-prune.service" xkey.after
|
||||||
|
&& !(lib.elem "swarm-bao-nats-callout-xkey.service" (names prune))
|
||||||
|
&& !(lib.elem "swarm-nats-k8s-prune.service" allLocal.systemd.services.swarm-bao-nats-callout-xkey.after);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
# The host with the queue on it is the control for each absence: it has
|
# The host with the queue on it is the control for each absence: it has
|
||||||
# the container, both delivery units and no rule in the raw table.
|
# the container, both delivery units and no rule in the raw table.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue