nixos/k3s: Update service to match upstream

Fixes race between k3s and network.
This commit is contained in:
ThinkChaos 2020-11-09 19:50:36 +01:00
parent 9ed8e03a09
commit 7514f00733

View File

@ -78,7 +78,8 @@ in
systemd.services.k3s = {
description = "k3s service";
after = mkIf cfg.docker [ "docker.service" ];
after = if cfg.docker then "docker.service" else "network-online.service";
wants = "network-online.service";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
# See: https://github.com/rancher/k3s/blob/dddbd16305284ae4bd14c0aade892412310d7edc/install.sh#L197
@ -87,6 +88,10 @@ in
Delegate = "yes";
Restart = "always";
RestartSec = "5s";
LimitNOFILE = 1048576;
LimitNPROC = "infinity";
LimitCORE = "infinity";
TasksMax = "infinity";
ExecStart = concatStringsSep " \\\n " (
[
"${cfg.package}/bin/k3s ${cfg.role}"