Skip to content

Commit

Permalink
Make kuberouter module always override its CNI-config at startup, and…
Browse files Browse the repository at this point in the history
… delete it after stopping, to housekeep the system - ref NixOS#14
  • Loading branch information
Johan Thomsen committed Feb 15, 2018
1 parent 6cdd509 commit 345ebf6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nixos/modules/dbc/services/networking/kube-router.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ let

preStart = mkIf (cfg.cniConfig != null)
''
if [[ ! -f ${cfg.mutableCniPath}/${cniConfigFileName} ]]; then
mkdir -p ${cfg.mutableCniPath}
cp ${cniFile} ${cfg.mutableCniPath}/${cniConfigFileName}
fi
'';

start = ''
Expand All @@ -33,6 +31,9 @@ let
--peer-router-ips=${concatMapStringsSep "," (router: router.ip) cfg.peerRouters} \
--peer-router-passwords=${concatMapStringsSep "," (router: router.password) cfg.peerRouters} \
'';

postStop = "rm -fr ${cfg.mutableCniPath}";

in
{
options = {
Expand Down Expand Up @@ -173,6 +174,7 @@ in
after = ["kubernetes.target"];
requires = ["kubernetes.target"];
inherit preStart;
inherit postStop;
script = start;
serviceConfig = {
Type = "simple";
Expand Down

0 comments on commit 345ebf6

Please sign in to comment.