blob: 2e68381de7e54e919ddc8872a3d0ad9a36a167fd [file] [log] [blame]
local mirko = import "../../kube/mirko.libsonnet";
local kube = import "../../kube/kube.libsonnet";
{
cfg:: {
secret: {
telegram_token: error "telegram_token must be set",
},
image: {
teleimg: "registry.k0.hswaw.net/q3k/teleimg:1578259776-a07688fe74efe1e190d58092a9f50d4275a15e3d",
lelegram: "registry.k0.hswaw.net/q3k/lelegram:1579786610-83e26900700814ea67f46aabd5c5077382186022",
},
bridge: {
telegram: "-1001345766954",
irc: "#hackerspace-krk",
},
webFQDN: error "webFQDN must be set!",
},
teleimg(cfg, env):: mirko.Component(env, "teleimg") {
local teleimg = self,
cfg+: {
image: cfg.image.teleimg,
container: teleimg.GoContainer("main", "/teleimg/teleimg") {
env_: {
TELEGRAM_TOKEN: kube.SecretKeyRef(teleimg.secret, "telegram_token"),
},
command+: [
"-public_listen", "0.0.0.0:5000",
"-telegram_token", "$(TELEGRAM_TOKEN)",
],
},
ports+: {
publicHTTP: {
public: {
port: 5000,
dns: cfg.webFQDN,
},
},
},
},
secret: kube.Secret("teleimg") {
metadata+: teleimg.metadata,
data: cfg.secret,
},
},
lelegram(cfg, env):: mirko.Component(env, "lelegram") {
local lelegram = self,
cfg+: {
image: cfg.image.lelegram,
nodeSelector: {
"kubernetes.io/hostname": "bc01n01.hswaw.net",
},
container: lelegram.GoContainer("main", "/lelegram/lelegram") {
env_: {
TELEGRAM_TOKEN: kube.SecretKeyRef(lelegram.secret, "telegram_token"),
},
command+: [
"-telegram_token", "$(TELEGRAM_TOKEN)",
"-telegram_chat", cfg.bridge.telegram,
"-irc_channel", cfg.bridge.irc,
"-irc_max_connections", "10",
],
},
},
deployment+: {
spec+: {
replicas: 0,
},
},
secret: kube.Secret("lelegram") {
metadata+: lelegram.metadata,
data: cfg.secret,
},
},
}