mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-16 16:51:02 +02:00
Partial K8s implementation
This commit is contained in:
parent
ed605f03f9
commit
3b3809f7af
1 changed files with 52 additions and 2 deletions
|
|
@ -10,12 +10,15 @@
|
|||
reservations: {},
|
||||
ports: [],
|
||||
volumes: [],
|
||||
environment: {},
|
||||
|
||||
with_image:: function(x) self + { image: x },
|
||||
|
||||
with_command:: function(x) self + { command: x },
|
||||
|
||||
with_environment:: function(x) self + { environment: x },
|
||||
with_environment:: function(x) self + {
|
||||
environment: super.environment + x,
|
||||
},
|
||||
|
||||
with_limits:: function(c, m) self + { limits: { cpu: c, memory: m } },
|
||||
|
||||
|
|
@ -37,6 +40,16 @@
|
|||
]
|
||||
},
|
||||
|
||||
with_env_var_secrets::
|
||||
function(vars)
|
||||
std.foldl(
|
||||
function(obj, x) obj.with_environment(
|
||||
{ [x]: "${" + x + "}" }
|
||||
),
|
||||
vars.variables,
|
||||
self
|
||||
),
|
||||
|
||||
add:: function() [
|
||||
|
||||
{
|
||||
|
|
@ -97,7 +110,8 @@
|
|||
(if std.objectHas(container, "command") then
|
||||
{ command: container.command }
|
||||
else {}) +
|
||||
(if std.objectHas(container, "environment") then
|
||||
|
||||
(if ! std.isEmpty(container.environment) then
|
||||
{ env: [ {
|
||||
name: e.key, value: e.value
|
||||
}
|
||||
|
|
@ -283,6 +297,42 @@
|
|||
|
||||
},
|
||||
|
||||
envSecrets:: function(name)
|
||||
{
|
||||
|
||||
local volume = self,
|
||||
|
||||
name: name,
|
||||
|
||||
variables: [],
|
||||
|
||||
with_size:: function(size) self + { size: size },
|
||||
|
||||
add:: function() [
|
||||
{
|
||||
apiVersion: "v1",
|
||||
kind: "Secret",
|
||||
metadata: {
|
||||
name: volume.name,
|
||||
namespace: "trustgraph",
|
||||
},
|
||||
data: {
|
||||
}
|
||||
},
|
||||
],
|
||||
|
||||
volRef:: function() {
|
||||
name: volume.name,
|
||||
secret: { secretName: volume.name },
|
||||
},
|
||||
|
||||
with_env_var::
|
||||
function(name) self + {
|
||||
variables: super.variables + [name],
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
containers:: function(name, containers)
|
||||
{
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue