aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/services/cluster/kubernetes/proxy.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/cluster/kubernetes/proxy.nix')
-rw-r--r--nixos/modules/services/cluster/kubernetes/proxy.nix37
1 files changed, 6 insertions, 31 deletions
diff --git a/nixos/modules/services/cluster/kubernetes/proxy.nix b/nixos/modules/services/cluster/kubernetes/proxy.nix
index 23f4d97b703..bd4bf04ea83 100644
--- a/nixos/modules/services/cluster/kubernetes/proxy.nix
+++ b/nixos/modules/services/cluster/kubernetes/proxy.nix
@@ -45,28 +45,12 @@ in
};
###### implementation
- config = let
-
- proxyPaths = filter (a: a != null) [
- cfg.kubeconfig.caFile
- cfg.kubeconfig.certFile
- cfg.kubeconfig.keyFile
- ];
-
- in mkIf cfg.enable {
- systemd.services.kube-proxy = rec {
+ config = mkIf cfg.enable {
+ systemd.services.kube-proxy = {
description = "Kubernetes Proxy Service";
- wantedBy = [ "kube-node-online.target" ];
- after = [ "kubelet-online.service" ];
- before = [ "kube-node-online.target" ];
- environment.KUBECONFIG = top.lib.mkKubeConfig "kube-proxy" cfg.kubeconfig;
- path = with pkgs; [ iptables conntrack_tools kubectl ];
- preStart = ''
- until kubectl auth can-i get nodes/${top.kubelet.hostname} -q 2>/dev/null; do
- echo kubectl auth can-i get nodes/${top.kubelet.hostname}: exit status $?
- sleep 2
- done
- '';
+ wantedBy = [ "kubernetes.target" ];
+ after = [ "kube-apiserver.service" ];
+ path = with pkgs; [ iptables conntrack_tools ];
serviceConfig = {
Slice = "kubernetes.slice";
ExecStart = ''${top.package}/bin/kube-proxy \
@@ -75,7 +59,7 @@ in
"--cluster-cidr=${top.clusterCidr}"} \
${optionalString (cfg.featureGates != [])
"--feature-gates=${concatMapStringsSep "," (feature: "${feature}=true") cfg.featureGates}"} \
- --kubeconfig=${environment.KUBECONFIG} \
+ --kubeconfig=${top.lib.mkKubeConfig "kube-proxy" cfg.kubeconfig} \
${optionalString (cfg.verbosity != null) "--v=${toString cfg.verbosity}"} \
${cfg.extraOpts}
'';
@@ -83,15 +67,6 @@ in
Restart = "on-failure";
RestartSec = 5;
};
- unitConfig.ConditionPathExists = proxyPaths;
- };
-
- systemd.paths.kube-proxy = {
- wantedBy = [ "kube-proxy.service" ];
- pathConfig = {
- PathExists = proxyPaths;
- PathChanged = proxyPaths;
- };
};
services.kubernetes.pki.certs = {