feat(media): Move to separate k8s namespace

This commit is contained in:
Pim Kunis 2024-07-17 11:59:48 +02:00
parent 7b1958e5c5
commit c7624baa78
6 changed files with 362 additions and 370 deletions

View file

@ -70,6 +70,7 @@ Currently, the applications being deployed like this are:
- `inbucket` - `inbucket`
- `dnsmasq` - `dnsmasq`
- `bind9` - `bind9`
- `media`
## Known bugs ## Known bugs

View file

@ -100,4 +100,6 @@
"${self}/kubenix-modules/dnsmasq.nix" "dnsmasq" "dns"; "${self}/kubenix-modules/dnsmasq.nix" "dnsmasq" "dns";
kubenix.bind9 = mkDeployScriptAndManifest kubenix.bind9 = mkDeployScriptAndManifest
"${self}/kubenix-modules/bind9" "bind9" "dns"; "${self}/kubenix-modules/bind9" "bind9" "dns";
kubenix.media = mkDeployScriptAndManifest
"${self}/kubenix-modules/media.nix" "media" "media";
}) })

View file

@ -1,12 +1,7 @@
let
applications = [
./media.nix
# ./argo.nix
# ./minecraft.nix
];
in
{ {
imports = [ imports = [
# ./argo.nix
# ./minecraft.nix
./base.nix ./base.nix
./longhorn.nix ./longhorn.nix
./esrom.nix ./esrom.nix
@ -17,5 +12,5 @@ in
./traefik.nix ./traefik.nix
./volumes.nix ./volumes.nix
./custom-types.nix ./custom-types.nix
] ++ applications; ];
} }

View file

@ -44,17 +44,16 @@
longhorn = { longhorn = {
chart = nixhelm.chartsDerivations.${system}.longhorn.longhorn; chart = nixhelm.chartsDerivations.${system}.longhorn.longhorn;
includeCRDs = true; includeCRDs = true;
values = { values = {
persistence.defaultClassReplicaCount = 2;
defaultSettings = { defaultSettings = {
defaultDataPath = "/mnt/longhorn"; defaultDataPath = "/mnt/longhorn";
storageMinimalAvailablePercentage = 0; storageMinimalAvailablePercentage = 0;
allowRecurringJobWhileVolumeDetached = true; allowRecurringJobWhileVolumeDetached = true;
backupTarget = "nfs://lewis.dmz:/mnt/longhorn/persistent/longhorn-backup"; backupTarget = "nfs://lewis.dmz:/mnt/longhorn/persistent/longhorn-backup";
}; };
persistence = {
defaultClassReplicaCount = 2;
};
}; };
}; };
}; };
@ -76,6 +75,7 @@
attic = { }; attic = { };
inbucket = { }; inbucket = { };
dns = { }; dns = { };
media = { };
}; };
nodes = nodes =

View file

@ -1,51 +1,7 @@
{ myLib, ... }: { { myLib, ... }: {
kubernetes.resources = { kubernetes.resources = {
configMaps = {
jellyfin-env.data.JELLYFIN_PublishedServerUrl = "https://media.kun.is";
transmission-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
jellyseerr-env.data = {
LOG_LEVEL = "debug";
TZ = "Europe/Amsterdam";
};
radarr-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
prowlarr-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
sonarr-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
bazarr-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
};
deployments = { deployments = {
jellyfin = { jellyfin.spec = {
metadata.labels = {
app = "media";
component = "jellyfin";
};
spec = {
selector.matchLabels = { selector.matchLabels = {
app = "media"; app = "media";
component = "jellyfin"; component = "jellyfin";
@ -69,10 +25,11 @@
spec = { spec = {
containers.jellyfin = { containers.jellyfin = {
image = "jellyfin/jellyfin:10.9.7"; image = "jellyfin/jellyfin:10.9.7";
envFrom = [{ configMapRef.name = "jellyfin-env"; }];
ports.web.containerPort = 8096; ports.web.containerPort = 8096;
imagePullPolicy = "Always"; imagePullPolicy = "Always";
env.JELLYFIN_PublishedServerUrl.value = "https://media.kun.is";
volumeMounts = [ volumeMounts = [
{ {
name = "config"; name = "config";
@ -114,15 +71,8 @@
}; };
}; };
}; };
};
transmission = { transmission.spec = {
metadata.labels = {
app = "media";
component = "transmission";
};
spec = {
selector.matchLabels = { selector.matchLabels = {
app = "media"; app = "media";
component = "transmission"; component = "transmission";
@ -146,7 +96,6 @@
spec = { spec = {
containers.transmission = { containers.transmission = {
image = "lscr.io/linuxserver/transmission:4.0.6"; image = "lscr.io/linuxserver/transmission:4.0.6";
envFrom = [{ configMapRef.name = "transmission-env"; }];
imagePullPolicy = "Always"; imagePullPolicy = "Always";
ports = { ports = {
@ -154,6 +103,12 @@
bittorrent.containerPort = 31780; bittorrent.containerPort = 31780;
}; };
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [ volumeMounts = [
{ {
name = "config"; name = "config";
@ -178,15 +133,8 @@
}; };
}; };
}; };
};
jellyseerr = { jellyseerr.spec = {
metadata.labels = {
app = "media";
component = "jellyseerr";
};
spec = {
selector.matchLabels = { selector.matchLabels = {
app = "media"; app = "media";
component = "jellyseerr"; component = "jellyseerr";
@ -212,10 +160,14 @@
containers.jellyseerr = { containers.jellyseerr = {
image = "fallenbagel/jellyseerr:1.9.2"; image = "fallenbagel/jellyseerr:1.9.2";
envFrom = [{ configMapRef.name = "jellyseerr-env"; }];
ports.web.containerPort = 5055; ports.web.containerPort = 5055;
imagePullPolicy = "Always"; imagePullPolicy = "Always";
env = {
LOG_LEVEL.value = "debug";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [{ volumeMounts = [{
name = "config"; name = "config";
mountPath = "/app/config"; mountPath = "/app/config";
@ -229,15 +181,8 @@
}; };
}; };
}; };
};
radarr = { radarr.spec = {
metadata.labels = {
app = "media";
component = "radarr";
};
spec = {
selector.matchLabels = { selector.matchLabels = {
app = "media"; app = "media";
component = "radarr"; component = "radarr";
@ -261,10 +206,15 @@
spec = { spec = {
containers.radarr = { containers.radarr = {
image = "lscr.io/linuxserver/radarr:5.7.0"; image = "lscr.io/linuxserver/radarr:5.7.0";
envFrom = [{ configMapRef.name = "radarr-env"; }];
ports.web.containerPort = 7878; ports.web.containerPort = 7878;
imagePullPolicy = "Always"; imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [ volumeMounts = [
{ {
name = "config"; name = "config";
@ -289,15 +239,8 @@
}; };
}; };
}; };
};
prowlarr = { prowlarr.spec = {
metadata.labels = {
app = "media";
component = "prowlarr";
};
spec = {
selector.matchLabels = { selector.matchLabels = {
app = "media"; app = "media";
component = "prowlarr"; component = "prowlarr";
@ -323,10 +266,15 @@
containers.prowlarr = { containers.prowlarr = {
image = "lscr.io/linuxserver/prowlarr:1.20.1"; image = "lscr.io/linuxserver/prowlarr:1.20.1";
envFrom = [{ configMapRef.name = "prowlarr-env"; }];
ports.web.containerPort = 9696; ports.web.containerPort = 9696;
imagePullPolicy = "Always"; imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [{ volumeMounts = [{
name = "config"; name = "config";
mountPath = "/config"; mountPath = "/config";
@ -340,15 +288,8 @@
}; };
}; };
}; };
};
sonarr = { sonarr.spec = {
metadata.labels = {
app = "media";
component = "sonarr";
};
spec = {
selector.matchLabels = { selector.matchLabels = {
app = "media"; app = "media";
component = "sonarr"; component = "sonarr";
@ -372,10 +313,15 @@
spec = { spec = {
containers.sonarr = { containers.sonarr = {
image = "lscr.io/linuxserver/sonarr:4.0.6"; image = "lscr.io/linuxserver/sonarr:4.0.6";
envFrom = [{ configMapRef.name = "sonarr-env"; }];
ports.web.containerPort = 8989; ports.web.containerPort = 8989;
imagePullPolicy = "Always"; imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [ volumeMounts = [
{ {
name = "config"; name = "config";
@ -400,15 +346,8 @@
}; };
}; };
}; };
};
bazarr = { bazarr.spec = {
metadata.labels = {
app = "media";
component = "bazarr";
};
spec = {
selector.matchLabels = { selector.matchLabels = {
app = "media"; app = "media";
component = "bazarr"; component = "bazarr";
@ -432,10 +371,15 @@
spec = { spec = {
containers.bazarr = { containers.bazarr = {
image = "lscr.io/linuxserver/bazarr:1.4.3"; image = "lscr.io/linuxserver/bazarr:1.4.3";
envFrom = [{ configMapRef.name = "bazarr-env"; }];
ports.web.containerPort = 6767; ports.web.containerPort = 6767;
imagePullPolicy = "Always"; imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [ volumeMounts = [
{ {
name = "config"; name = "config";
@ -461,7 +405,6 @@
}; };
}; };
}; };
};
services = { services = {
jellyfin.spec = { jellyfin.spec = {
@ -564,10 +507,19 @@
}; };
}; };
persistentVolumeClaims.jellyfin-cache.spec = { persistentVolumeClaims = {
jellyfin-cache.spec = {
accessModes = [ "ReadWriteOnce" ]; accessModes = [ "ReadWriteOnce" ];
resources.requests.storage = "20Gi"; resources.requests.storage = "20Gi";
}; };
media.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "media-media";
};
};
}; };
lab = { lab = {
@ -641,5 +593,42 @@
}; };
}; };
}; };
longhorn.persistentVolumeClaim = {
jellyfin = {
volumeName = "jellyfin";
storage = "5Gi";
};
transmission = {
volumeName = "transmission";
storage = "25Mi";
};
jellyseerr = {
volumeName = "jellyseerr";
storage = "75Mi";
};
radarr = {
volumeName = "radarr";
storage = "300Mi";
};
prowlarr = {
volumeName = "prowlarr";
storage = "150Mi";
};
sonarr = {
volumeName = "sonarr";
storage = "150Mi";
};
bazarr = {
volumeName = "bazarr";
storage = "25Mi";
};
};
}; };
} }

View file

@ -12,7 +12,8 @@
# volumes.freshrss.persistentVolumeClaim.claimName = "freshrss"; # volumes.freshrss.persistentVolumeClaim.claimName = "freshrss";
# }; # };
kubernetes.resources.persistentVolumes.music-syncthing.spec = { kubernetes.resources.persistentVolumes = {
music-syncthing.spec = {
capacity.storage = "1Gi"; capacity.storage = "1Gi";
accessModes = [ "ReadWriteMany" ]; accessModes = [ "ReadWriteMany" ];
@ -22,17 +23,19 @@
}; };
}; };
lab = { media-media.spec = {
longhornVolumes = { capacity.storage = "1Gi";
minecraft.storage = "1Gi"; accessModes = [ "ReadWriteMany" ];
jellyfin.storage = "5Gi";
transmission.storage = "25Mi"; nfs = {
jellyseerr.storage = "75Mi"; server = "lewis.dmz";
radarr.storage = "300Mi"; path = "/mnt/longhorn/persistent/media";
prowlarr.storage = "150Mi";
sonarr.storage = "150Mi";
bazarr.storage = "25Mi";
}; };
};
};
lab = {
longhornVolumes.minecraft.storage = "1Gi";
longhorn.persistentVolume = { longhorn.persistentVolume = {
freshrss.storage = "1Gi"; freshrss.storage = "1Gi";
@ -55,11 +58,13 @@
immich-db.storage = "5Gi"; immich-db.storage = "5Gi";
attic.storage = "15Gi"; attic.storage = "15Gi";
attic-db.storage = "150Mi"; attic-db.storage = "150Mi";
}; jellyfin.storage = "5Gi";
transmission.storage = "25Mi";
nfsVolumes = { jellyseerr.storage = "75Mi";
media.path = "media"; radarr.storage = "300Mi";
# music.path = "media/music"; prowlarr.storage = "150Mi";
sonarr.storage = "150Mi";
bazarr.storage = "25Mi";
}; };
}; };
} }