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 | e048331 | 2020-02-02 16:58:57 +0100 | [diff] [blame] | 11 | lelegram: "registry.k0.hswaw.net/q3k/lelegram:1579786610-83e26900700814ea67f46aabd5c5077382186022", |
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, |
Sergiusz Bazanski | 92b48d6 | 2020-01-08 13:59:04 +0100 | [diff] [blame] | 53 | nodeSelector: { |
| 54 | "kubernetes.io/hostname": "bc01n01.hswaw.net", |
| 55 | }, |
Sergiusz Bazanski | a885488 | 2020-01-05 00:34:38 +0100 | [diff] [blame] | 56 | container: lelegram.GoContainer("main", "/lelegram/lelegram") { |
| 57 | env_: { |
| 58 | TELEGRAM_TOKEN: kube.SecretKeyRef(lelegram.secret, "telegram_token"), |
| 59 | }, |
| 60 | command+: [ |
| 61 | "-telegram_token", "$(TELEGRAM_TOKEN)", |
| 62 | "-telegram_chat", cfg.bridge.telegram, |
| 63 | "-irc_channel", cfg.bridge.irc, |
| 64 | "-irc_max_connections", "10", |
| 65 | ], |
| 66 | }, |
| 67 | }, |
| 68 | |
Sergiusz Bazanski | f15da82 | 2020-02-02 17:16:11 +0100 | [diff] [blame] | 69 | deployment+: { |
| 70 | spec+: { |
| 71 | replicas: 0, |
| 72 | }, |
| 73 | }, |
| 74 | |
Sergiusz Bazanski | a885488 | 2020-01-05 00:34:38 +0100 | [diff] [blame] | 75 | secret: kube.Secret("lelegram") { |
| 76 | metadata+: lelegram.metadata, |
| 77 | data: cfg.secret, |
| 78 | }, |
| 79 | }, |
Sergiusz Bazanski | c315aac | 2020-01-02 16:43:39 +0100 | [diff] [blame] | 80 | } |