162 lines
No EOL
4.3 KiB
Jsonnet
162 lines
No EOL
4.3 KiB
Jsonnet
local base = import 'k8s/configs/base.libsonnet';
|
|
|
|
local linuxserver = import 'k8s/configs/templates/core/linuxserver.libsonnet';
|
|
local nginxIngress = import 'k8s/configs/templates/core/network/nginx-ingress.libsonnet';
|
|
|
|
local namespaceName = 'sourcebot';
|
|
local appName = 'sourcebot';
|
|
local WebPort = 3000;
|
|
|
|
local params = linuxserver.AppParams {
|
|
name: appName,
|
|
configMapName: appName,
|
|
baseAppName: appName,
|
|
pvcName: appName + '-data',
|
|
namespace: namespaceName,
|
|
imageName: 'sourcebot',
|
|
filePath: std.thisFile,
|
|
templatePath: std.thisFile,
|
|
authUrl: 'https://sourcebot.csbx.dev',
|
|
ports: [ base.DeployUtil.ContainerPort("http", WebPort), ],
|
|
services: [
|
|
linuxserver.Service {
|
|
suffix: "ui",
|
|
spec: base.SvcUtil.BasicHttpClusterIpSpec(WebPort)
|
|
},
|
|
],
|
|
pvcs: [
|
|
linuxserver.Pvc {
|
|
name: 'data',
|
|
bindName: $.pvcName,
|
|
mountPath: '/data',
|
|
},
|
|
],
|
|
resources: {
|
|
requests: {
|
|
cpu: "1000m",
|
|
memory: "2Gi",
|
|
},
|
|
limits: {
|
|
cpu: "2000m",
|
|
memory: "4Gi",
|
|
},
|
|
},
|
|
configMaps: [
|
|
linuxserver.ConfigMap {
|
|
name: 'config',
|
|
bindName: $.configMapName,
|
|
mountPath: '/etc/sourcebot',
|
|
},
|
|
],
|
|
env+: {
|
|
others+: [
|
|
base.NameVal('CONFIG_PATH', '/etc/sourcebot/config.json'),
|
|
base.NameVal('AUTH_URL', $.authUrl),
|
|
base.NameVal('SOURCEBOT_TELEMETRY_DISABLED', 'true'),
|
|
{
|
|
name: 'GITEA_TOKEN',
|
|
valueFrom: {
|
|
secretKeyRef: {
|
|
name: 'gitea-token',
|
|
key: 'token',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
};
|
|
|
|
{
|
|
namespace: {
|
|
apiVersion: 'v1',
|
|
kind: 'Namespace',
|
|
metadata: {
|
|
name: namespaceName,
|
|
},
|
|
},
|
|
pvc: base.RecoverableSimplePvc(namespaceName, appName + '-data', 'nfs-client', '10Gi', {
|
|
volumeName: "pvc-55405f2b-f253-4e3e-a45f-2a1a18f75c89",
|
|
nfsPath: "/volume3/fs/sourcebot-sourcebot-data-pvc-55405f2b-f253-4e3e-a45f-2a1a18f75c89",
|
|
nfsServer: "apollo1.dominion.lan",
|
|
}),
|
|
pvc2: base.RecoverableSimplePvc(namespaceName, appName + '-2-data', 'nfs-client', '10Gi', {
|
|
volumeName: "pvc-73d0ed19-562b-4bd9-a198-d8a5d21f0146",
|
|
nfsPath: "/volume3/fs/sourcebot-sourcebot-2-data-pvc-73d0ed19-562b-4bd9-a198-d8a5d21f0146",
|
|
nfsServer: "apollo1.dominion.lan",
|
|
}),
|
|
secret: base.Secret(namespaceName, 'gitea-token') {
|
|
stringData: {
|
|
token: '539779da7d1a922e1c1ba61e5ff25909b5bdca2d',
|
|
},
|
|
},
|
|
configmap: base.ConfigMap(namespaceName, appName) {
|
|
data: {
|
|
'config.json': |||
|
|
{
|
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
|
"connections": {
|
|
"forgejo": {
|
|
"type": "gitea",
|
|
"url": "https://forgejo.csbx.dev",
|
|
"token": {
|
|
"env": "GITEA_TOKEN"
|
|
},
|
|
"repos": [
|
|
"acmcarther/infra2",
|
|
"acmcarther/yesod",
|
|
"acmcarther/sourcebot",
|
|
"acmcarther/qwen-code"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|||
|
|
},
|
|
},
|
|
configmap2: base.ConfigMap(namespaceName, appName + '-2') {
|
|
data: {
|
|
'config.json': |||
|
|
{
|
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
|
"connections": {
|
|
"forgejo": {
|
|
"type": "gitea",
|
|
"url": "https://forgejo.csbx.dev",
|
|
"token": {
|
|
"env": "GITEA_TOKEN"
|
|
},
|
|
"repos": [
|
|
"acmcarther/yesod-mirror"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|||
|
|
},
|
|
},
|
|
app: linuxserver.App(params),
|
|
app2: linuxserver.App(params {
|
|
name: appName + '-2',
|
|
authUrl: 'https://source-mirror.csbx.dev',
|
|
configMapName: appName + '-2',
|
|
pvcName: appName + '-2-data',
|
|
}),
|
|
ingress1: nginxIngress.Ingress(nginxIngress.IngressParams {
|
|
namespace: namespaceName,
|
|
name: appName,
|
|
hosts: [
|
|
'sourcebot.csbx.dev',
|
|
],
|
|
annotations: nginxIngress.KubeCsbxOauthProxyAnnotations,
|
|
serviceName: appName + '-ui',
|
|
}),
|
|
ingress2: nginxIngress.Ingress(nginxIngress.IngressParams {
|
|
namespace: namespaceName,
|
|
name: appName + '-2',
|
|
hosts: [
|
|
'source-mirror.csbx.dev',
|
|
],
|
|
serviceName: appName + '-2-ui',
|
|
}),
|
|
|
|
} |