Radek Pietruszewski | f584431 | 2023-10-27 22:41:18 +0200 | [diff] [blame] | 1 | local kube = import "../../kube/hscloud.libsonnet"; |
radex | 3ca8454 | 2023-10-08 23:52:08 +0200 | [diff] [blame] | 2 | |
| 3 | { |
| 4 | local top = self, |
| 5 | local cfg = self.cfg, |
| 6 | |
| 7 | cfg:: { |
| 8 | name: 'capacifier', |
| 9 | namespace: 'capacifier', |
| 10 | domain: 'capacifier.hackerspace.pl', |
Serge Bazanski | 4768e2f | 2023-10-28 17:31:13 +0000 | [diff] [blame] | 11 | image: 'registry.k0.hswaw.net/q3k/capacifier@sha256:fd94b29bf711267235c96e5102ac4024e83e5851869a5e8814b83e76490c00af', |
radex | 3ca8454 | 2023-10-08 23:52:08 +0200 | [diff] [blame] | 12 | }, |
| 13 | |
radex | 1439fde | 2023-11-24 12:22:22 +0100 | [diff] [blame] | 14 | secretRefs:: { |
| 15 | ldap_pw: { secretKeyRef: { name: cfg.name, key: 'ldap_pw' } }, |
| 16 | }, |
| 17 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame] | 18 | local ns = kube.Namespace(cfg.namespace), |
radex | 3ca8454 | 2023-10-08 23:52:08 +0200 | [diff] [blame] | 19 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame] | 20 | deployment: ns.Contain(kube.Deployment(cfg.name)) { |
radex | 3ca8454 | 2023-10-08 23:52:08 +0200 | [diff] [blame] | 21 | spec+: { |
| 22 | replicas: 3, |
| 23 | template+: { |
| 24 | spec+: { |
| 25 | containers_: { |
| 26 | default: kube.Container("default") { |
| 27 | image: cfg.image, |
| 28 | env_: { |
| 29 | LDAP_DN: "cn=capacifier,ou=Services,dc=hackerspace,dc=pl", |
radex | 1439fde | 2023-11-24 12:22:22 +0100 | [diff] [blame] | 30 | LDAP_PW: top.secretRefs.ldap_pw, |
radex | 3ca8454 | 2023-10-08 23:52:08 +0200 | [diff] [blame] | 31 | }, |
| 32 | command: [ |
| 33 | "/hswaw/capacifier/capacifier", |
radex | 3ca8454 | 2023-10-08 23:52:08 +0200 | [diff] [blame] | 34 | "-logtostderr", |
| 35 | "-api_listen", "0.0.0.0:8080", |
| 36 | "-ldap_bind_dn", "$(LDAP_DN)", |
| 37 | "-ldap_bind_pw", "$(LDAP_PW)", |
| 38 | ], |
| 39 | resources: { |
| 40 | requests: { cpu: "25m", memory: "64Mi" }, |
| 41 | limits: { cpu: "500m", memory: "128Mi" }, |
| 42 | }, |
| 43 | ports_: { |
| 44 | http: { containerPort: 8080 }, |
| 45 | }, |
| 46 | }, |
| 47 | }, |
| 48 | }, |
| 49 | }, |
| 50 | }, |
| 51 | }, |
| 52 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame] | 53 | service: ns.Contain(kube.Service(cfg.name)) { |
radex | 8b8f387 | 2023-11-24 11:09:46 +0100 | [diff] [blame] | 54 | target:: top.deployment, |
radex | 3ca8454 | 2023-10-08 23:52:08 +0200 | [diff] [blame] | 55 | }, |
| 56 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame] | 57 | ingress: ns.Contain(kube.SimpleIngress(cfg.name)) { |
Radek Pietruszewski | f584431 | 2023-10-27 22:41:18 +0200 | [diff] [blame] | 58 | hosts:: [cfg.domain], |
radex | d45584a | 2023-11-24 12:51:57 +0100 | [diff] [blame] | 59 | target:: top.service, |
radex | 3ca8454 | 2023-10-08 23:52:08 +0200 | [diff] [blame] | 60 | }, |
| 61 | } |