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 | }, |
| 9 | image: "registry.k0.hswaw.net/q3k/teleimg:1578240550-1525c84e4cef4f382e2dca2210f31830533dc7c4", |
| 10 | webFQDN: error "webFQDN must be set!", |
| 11 | }, |
| 12 | |
| 13 | component(cfg, env):: mirko.Component(env, "teleimg") { |
| 14 | local teleimg = self, |
| 15 | cfg+: { |
| 16 | image: cfg.image, |
| 17 | container: teleimg.GoContainer("main", "/teleimg/teleimg") { |
| 18 | env_: { |
| 19 | TELEGRAM_TOKEN: kube.SecretKeyRef(teleimg.secret, "telegram_token"), |
| 20 | }, |
| 21 | command+: [ |
| 22 | "-public_listen", "0.0.0.0:5000", |
| 23 | "-telegram_token", "$(TELEGRAM_TOKEN)", |
| 24 | ], |
| 25 | }, |
| 26 | ports+: { |
| 27 | publicHTTP: { |
| 28 | public: { |
| 29 | port: 5000, |
| 30 | dns: cfg.webFQDN, |
| 31 | }, |
| 32 | }, |
| 33 | }, |
| 34 | }, |
| 35 | |
| 36 | secret: kube.Secret("teleimg") { |
| 37 | metadata+: teleimg.metadata, |
| 38 | data: cfg.secret, |
| 39 | }, |
| 40 | }, |
| 41 | } |