local kube = import "k8s/configs/base.libsonnet"; local linuxserver = import "k8s/configs/templates/core/linuxserver.libsonnet"; local images = import "k8s/configs/images.libsonnet"; local medusaProbe(delaySeconds) = { initialDelaySeconds: delaySeconds, periodSeconds: 20, tcpSocket: { port: "http", }, }; local WebPort = 8081; local Params = kube.simpleFieldStruct([ "namespace", "name", "filePath", "configClaimName", "downloadsClaimName", "tvSeriesClaimName", "torrentFilesClaimName", ]) { labels: {}, gatekeeperSidecar: null, lsParams: linuxserver.AppParams { name: $.name, namespace: $.namespace, filePath: $.filePath, templatePath: std.thisFile, baseAppName: "medusa", imageName: "linuxserver/medusa", labels+: $.labels, gatekeeperSidecar: $.gatekeeperSidecar, services: [ linuxserver.Service { suffix: "ui", spec: kube.SvcUtil.BasicHttpClusterIpSpec(WebPort) }, ], ports: [ kube.DeployUtil.ContainerPort("http", WebPort), ], pvcs: [ linuxserver.Pvc{ name: "medusa-config", mountPath: "/config", mountSubPath: "medusa", bindName: $.configClaimName, }, linuxserver.Pvc{ name: "downloads", mountPath: "/downloads", mountSubPath: "out", bindName: $.downloadsClaimName, }, linuxserver.Pvc{ name: "tv-series", mountPath: "/tv", bindName: $.tvSeriesClaimName, }, // NOTE: This needs manual configuration in the UI linuxserver.Pvc{ name: "torrent-files", mountPath: "/torrent-files", bindName: $.torrentFilesClaimName, }, ], resources: { requests: { cpu: "10m", memory: "500Mi", }, limits: { cpu: "400m", memory: "1000Mi", }, }, livenessProbe: medusaProbe(/*delaySeconds=*/60), readinessProbe: medusaProbe(/*delaySeconds=*/60), }, }; local App(params) = linuxserver.App(params.lsParams); { WebPort: WebPort, Params: Params, App(params): App(params), }