kubernetes-deployments/modules/dnsmasq.nix
Pim Kunis 8e09ef5c1e Create helper function to create NixNG images
Move NixNG images to separate directory
2024-10-01 22:51:08 +02:00

37 lines
928 B
Nix

{ self, utils, globals, config, lib, ... }: {
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";
spec.containers.dnsmasq = {
image = utils.nixSnapshotterRef (utils.mkNixNGImage "dnsmasq" "${self}/images/dnsmasq.nix");
imagePullPolicy = "Always";
ports.dns = {
containerPort = 53;
protocol = "UDP";
};
};
};
};
services.dnsmasq.spec = {
loadBalancerIP = globals.dnsmasqIPv4;
type = "LoadBalancer";
selector.app = "dnsmasq";
ports.dns = {
port = 53;
targetPort = "dns";
protocol = "UDP";
};
};
};
};
}