22 lines
996 B
Plaintext
22 lines
996 B
Plaintext
local defaults = import "../config/defaults.libsonnet";
|
|
local utils = import "../lib/utils.libsonnet";
|
|
|
|
{
|
|
hashIp: function (name) std.substr(std.md5(name), 0, 4) + ":" + std.substr(std.md5(name), 4, 4),
|
|
meta: function (name, instance, deployments) {
|
|
[name]: {
|
|
name: name,
|
|
networking: {
|
|
publicSubdomain: name + ".infra",
|
|
internalSubdomain: name + ".i.infra",
|
|
publicDomain: self.publicSubdomain + "." + defaults.infraDomain,
|
|
internalDomain: self.internalSubdomain + "." + defaults.infraDomain,
|
|
wireguardIp: defaults.ipSubnet + ":" + $.hashIp(name),
|
|
},
|
|
instance: instance + { name: name },
|
|
roles: std.uniq(std.sort(std.foldl(function (roles, deployment) roles + deployment.roles, deployments, []))),
|
|
deployment_vars: std.foldl(function (vars, deployment) utils.merge(vars, deployment.variables), deployments, {})
|
|
}
|
|
}
|
|
}
|