summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/cluster
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/cluster')
-rw-r--r--nixos/modules/services/cluster/kubernetes/addons/dns.nix54
-rw-r--r--nixos/modules/services/cluster/kubernetes/pki.nix2
2 files changed, 41 insertions, 15 deletions
diff --git a/nixos/modules/services/cluster/kubernetes/addons/dns.nix b/nixos/modules/services/cluster/kubernetes/addons/dns.nix
index 24d86628b211..8f937a13231b 100644
--- a/nixos/modules/services/cluster/kubernetes/addons/dns.nix
+++ b/nixos/modules/services/cluster/kubernetes/addons/dns.nix
@@ -60,6 +60,45 @@ in {
sha256 = "02r440xcdsgi137k5lmmvp0z5w5fmk8g9mysq5pnysq1wl8sj6mw";
};
};
+
+ corefile = mkOption {
+ description = ''
+ Custom coredns corefile configuration.
+
+ See: <link xlink:href="https://coredns.io/manual/toc/#configuration"/>.
+ '';
+ type = types.str;
+ default = ''
+ .:${toString ports.dns} {
+ errors
+ health :${toString ports.health}
+ kubernetes ${cfg.clusterDomain} in-addr.arpa ip6.arpa {
+ pods insecure
+ fallthrough in-addr.arpa ip6.arpa
+ }
+ prometheus :${toString ports.metrics}
+ forward . /etc/resolv.conf
+ cache 30
+ loop
+ reload
+ loadbalance
+ }'';
+ defaultText = ''
+ .:${toString ports.dns} {
+ errors
+ health :${toString ports.health}
+ kubernetes ''${config.services.kubernetes.addons.dns.clusterDomain} in-addr.arpa ip6.arpa {
+ pods insecure
+ fallthrough in-addr.arpa ip6.arpa
+ }
+ prometheus :${toString ports.metrics}
+ forward . /etc/resolv.conf
+ cache 30
+ loop
+ reload
+ loadbalance
+ }'';
+ };
};
config = mkIf cfg.enable {
@@ -151,20 +190,7 @@ in {
namespace = "kube-system";
};
data = {
- Corefile = ".:${toString ports.dns} {
- errors
- health :${toString ports.health}
- kubernetes ${cfg.clusterDomain} in-addr.arpa ip6.arpa {
- pods insecure
- fallthrough in-addr.arpa ip6.arpa
- }
- prometheus :${toString ports.metrics}
- forward . /etc/resolv.conf
- cache 30
- loop
- reload
- loadbalance
- }";
+ Corefile = cfg.corefile;
};
};
diff --git a/nixos/modules/services/cluster/kubernetes/pki.nix b/nixos/modules/services/cluster/kubernetes/pki.nix
index d9311d3e3a04..faf951d81574 100644
--- a/nixos/modules/services/cluster/kubernetes/pki.nix
+++ b/nixos/modules/services/cluster/kubernetes/pki.nix
@@ -189,7 +189,7 @@ in
# manually paste it in place. Just symlink.
# otherwise, create the target file, ready for users to insert the token
- mkdir -p $(dirname ${certmgrAPITokenPath})
+ mkdir -p "$(dirname "${certmgrAPITokenPath}")"
if [ -f "${cfsslAPITokenPath}" ]; then
ln -fs "${cfsslAPITokenPath}" "${certmgrAPITokenPath}"
else