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