local kube = import "k8s/configs/base.libsonnet"; local linuxserver = import "k8s/configs/templates/core/linuxserver.libsonnet"; local WebPort = 9091; local transmissionProbe(delaySeconds) = { httpGet: { path: "/", port: WebPort, }, initialDelaySeconds: delaySeconds, }; local Params = kube.simpleFieldStruct([ "namespace", "name", "filePath", "configClaimName", "torrentFilesClaimName", "incompleteDownloadsClaimName", "downloadsClaimName", "dataNodePort", ]) { local dataInternalPort = 51413, labels: {}, gatekeeperSidecar: null, lsParams: linuxserver.AppParams { name: $.name, namespace: $.namespace, filePath: $.filePath, templatePath: std.thisFile, baseAppName: "transmission", imageName: "linuxserver/transmission", gatekeeperSidecar: $.gatekeeperSidecar, labels+: $.labels, env: linuxserver.Env { others: [ kube.NameVal("S6_KILL_FINISH_MAXTIME", "100000"), ] }, services: [ linuxserver.Service { suffix: "ui", spec: kube.SvcUtil.BasicHttpClusterIpSpec(WebPort) }, linuxserver.Service { suffix: "data", spec: kube.SvcUtil.BasicNodePortSpec(dataInternalPort, $.dataNodePort), }, ], ports: [ kube.DeployUtil.ContainerPort("http", WebPort), ], pvcs: [ linuxserver.Pvc{ name: "config", mountPath: "/config", bindName: $.configClaimName }, linuxserver.Pvc{ name: "incomplete", mountPath: "/downloads/incomplete", bindName: $.incompleteDownloadsClaimName, }, linuxserver.Pvc{ name: "downloads", mountPath: "/downloads/complete", bindName: $.downloadsClaimName, }, linuxserver.Pvc{ name: "torrent-files", mountPath: "/watch", bindName: $.torrentFilesClaimName }, ], resources: { requests: { cpu: "250m", memory: "1000Mi", }, limits: { cpu: "500m", memory: "2000Mi", }, }, livenessProbe: transmissionProbe(/*delaySeconds=*/360), readinessProbe: transmissionProbe(/*delaySeconds=*/120), }, }; local App(params) = linuxserver.App(params.lsParams); { WebPort: WebPort, Params: Params, App(params): App(params), }