Finish template mods for k8s

This commit is contained in:
Cyber MacGeddon 2024-09-06 21:43:38 +01:00
parent d0db893a95
commit 9479f4401d
4 changed files with 57 additions and 8 deletions

View file

@ -8,6 +8,7 @@ local images = import "values/images.jsonnet";
create:: function(engine) create:: function(engine)
local vol = engine.volume("prometheus-data").with_size("20G"); local vol = engine.volume("prometheus-data").with_size("20G");
local cfgVol = engine.configVolume( local cfgVol = engine.configVolume(
"prometheus-cfg", "./prometheus", "prometheus-cfg", "./prometheus",
{ {

View file

@ -15,7 +15,7 @@ local prompts = import "prompts/mixtral.jsonnet";
create:: function(engine) create:: function(engine)
local cfgVol = engine.configVolume( local cfgVol = engine.secretVolume(
"vertexai-creds", "vertexai-creds",
"./vertexai", "./vertexai",
{ {
@ -60,7 +60,13 @@ local prompts = import "prompts/mixtral.jsonnet";
create:: function(engine) create:: function(engine)
local cfgVol = engine.configVolume("./vertexai"); local cfgVol = engine.secretVolume(
"vertexai-creds",
"./vertexai",
{
"private.json": importstr "vertexai/private.json",
}
);
local container = local container =
engine.container("text-completion-rag") engine.container("text-completion-rag")

View file

@ -26,7 +26,7 @@
function(vol, mnt) function(vol, mnt)
self + { self + {
volumes: super.volumes + [{ volumes: super.volumes + [{
volume: vol.name, mount: mnt volume: vol, mount: mnt
}] }]
}, },
@ -70,7 +70,7 @@
(if std.length(container.volumes) > 0 then (if std.length(container.volumes) > 0 then
{ {
volumes: [ volumes: [
"%s:%s" % [vol.volume, vol.mount] "%s:%s" % [vol.volume.name, vol.mount]
for vol in container.volumes for vol in container.volumes
] ]
} }
@ -112,13 +112,26 @@
}, },
// FIXME: For K8s configVolume:: function(name, dir, parts)
configVolume:: function(name)
{ {
local volume = self, local volume = self,
name: name, name: dir,
with_size:: function(size) self + { size: size },
add:: function() {
}
},
secretVolume:: function(name, dir, parts)
{
local volume = self,
name: dir,
with_size:: function(size) self + { size: size }, with_size:: function(size) self + { size: size },

View file

@ -202,7 +202,6 @@
}, },
// FIXME: For K8s
configVolume:: function(name, dir, parts) configVolume:: function(name, dir, parts)
{ {
@ -233,6 +232,36 @@
}, },
secretVolume:: function(name, dir, parts)
{
local volume = self,
name: name,
with_size:: function(size) self + { size: size },
add:: function() {
resources +: {
[volume.name + "-cm"]: {
apiVersion: "v1",
kind: "Secret",
metadata: {
name: volume.name,
namespace: "trustgraph",
},
data: parts
},
}
},
volRef:: function() {
name: volume.name,
secret: { secretName: volume.name + "-cm" },
}
},
containers:: function(name, containers) containers:: function(name, containers)
{ {