yesod-mirror/k8s/configs/templates/personal/home/paperless-ng.libsonnet

101 lines
2.4 KiB
Jsonnet
Raw Normal View History

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 = 8000;
local Params = kube.simpleFieldStruct([
"namespace",
"name",
"filePath",
"configClaimName",
"dataClaimName",
"redisHost",
"postgresHost",
"postgresPwdSecret",
"postgresPwdSecretKey",
]) {
postgresDbName: "paperless",
postgresDbUser: "paperless",
labels: {},
gatekeeperSidecar: null,
lsParams: linuxserver.AppParams {
name: $.name,
namespace: $.namespace,
filePath: $.filePath,
templatePath: std.thisFile,
baseAppName: "paperless-ngx",
imageName: "linuxserver/paperless-ngx",
labels+: $.labels,
gatekeeperSidecar: $.gatekeeperSidecar,
services: [
linuxserver.Service {
suffix: "ui",
spec: kube.SvcUtil.BasicHttpClusterIpSpec(WebPort)
},
],
ports: [ kube.DeployUtil.ContainerPort("http", WebPort), ],
env: linuxserver.Env {
others: [
// For NFS
kube.NameVal("PAPERLESS_CONSUMER_POLLING", "10"),
kube.NameVal("PAPERLESS_REDIS", $.redisHost),
kube.NameVal("PAPERLESS_CONSUMPTION_DIR", "/data/consume"),
kube.NameVal("PAPERLESS_URL", "https://paperless.csbx.dev"),
kube.NameVal("PAPERLESS_DBENGINE", "postgresql"),
kube.NameVal("PAPERLESS_DBHOST", $.postgresHost),
{
name: "PAPERLESS_DBPASS",
valueFrom: {
secretKeyRef: {
name: $.postgresPwdSecret,
key: $.postgresPwdSecretKey ,
}
}
},
]
},
pvcs: [
linuxserver.Pvc{
name: "config",
mountPath: "/config",
bindName: $.configClaimName,
},
linuxserver.Pvc{
name: "data",
mountPath: "/data",
bindName: $.dataClaimName,
},
],
resources: {
requests: {
cpu: "200m",
memory: "500Mi",
},
limits: {
cpu: "800m",
memory: "1500Mi",
},
},
livenessProbe: probe(/*delaySeconds=*/40),
readinessProbe: probe(/*delaySeconds=*/40),
},
};
local App(params) = linuxserver.App(params.lsParams);
{
WebPort: WebPort,
Params: Params,
App(params): App(params),
}