depot/cluster/services/dns/default.nix

76 lines
1.7 KiB
Nix
Raw Normal View History

{ config, depot, lib, ... }:
2022-08-07 20:58:37 +03:00
let
2023-08-31 01:55:45 +03:00
inherit (depot) hours;
cfg = config.services.dns;
2022-08-07 20:58:37 +03:00
in
{
imports = [
./options.nix
./nodes.nix
./ns-records.nix
];
2022-08-07 20:58:37 +03:00
links = {
dnsResolver = {
2023-03-07 02:26:07 +02:00
ipv4 = hours.VEGAS.interfaces.vstub.addr;
2022-08-07 20:58:37 +03:00
port = 53;
};
acmeDnsApi = {
hostname = "acme-dns-challenge.internal.${depot.lib.meta.domain}";
2022-08-07 20:58:37 +03:00
protocol = "http";
};
};
hostLinks = lib.mkMerge [
(lib.genAttrs cfg.nodes.authoritative (node: {
dnsAuthoritative = {
ipv4 = hours.${node}.interfaces.primary.addrPublic;
port = 53;
};
acmeDnsApi = {
ipv4 = config.vars.mesh.${node}.meshIp;
inherit (config.links.acmeDnsApi) port;
protocol = "http";
};
}))
(lib.genAttrs cfg.nodes.coredns (node: {
dnsResolver = {
ipv4 = config.vars.mesh.${node}.meshIp;
port = 53;
};
}))
(lib.genAttrs cfg.nodes.coredns (node: {
dnsResolverBackend = {
ipv4 = config.vars.mesh.${node}.meshIp;
};
}))
];
2022-08-07 20:58:37 +03:00
services.dns = {
nodes = {
authoritative = [ "VEGAS" "checkmate" "prophet" ];
coredns = [ "checkmate" "VEGAS" ];
client = [ "checkmate" "grail" "thunderskin" "VEGAS" "prophet" ];
2022-08-07 20:58:37 +03:00
};
nixos = {
authoritative = ./authoritative.nix;
2022-08-07 20:58:37 +03:00
coredns = ./coredns.nix;
client = ./client.nix;
2022-08-07 20:58:37 +03:00
};
};
2023-11-03 00:21:22 +02:00
patroni = {
databases.acmedns = {};
users.acmedns = {
locksmith = {
nodes = config.services.dns.nodes.authoritative;
format = "envFile";
};
};
};
dns.records = {
securedns.consulService = "securedns";
"acme-dns-challenge.internal".consulService = "acme-dns";
};
2022-08-07 20:58:37 +03:00
}