From 154356d820179a04c073ceadad0a4594ec18bf7d Mon Sep 17 00:00:00 2001 From: Christian Albrecht Date: Thu, 7 Mar 2019 14:34:15 +0100 Subject: [PATCH] nixos/kubernetes: Fix kube-control-plane-online must not be present outside kubernetes module. --- .../services/cluster/kubernetes/apiserver.nix | 23 ------------------- .../services/cluster/kubernetes/default.nix | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/nixos/modules/services/cluster/kubernetes/apiserver.nix b/nixos/modules/services/cluster/kubernetes/apiserver.nix index 63b485c43b84..287844074593 100644 --- a/nixos/modules/services/cluster/kubernetes/apiserver.nix +++ b/nixos/modules/services/cluster/kubernetes/apiserver.nix @@ -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"; - }; - }; - } ]; } diff --git a/nixos/modules/services/cluster/kubernetes/default.nix b/nixos/modules/services/cluster/kubernetes/default.nix index f1f544afc4d1..6560cff63282 100644 --- a/nixos/modules/services/cluster/kubernetes/default.nix +++ b/nixos/modules/services/cluster/kubernetes/default.nix @@ -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"; + }; + }; }) ]; }