nixos-servers/kubenix-modules/pihole.nix

109 lines
2.3 KiB
Nix
Raw Normal View History

{ myLib, ... }: {
kubernetes.resources = {
2024-06-15 20:27:07 +00:00
secrets.pihole.stringData.webPassword = "ref+sops://secrets/kubernetes.yaml#/pihole/password";
deployments.pihole.spec = {
selector.matchLabels.app = "pihole";
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels.app = "pihole";
spec = {
containers.pihole = {
2024-07-30 19:28:35 +00:00
image = myLib.globals.images.pihole;
env = {
TZ.value = "Europe/Amsterdam";
PIHOLE_DNS_.value = "192.168.30.1";
WEBPASSWORD.valueFrom.secretKeyRef = {
2024-04-14 19:00:15 +00:00
name = "pihole";
key = "webPassword";
};
};
ports = {
web.containerPort = 80;
2024-05-23 18:11:04 +00:00
dns = {
containerPort = 53;
protocol = "UDP";
};
2024-05-23 18:11:04 +00:00
};
volumeMounts = [
{
name = "data";
mountPath = "/etc/pihole";
}
{
name = "dnsmasq";
mountPath = "/etc/dnsmasq.d";
}
];
};
volumes = {
data.persistentVolumeClaim.claimName = "pihole-data";
dnsmasq.persistentVolumeClaim.claimName = "pihole-dnsmasq";
};
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
services = {
2024-07-21 18:02:40 +00:00
pihole.spec = {
type = "LoadBalancer";
loadBalancerIP = myLib.globals.piholeIPv4;
selector.app = "pihole";
2024-07-21 18:02:40 +00:00
ports = {
dns = {
protocol = "UDP";
port = 53;
targetPort = "dns";
};
web = {
port = 80;
targetPort = "web";
};
2024-04-14 19:43:31 +00:00
};
};
};
};
lab = {
longhorn.persistentVolumeClaim = {
pihole-data = {
volumeName = "pihole-data";
storage = "750Mi";
};
pihole-dnsmasq = {
volumeName = "pihole-dnsmasq";
storage = "16Mi";
};
};
2024-07-21 18:02:40 +00:00
tailscaleIngresses.tailscale-pihole = {
host = "pihole";
service.name = "pihole";
};
};
}