nixos/kubernetes: Fix kube-control-plane-online must not be present

outside kubernetes module.
This commit is contained in:
Christian Albrecht 2019-03-07 14:34:15 +01:00
parent ff382c18c8
commit 154356d820
No known key found for this signature in database
GPG Key ID: 866AF4B25DF7EB00
2 changed files with 23 additions and 23 deletions

View File

@ -423,30 +423,7 @@ in
};
})
{
systemd.targets.kube-control-plane-online = {
wantedBy = [ "kubernetes.target" ];
before = [ "kubernetes.target" ];
};
systemd.services.kube-control-plane-online = rec {
description = "Kubernetes control plane is online";
wantedBy = [ "kube-control-plane-online.target" ];
after = [ "kube-scheduler.service" "kube-controller-manager.service" ];
before = [ "kube-control-plane-online.target" ];
preStart = ''
${top.lib.mkWaitCurl ( with config.systemd.services.kube-control-plane-online; {
sleep = 3;
path = "/healthz";
cacert = top.caFile;
} // optionalAttrs (environment ? cert) { inherit (environment) cert key; })}
'';
script = "echo Ok";
serviceConfig = {
TimeoutSec = "500";
};
};
}
];
}

View File

@ -299,6 +299,29 @@ in {
services.kubernetes.apiserverAddress = mkDefault ("https://${if cfg.apiserver.advertiseAddress != null
then cfg.apiserver.advertiseAddress
else "${cfg.masterAddress}:${toString cfg.apiserver.securePort}"}");
systemd.targets.kube-control-plane-online = {
wantedBy = [ "kubernetes.target" ];
before = [ "kubernetes.target" ];
};
systemd.services.kube-control-plane-online = rec {
description = "Kubernetes control plane is online";
wantedBy = [ "kube-control-plane-online.target" ];
after = [ "kube-scheduler.service" "kube-controller-manager.service" ];
before = [ "kube-control-plane-online.target" ];
preStart = ''
${cfg.lib.mkWaitCurl ( with config.systemd.services.kube-control-plane-online; {
sleep = 3;
path = "/healthz";
cacert = cfg.caFile;
} // optionalAttrs (environment ? cert) { inherit (environment) cert key; })}
'';
script = "echo Ok";
serviceConfig = {
TimeoutSec = "500";
};
};
})
];
}