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`
- `dnsmasq`
- `bind9`
- `media`
## Known bugs

View file

@ -100,4 +100,6 @@
"${self}/kubenix-modules/dnsmasq.nix" "dnsmasq" "dns";
kubenix.bind9 = mkDeployScriptAndManifest
"${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 = [
# ./argo.nix
# ./minecraft.nix
./base.nix
./longhorn.nix
./esrom.nix
@ -17,5 +12,5 @@ in
./traefik.nix
./volumes.nix
./custom-types.nix
] ++ applications;
];
}

View file

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

View file

@ -1,51 +1,7 @@
{ myLib, ... }: {
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 = {
jellyfin = {
metadata.labels = {
app = "media";
component = "jellyfin";
};
spec = {
jellyfin.spec = {
selector.matchLabels = {
app = "media";
component = "jellyfin";
@ -69,10 +25,11 @@
spec = {
containers.jellyfin = {
image = "jellyfin/jellyfin:10.9.7";
envFrom = [{ configMapRef.name = "jellyfin-env"; }];
ports.web.containerPort = 8096;
imagePullPolicy = "Always";
env.JELLYFIN_PublishedServerUrl.value = "https://media.kun.is";
volumeMounts = [
{
name = "config";
@ -114,15 +71,8 @@
};
};
};
};
transmission = {
metadata.labels = {
app = "media";
component = "transmission";
};
spec = {
transmission.spec = {
selector.matchLabels = {
app = "media";
component = "transmission";
@ -146,7 +96,6 @@
spec = {
containers.transmission = {
image = "lscr.io/linuxserver/transmission:4.0.6";
envFrom = [{ configMapRef.name = "transmission-env"; }];
imagePullPolicy = "Always";
ports = {
@ -154,6 +103,12 @@
bittorrent.containerPort = 31780;
};
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [
{
name = "config";
@ -178,15 +133,8 @@
};
};
};
};
jellyseerr = {
metadata.labels = {
app = "media";
component = "jellyseerr";
};
spec = {
jellyseerr.spec = {
selector.matchLabels = {
app = "media";
component = "jellyseerr";
@ -212,10 +160,14 @@
containers.jellyseerr = {
image = "fallenbagel/jellyseerr:1.9.2";
envFrom = [{ configMapRef.name = "jellyseerr-env"; }];
ports.web.containerPort = 5055;
imagePullPolicy = "Always";
env = {
LOG_LEVEL.value = "debug";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [{
name = "config";
mountPath = "/app/config";
@ -229,15 +181,8 @@
};
};
};
};
radarr = {
metadata.labels = {
app = "media";
component = "radarr";
};
spec = {
radarr.spec = {
selector.matchLabels = {
app = "media";
component = "radarr";
@ -261,10 +206,15 @@
spec = {
containers.radarr = {
image = "lscr.io/linuxserver/radarr:5.7.0";
envFrom = [{ configMapRef.name = "radarr-env"; }];
ports.web.containerPort = 7878;
imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [
{
name = "config";
@ -289,15 +239,8 @@
};
};
};
};
prowlarr = {
metadata.labels = {
app = "media";
component = "prowlarr";
};
spec = {
prowlarr.spec = {
selector.matchLabels = {
app = "media";
component = "prowlarr";
@ -323,10 +266,15 @@
containers.prowlarr = {
image = "lscr.io/linuxserver/prowlarr:1.20.1";
envFrom = [{ configMapRef.name = "prowlarr-env"; }];
ports.web.containerPort = 9696;
imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [{
name = "config";
mountPath = "/config";
@ -340,15 +288,8 @@
};
};
};
};
sonarr = {
metadata.labels = {
app = "media";
component = "sonarr";
};
spec = {
sonarr.spec = {
selector.matchLabels = {
app = "media";
component = "sonarr";
@ -372,10 +313,15 @@
spec = {
containers.sonarr = {
image = "lscr.io/linuxserver/sonarr:4.0.6";
envFrom = [{ configMapRef.name = "sonarr-env"; }];
ports.web.containerPort = 8989;
imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [
{
name = "config";
@ -400,15 +346,8 @@
};
};
};
};
bazarr = {
metadata.labels = {
app = "media";
component = "bazarr";
};
spec = {
bazarr.spec = {
selector.matchLabels = {
app = "media";
component = "bazarr";
@ -432,10 +371,15 @@
spec = {
containers.bazarr = {
image = "lscr.io/linuxserver/bazarr:1.4.3";
envFrom = [{ configMapRef.name = "bazarr-env"; }];
ports.web.containerPort = 6767;
imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [
{
name = "config";
@ -461,7 +405,6 @@
};
};
};
};
services = {
jellyfin.spec = {
@ -564,10 +507,19 @@
};
};
persistentVolumeClaims.jellyfin-cache.spec = {
persistentVolumeClaims = {
jellyfin-cache.spec = {
accessModes = [ "ReadWriteOnce" ];
resources.requests.storage = "20Gi";
};
media.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "media-media";
};
};
};
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";
# };
kubernetes.resources.persistentVolumes.music-syncthing.spec = {
kubernetes.resources.persistentVolumes = {
music-syncthing.spec = {
capacity.storage = "1Gi";
accessModes = [ "ReadWriteMany" ];
@ -22,17 +23,19 @@
};
};
lab = {
longhornVolumes = {
minecraft.storage = "1Gi";
jellyfin.storage = "5Gi";
transmission.storage = "25Mi";
jellyseerr.storage = "75Mi";
radarr.storage = "300Mi";
prowlarr.storage = "150Mi";
sonarr.storage = "150Mi";
bazarr.storage = "25Mi";
media-media.spec = {
capacity.storage = "1Gi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.dmz";
path = "/mnt/longhorn/persistent/media";
};
};
};
lab = {
longhornVolumes.minecraft.storage = "1Gi";
longhorn.persistentVolume = {
freshrss.storage = "1Gi";
@ -55,11 +58,13 @@
immich-db.storage = "5Gi";
attic.storage = "15Gi";
attic-db.storage = "150Mi";
};
nfsVolumes = {
media.path = "media";
# music.path = "media/music";
jellyfin.storage = "5Gi";
transmission.storage = "25Mi";
jellyseerr.storage = "75Mi";
radarr.storage = "300Mi";
prowlarr.storage = "150Mi";
sonarr.storage = "150Mi";
bazarr.storage = "25Mi";
};
};
}