feat(dnsmasq): Move to dns k8s namespace

refactor(pihole): Move to dns k8s namespace
This commit is contained in:
Pim Kunis 2024-07-17 10:25:23 +02:00
parent e9307da90d
commit 342ba2baeb
6 changed files with 29 additions and 32 deletions

View file

@ -68,6 +68,7 @@ Currently, the applications being deployed like this are:
- `immich` - `immich`
- `attic` - `attic`
- `inbucket` - `inbucket`
- `dnsmasq`
## Known bugs ## Known bugs

View file

@ -89,11 +89,13 @@
kubenix.syncthing = mkDeployScriptAndManifest kubenix.syncthing = mkDeployScriptAndManifest
"${self}/kubenix-modules/syncthing.nix" "syncthing" "syncthing"; "${self}/kubenix-modules/syncthing.nix" "syncthing" "syncthing";
kubenix.pihole = mkDeployScriptAndManifest kubenix.pihole = mkDeployScriptAndManifest
"${self}/kubenix-modules/pihole.nix" "pihole" "pihole"; "${self}/kubenix-modules/pihole.nix" "pihole" "dns";
kubenix.immich = mkDeployScriptAndManifest kubenix.immich = mkDeployScriptAndManifest
"${self}/kubenix-modules/immich.nix" "immich" "immich"; "${self}/kubenix-modules/immich.nix" "immich" "immich";
kubenix.attic = mkDeployScriptAndManifest kubenix.attic = mkDeployScriptAndManifest
"${self}/kubenix-modules/attic.nix" "attic" "attic"; "${self}/kubenix-modules/attic.nix" "attic" "attic";
kubenix.inbucket = mkDeployScriptAndManifest kubenix.inbucket = mkDeployScriptAndManifest
"${self}/kubenix-modules/inbucket.nix" "inbucket" "inbucket"; "${self}/kubenix-modules/inbucket.nix" "inbucket" "inbucket";
kubenix.dnsmasq = mkDeployScriptAndManifest
"${self}/kubenix-modules/dnsmasq.nix" "dnsmasq" "dns";
}) })

View file

@ -2,7 +2,6 @@ let
applications = [ applications = [
./media.nix ./media.nix
./bind9 ./bind9
./dnsmasq.nix
# ./argo.nix # ./argo.nix
# ./minecraft.nix # ./minecraft.nix
]; ];

View file

@ -72,10 +72,10 @@
forgejo = { }; forgejo = { };
paperless = { }; paperless = { };
syncthing = { }; syncthing = { };
pihole = { };
immich = { }; immich = { };
attic = { }; attic = { };
inbucket = { }; inbucket = { };
dns = { };
}; };
nodes = nodes =

View file

@ -1,6 +1,5 @@
{ myLib, ... }: { { myLib, ... }: {
kubernetes.resources = { kubernetes.resources = {
# TODO: generate this with nix?
configMaps.dnsmasq-config.data.config = '' configMaps.dnsmasq-config.data.config = ''
address=/kms.kun.is/${myLib.globals.kmsIPv4} address=/kms.kun.is/${myLib.globals.kmsIPv4}
address=/ssh.git.kun.is/${myLib.globals.gitIPv4} address=/ssh.git.kun.is/${myLib.globals.gitIPv4}
@ -16,33 +15,29 @@
server=/kun.is/${myLib.globals.bind9IPv4} server=/kun.is/${myLib.globals.bind9IPv4}
''; '';
deployments.dnsmasq = { deployments.dnsmasq.spec = {
metadata.labels.app = "dnsmasq"; selector.matchLabels.app = "dnsmasq";
spec = { template = {
selector.matchLabels.app = "dnsmasq"; metadata.labels.app = "dnsmasq";
template = { spec = {
metadata.labels.app = "dnsmasq"; containers.dnsmasq = {
image = "dockurr/dnsmasq:2.90";
spec = { ports.dns = {
containers.dnsmasq = { containerPort = 53;
image = "dockurr/dnsmasq:2.90"; protocol = "UDP";
ports.dns = {
containerPort = 53;
protocol = "UDP";
};
volumeMounts = [{
name = "config";
mountPath = "/etc/dnsmasq.conf";
subPath = "config";
}];
}; };
volumes.config.configMap.name = "dnsmasq-config"; volumeMounts = [{
name = "config";
mountPath = "/etc/dnsmasq.conf";
subPath = "config";
}];
}; };
volumes.config.configMap.name = "dnsmasq-config";
}; };
}; };
}; };

View file

@ -44,8 +44,8 @@
}; };
volumes = { volumes = {
data.persistentVolumeClaim.claimName = "data"; data.persistentVolumeClaim.claimName = "pihole-data";
dnsmasq.persistentVolumeClaim.claimName = "dnsmasq"; dnsmasq.persistentVolumeClaim.claimName = "pihole-dnsmasq";
}; };
securityContext = { securityContext = {
@ -57,7 +57,7 @@
}; };
services = { services = {
web.spec = { pihole-web.spec = {
selector.app = "pihole"; selector.app = "pihole";
ports.web = { ports.web = {
@ -66,7 +66,7 @@
}; };
}; };
dns.spec = { pihole-dns.spec = {
type = "LoadBalancer"; type = "LoadBalancer";
loadBalancerIP = myLib.globals.piholeIPv4; loadBalancerIP = myLib.globals.piholeIPv4;
selector.app = "pihole"; selector.app = "pihole";
@ -86,18 +86,18 @@
entrypoint = "localsecure"; entrypoint = "localsecure";
service = { service = {
name = "web"; name = "pihole-web";
portName = "web"; portName = "web";
}; };
}; };
longhorn.persistentVolumeClaim = { longhorn.persistentVolumeClaim = {
data = { pihole-data = {
volumeName = "pihole-data"; volumeName = "pihole-data";
storage = "750Mi"; storage = "750Mi";
}; };
dnsmasq = { pihole-dnsmasq = {
volumeName = "pihole-dnsmasq"; volumeName = "pihole-dnsmasq";
storage = "16Mi"; storage = "16Mi";
}; };