67 lines
1.5 KiB
Jsonnet
67 lines
1.5 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 probe(delaySeconds) = {
|
||
|
|
initialDelaySeconds: delaySeconds,
|
||
|
|
periodSeconds: 30,
|
||
|
|
tcpSocket: {
|
||
|
|
port: "http",
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
local WebPort = 3000;
|
||
|
|
local Params = kube.simpleFieldStruct([
|
||
|
|
"namespace",
|
||
|
|
"name",
|
||
|
|
"filePath",
|
||
|
|
]) {
|
||
|
|
labels: {},
|
||
|
|
gatekeeperSidecar: null,
|
||
|
|
lsParams: linuxserver.AppParams {
|
||
|
|
name: $.name,
|
||
|
|
namespace: $.namespace,
|
||
|
|
filePath: $.filePath,
|
||
|
|
templatePath: std.thisFile,
|
||
|
|
baseAppName: "browserless",
|
||
|
|
imageName: "browserless/chrome",
|
||
|
|
labels+: $.labels,
|
||
|
|
ports: [ kube.DeployUtil.ContainerPort("http", WebPort), ],
|
||
|
|
env: linuxserver.Env {
|
||
|
|
others: [
|
||
|
|
kube.NameVal("MAX_CONCURRENT_SESSIONS", "10"),
|
||
|
|
kube.NameVal("TOKEN", "example-token"),
|
||
|
|
#https://www.browserless.io/docs/docker#securing-your-instance
|
||
|
|
]
|
||
|
|
},
|
||
|
|
services: [
|
||
|
|
linuxserver.Service {
|
||
|
|
suffix: "ui",
|
||
|
|
spec: kube.SvcUtil.BasicHttpClusterIpSpec(WebPort)
|
||
|
|
},
|
||
|
|
],
|
||
|
|
pvcs: [
|
||
|
|
],
|
||
|
|
resources: {
|
||
|
|
requests: {
|
||
|
|
cpu: "500m",
|
||
|
|
memory: "1Gi",
|
||
|
|
},
|
||
|
|
limits: {
|
||
|
|
cpu: "1000m",
|
||
|
|
memory: "2Gi",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
livenessProbe: probe(/*delaySeconds=*/20),
|
||
|
|
readinessProbe: probe(/*delaySeconds=*/20),
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
local App(params) = linuxserver.App(params.lsParams) {};
|
||
|
|
|
||
|
|
{
|
||
|
|
Params: Params,
|
||
|
|
WebPort: WebPort,
|
||
|
|
App(params): App(params),
|
||
|
|
}
|