Some checks failed
CI / build (push) Failing after 12s
GitOrigin-RevId: 6370f6ea785709295b6abcf9c60717cacf3ac432
137 lines
3.6 KiB
Jsonnet
137 lines
3.6 KiB
Jsonnet
local kube = import "k8s/configs/base.libsonnet";
|
|
local linuxserver = import "k8s/configs/templates/core/linuxserver.libsonnet";
|
|
local images = import "k8s/configs/images.libsonnet";
|
|
|
|
local jellyfinProbe(delaySeconds) = {
|
|
initialDelaySeconds: delaySeconds,
|
|
periodSeconds: 5,
|
|
tcpSocket: {
|
|
port: "http",
|
|
},
|
|
};
|
|
|
|
local WebPort = 8096;
|
|
|
|
local Params = kube.simpleFieldStruct([
|
|
"namespace",
|
|
"name",
|
|
"filePath",
|
|
"configClaimName",
|
|
"serialClaimName",
|
|
"filmClaimName",
|
|
"transcodeClaimName",
|
|
]) {
|
|
labels: {},
|
|
gpuNodeSelectorName: "nvidia",
|
|
gatekeeperSidecar: null,
|
|
animeSeriesClaimName: null,
|
|
animeMovieClaimName: null,
|
|
lsParams: linuxserver.AppParams {
|
|
name: $.name,
|
|
namespace: $.namespace,
|
|
filePath: $.filePath,
|
|
templatePath: std.thisFile,
|
|
baseAppName: "jellyfin",
|
|
imageName: "linuxserver/jellyfin",
|
|
imagePullSecrets: ["regcred5"],
|
|
gatekeeperSidecar: $.gatekeeperSidecar,
|
|
labels+: $.labels,
|
|
isPrivileged: true,
|
|
nodeSelector: {
|
|
"gpu": $.gpuNodeSelectorName,
|
|
},
|
|
services: [
|
|
linuxserver.Service {
|
|
suffix: "ui",
|
|
spec: kube.SvcUtil.BasicHttpClusterIpSpec(WebPort)
|
|
},
|
|
],
|
|
env: linuxserver.Env {
|
|
others: [
|
|
kube.NameVal("LD_LIBRARY_PATH", "/usr/local/nvidia/lib:/usr/local/nvidia/lib64"),
|
|
kube.NameVal("NVIDIA_VISIBLE_DEVICES", "all"),
|
|
kube.NameVal("NVIDIA_DRIVER_CAPABILITIES", "all"),
|
|
kube.NameVal("JELLYFIN_FFmpeg__probesize", "500000000"),
|
|
kube.NameVal("JELLYFIN_FFmpeg__analyzeduration", "2000000000"),
|
|
]
|
|
},
|
|
ports: [ kube.DeployUtil.ContainerPort("http", WebPort), ],
|
|
pvcs: [
|
|
linuxserver.Pvc{
|
|
name: "jellyfin-config",
|
|
mountPath: "/config",
|
|
bindName: $.configClaimName,
|
|
},
|
|
linuxserver.Pvc{
|
|
name: "serial-pool",
|
|
mountPath: "/data/tvshows",
|
|
bindName: $.serialClaimName,
|
|
},
|
|
linuxserver.Pvc{
|
|
name: "film-pool",
|
|
mountPath: "/data/movies",
|
|
bindName: $.filmClaimName,
|
|
},
|
|
linuxserver.Pvc{
|
|
name: "jellyfin-transcode",
|
|
mountPath: "/transcode",
|
|
bindName: $.transcodeClaimName,
|
|
},
|
|
] + if $.animeSeriesClaimName == null then [] else [
|
|
linuxserver.Pvc{
|
|
name: "anime-series",
|
|
mountPath: "/data/anime-series",
|
|
bindName: $.animeSeriesClaimName,
|
|
},
|
|
] + if $.animeMovieClaimName == null then [] else [
|
|
linuxserver.Pvc{
|
|
name: "anime-movies",
|
|
mountPath: "/data/anime-movies",
|
|
bindName: $.animeMovieClaimName,
|
|
},
|
|
],
|
|
hostPaths: [
|
|
linuxserver.HostPath{
|
|
name: "nvidia-nvidia-uvm",
|
|
hostPath: "/dev/nvidia-uvm",
|
|
mountPath: "/dev/nvidia-uvm",
|
|
},
|
|
linuxserver.HostPath{
|
|
name: "nvidia-nvidia0",
|
|
hostPath: "/dev/nvidia0",
|
|
mountPath: "/dev/nvidia0",
|
|
},
|
|
linuxserver.HostPath{
|
|
name: "nvidia-nvidiactl",
|
|
hostPath: "/dev/nvidiactl",
|
|
mountPath: "/dev/nvidiactl",
|
|
},
|
|
linuxserver.HostPath{
|
|
name: "nvidia-drivers",
|
|
hostPath: "/opt/nvidia/current/usr",
|
|
mountPath: "/usr/local/nvidia",
|
|
readOnly: true,
|
|
},
|
|
],
|
|
resources: {
|
|
limits: {
|
|
cpu: "1000m",
|
|
memory: "3Gi",
|
|
},
|
|
requests: {
|
|
cpu: "500m",
|
|
memory: "1Gi",
|
|
},
|
|
},
|
|
livenessProbe: jellyfinProbe(/*delaySeconds=*/60),
|
|
readinessProbe: jellyfinProbe(/*delaySeconds=*/60),
|
|
},
|
|
};
|
|
|
|
local App(params) = linuxserver.App(params.lsParams);
|
|
|
|
{
|
|
WebPort: WebPort,
|
|
Params: Params,
|
|
App(params): App(params),
|
|
}
|