2024-10-01 20:51:08 +00:00
|
|
|
{ self, utils, globals, config, lib, ... }: {
|
2024-09-07 10:35:02 +00:00
|
|
|
options.dnsmasq.enable = lib.mkEnableOption "dnsmasq";
|
|
|
|
|
|
|
|
config = lib.mkIf config.dnsmasq.enable {
|
|
|
|
kubernetes.resources = {
|
|
|
|
deployments.dnsmasq.spec = {
|
|
|
|
selector.matchLabels.app = "dnsmasq";
|
|
|
|
|
|
|
|
template = {
|
|
|
|
metadata.labels.app = "dnsmasq";
|
|
|
|
|
2024-09-17 11:22:02 +00:00
|
|
|
spec.containers.dnsmasq = {
|
2024-10-01 20:51:08 +00:00
|
|
|
image = utils.nixSnapshotterRef (utils.mkNixNGImage "dnsmasq" "${self}/images/dnsmasq.nix");
|
2024-09-17 11:22:02 +00:00
|
|
|
imagePullPolicy = "Always";
|
2024-09-07 10:35:02 +00:00
|
|
|
|
2024-09-17 11:22:02 +00:00
|
|
|
ports.dns = {
|
|
|
|
containerPort = 53;
|
|
|
|
protocol = "UDP";
|
2024-09-07 10:35:02 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.dnsmasq.spec = {
|
|
|
|
loadBalancerIP = globals.dnsmasqIPv4;
|
|
|
|
type = "LoadBalancer";
|
|
|
|
selector.app = "dnsmasq";
|
|
|
|
|
|
|
|
ports.dns = {
|
|
|
|
port = 53;
|
|
|
|
targetPort = "dns";
|
|
|
|
protocol = "UDP";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|