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 | a885488 | 2020-01-05 00:34:38 +0100 | [diff] [blame] | 11 | }, |
Sergiusz Bazanski | c315aac | 2020-01-02 16:43:39 +0100 | [diff] [blame] | 12 | webFQDN: error "webFQDN must be set!", |
| 13 | }, |
| 14 | |
Sergiusz Bazanski | a885488 | 2020-01-05 00:34:38 +0100 | [diff] [blame] | 15 | teleimg(cfg, env):: mirko.Component(env, "teleimg") { |
Sergiusz Bazanski | c315aac | 2020-01-02 16:43:39 +0100 | [diff] [blame] | 16 | local teleimg = self, |
| 17 | cfg+: { |
Sergiusz Bazanski | a885488 | 2020-01-05 00:34:38 +0100 | [diff] [blame] | 18 | image: cfg.image.teleimg, |
Sergiusz Bazanski | c315aac | 2020-01-02 16:43:39 +0100 | [diff] [blame] | 19 | 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 Bazanski | c315aac | 2020-01-02 16:43:39 +0100 | [diff] [blame] | 43 | } |