Skip to content

Commit

Permalink
Allowed for Kubernetes module to accept a raw cniConfig dir, instead …
Browse files Browse the repository at this point in the history
…of it building an environment from config attrSets - ref NixOS#14
  • Loading branch information
Johan Thomsen committed Feb 12, 2018
1 parent 5e4f2f4 commit 1fbc64a
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions nixos/modules/services/cluster/kubernetes/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,16 @@ let
keyFile = mkDefault cfg.kubeconfig.keyFile;
};

cniConfig = pkgs.buildEnv {
name = "kubernetes-cni-config";
paths = imap (i: entry:
pkgs.writeTextDir "${toString (10+i)}-${entry.type}.conf" (builtins.toJSON entry)
) cfg.kubelet.cni.config;
};
cniConfig =
if cfg.kubelet.cni.configDir == null then
(pkgs.buildEnv {
name = "kubernetes-cni-config";
paths = imap (i: entry:
pkgs.writeTextDir "${toString (10+i)}-${entry.type}.conf" (builtins.toJSON entry)
) cfg.kubelet.cni.config;
})
else
(cfg.kubelet.cni.configDir);

manifests = pkgs.buildEnv {
name = "kubernetes-manifests";
Expand Down Expand Up @@ -629,6 +633,12 @@ in {
}]
'';
};

configDir = mkOption {
description = "Path to Kubernetes CNI configuration directory.";
type = types.nullOr types.path;
default = null;
};
};

manifests = mkOption {
Expand Down Expand Up @@ -969,6 +979,7 @@ in {
${optionalString (cfg.clusterCidr!=null)
"--cluster-cidr=${cfg.clusterCidr}"} \
--allocate-node-cidrs=true \
--service-cluster-ip-range=10.90.0.0/16 \
${optionalString (cfg.controllerManager.featureGates != [])
"--feature-gates=${concatMapStringsSep "," (feature: "${feature}=true") cfg.controllerManager.featureGates}"} \
${optionalString cfg.verbose "--v=6"} \
Expand Down

0 comments on commit 1fbc64a

Please sign in to comment.