blob: 83857ec04c2789247bec69cfb30d8ed605d48384 [file] [log] [blame]
Sergiusz Bazanskic315aac2020-01-02 16:43:39 +01001local mirko = import "../../kube/mirko.libsonnet";
2local kube = import "../../kube/kube.libsonnet";
3
4{
5 cfg:: {
6 secret: {
7 telegram_token: error "telegram_token must be set",
8 },
Sergiusz Bazanskia8854882020-01-05 00:34:38 +01009 image: {
Sergiusz Bazanskieffafe92020-01-05 22:31:39 +010010 teleimg: "registry.k0.hswaw.net/q3k/teleimg:1578259776-a07688fe74efe1e190d58092a9f50d4275a15e3d",
Sergiusz Bazanskia8854882020-01-05 00:34:38 +010011 },
Sergiusz Bazanskic315aac2020-01-02 16:43:39 +010012 webFQDN: error "webFQDN must be set!",
13 },
14
Sergiusz Bazanskia8854882020-01-05 00:34:38 +010015 teleimg(cfg, env):: mirko.Component(env, "teleimg") {
Sergiusz Bazanskic315aac2020-01-02 16:43:39 +010016 local teleimg = self,
17 cfg+: {
Sergiusz Bazanskia8854882020-01-05 00:34:38 +010018 image: cfg.image.teleimg,
Sergiusz Bazanskic315aac2020-01-02 16:43:39 +010019 container: teleimg.GoContainer("main", "/teleimg/teleimg") {
20 env_: {
21 TELEGRAM_TOKEN: kube.SecretKeyRef(teleimg.secret, "telegram_token"),
22 },
23 command+: [
24 "-public_listen", "0.0.0.0:5000",
25 "-telegram_token", "$(TELEGRAM_TOKEN)",
26 ],
27 },
28 ports+: {
29 publicHTTP: {
30 public: {
31 port: 5000,
32 dns: cfg.webFQDN,
33 },
34 },
35 },
36 },
37
38 secret: kube.Secret("teleimg") {
39 metadata+: teleimg.metadata,
40 data: cfg.secret,
41 },
42 },
Sergiusz Bazanskic315aac2020-01-02 16:43:39 +010043}