Sergiusz Bazanski | c315aac | 2020-01-02 16:43:39 +0100 | [diff] [blame] | 1 | local mirko = import "../../kube/mirko.libsonnet"; |
| 2 | local kube = import "../../kube/kube.libsonnet"; |
| 3 | |
| 4 | { |
| 5 | cfg:: { |
| 6 | secret: { |
| 7 | telegram_token: error "telegram_token must be set", |
| 8 | }, |
Sergiusz Bazanski | a885488 | 2020-01-05 00:34:38 +0100 | [diff] [blame] | 9 | image: { |
Sergiusz Bazanski | effafe9 | 2020-01-05 22:31:39 +0100 | [diff] [blame^] | 10 | teleimg: "registry.k0.hswaw.net/q3k/teleimg:1578259776-a07688fe74efe1e190d58092a9f50d4275a15e3d", |
Sergiusz Bazanski | a07688f | 2020-01-05 21:21:07 +0100 | [diff] [blame] | 11 | lelegram: "registry.k0.hswaw.net/q3k/lelegram:1578255597-a885488fd0f9fcd271f6a02416aae5bb3fd9c9ac", |
Sergiusz Bazanski | a885488 | 2020-01-05 00:34:38 +0100 | [diff] [blame] | 12 | }, |
| 13 | bridge: { |
| 14 | telegram: "-1001345766954", |
| 15 | irc: "#hackerspace-krk", |
| 16 | }, |
Sergiusz Bazanski | c315aac | 2020-01-02 16:43:39 +0100 | [diff] [blame] | 17 | webFQDN: error "webFQDN must be set!", |
| 18 | }, |
| 19 | |
Sergiusz Bazanski | a885488 | 2020-01-05 00:34:38 +0100 | [diff] [blame] | 20 | teleimg(cfg, env):: mirko.Component(env, "teleimg") { |
Sergiusz Bazanski | c315aac | 2020-01-02 16:43:39 +0100 | [diff] [blame] | 21 | local teleimg = self, |
| 22 | cfg+: { |
Sergiusz Bazanski | a885488 | 2020-01-05 00:34:38 +0100 | [diff] [blame] | 23 | image: cfg.image.teleimg, |
Sergiusz Bazanski | c315aac | 2020-01-02 16:43:39 +0100 | [diff] [blame] | 24 | container: teleimg.GoContainer("main", "/teleimg/teleimg") { |
| 25 | env_: { |
| 26 | TELEGRAM_TOKEN: kube.SecretKeyRef(teleimg.secret, "telegram_token"), |
| 27 | }, |
| 28 | command+: [ |
| 29 | "-public_listen", "0.0.0.0:5000", |
| 30 | "-telegram_token", "$(TELEGRAM_TOKEN)", |
| 31 | ], |
| 32 | }, |
| 33 | ports+: { |
| 34 | publicHTTP: { |
| 35 | public: { |
| 36 | port: 5000, |
| 37 | dns: cfg.webFQDN, |
| 38 | }, |
| 39 | }, |
| 40 | }, |
| 41 | }, |
| 42 | |
| 43 | secret: kube.Secret("teleimg") { |
| 44 | metadata+: teleimg.metadata, |
| 45 | data: cfg.secret, |
| 46 | }, |
| 47 | }, |
Sergiusz Bazanski | a885488 | 2020-01-05 00:34:38 +0100 | [diff] [blame] | 48 | |
| 49 | lelegram(cfg, env):: mirko.Component(env, "lelegram") { |
| 50 | local lelegram = self, |
| 51 | cfg+: { |
| 52 | image: cfg.image.lelegram, |
| 53 | container: lelegram.GoContainer("main", "/lelegram/lelegram") { |
| 54 | env_: { |
| 55 | TELEGRAM_TOKEN: kube.SecretKeyRef(lelegram.secret, "telegram_token"), |
| 56 | }, |
| 57 | command+: [ |
| 58 | "-telegram_token", "$(TELEGRAM_TOKEN)", |
| 59 | "-telegram_chat", cfg.bridge.telegram, |
| 60 | "-irc_channel", cfg.bridge.irc, |
| 61 | "-irc_max_connections", "10", |
| 62 | ], |
| 63 | }, |
| 64 | }, |
| 65 | |
| 66 | secret: kube.Secret("lelegram") { |
| 67 | metadata+: lelegram.metadata, |
| 68 | data: cfg.secret, |
| 69 | }, |
| 70 | }, |
Sergiusz Bazanski | c315aac | 2020-01-02 16:43:39 +0100 | [diff] [blame] | 71 | } |