k8s: the ca-trust publisher no longer holds multi-user.target while it waits for the setup
This commit is contained in:
parent
40dd9a6303
commit
b3c5113d53
3 changed files with 14 additions and 2 deletions
|
|
@ -93,7 +93,12 @@ have the units. To leave the cluster, switch to an older generation.
|
|||
|
||||
All are public certificates. The unit waits for the cluster and for the
|
||||
files, and a pod that mounts the ConfigMap waits in `ContainerCreating` until
|
||||
the unit has run. A path unit watches both files and runs the unit again when
|
||||
the unit has run. The unit is `Type=simple`, so it doesn't hold
|
||||
`multi-user.target` while it waits: the store's and the hive's CA files come
|
||||
from the [setup](../../1-getting-started/setup.md), which runs after the host
|
||||
has booted. The kubelet retries a failed volume mount with a backoff of up to
|
||||
two minutes, so a pod that was waiting starts up to two minutes after the unit
|
||||
has published. A path unit watches both files and runs the unit again when
|
||||
either changes, with no manual step. A running pod doesn't see a changed
|
||||
trust bundle until it restarts, because the kubelet doesn't update `subPath`
|
||||
mounts.
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ in
|
|||
# A pod waits in ContainerCreating until this has run. The unit has no
|
||||
# `RemainAfterExit`, so the path unit below starts it again whenever a
|
||||
# file changes.
|
||||
#
|
||||
# `Type = "simple"`: the start job is done once the script has forked, so
|
||||
# the unit never holds `multi-user.target`. The CA files come from the
|
||||
# setup, which runs after boot, and the script waits for them.
|
||||
(lib.mkIf (onCluster != [ ] && caFiles != { }) {
|
||||
systemd.services.hyperhive-k8s-ca-trust = {
|
||||
description = "publish the hive's CA files to the cluster's pods";
|
||||
|
|
@ -80,7 +84,7 @@ in
|
|||
"swarm-bao-pki.service"
|
||||
];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
Type = "simple";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "10s";
|
||||
SyslogIdentifier = "hyperhive-k8s-ca-trust";
|
||||
|
|
|
|||
|
|
@ -892,6 +892,9 @@ let
|
|||
&& hasInfix "--from-file=swarm-services-root.pem=" caUnit.script
|
||||
&& hasInfix "--from-file=trust-bundle.pem=" caUnit.script
|
||||
&& lib.elem "multi-user.target" caUnit.wantedBy
|
||||
# Not a oneshot: its start job would last until the script ends, and the
|
||||
# script waits for files the setup writes after boot.
|
||||
&& caUnit.serviceConfig.Type == "simple"
|
||||
# A change to either file publishes again with no manual step, and the
|
||||
# host without the node has no path unit.
|
||||
&&
|
||||
|
|
|
|||
Loading…
Reference in a new issue