Radek Pietruszewski | f584431 | 2023-10-27 22:41:18 +0200 | [diff] [blame] | 1 | local kube = import "../../kube/hscloud.libsonnet"; |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 2 | |
| 3 | { |
| 4 | local top = self, |
| 5 | local cfg = self.cfg, |
| 6 | |
| 7 | cfg:: { |
| 8 | name: 'ldapweb', |
| 9 | namespace: 'ldapweb', |
| 10 | domain: 'profile.hackerspace.pl', |
Radek Pietruszewski | 29a96dd | 2023-10-28 15:42:16 +0200 | [diff] [blame] | 11 | image: 'registry.k0.hswaw.net/radex/ldapweb:1698604668', |
radex | 401aa5e | 2023-10-13 22:11:43 +0200 | [diff] [blame] | 12 | }, |
| 13 | |
| 14 | secrets:: { |
| 15 | admin_password: { secretKeyRef: { name: cfg.name, key: 'admin_password' } }, |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 16 | }, |
| 17 | |
| 18 | ns: kube.Namespace(cfg.namespace), |
| 19 | |
| 20 | deployment: top.ns.Contain(kube.Deployment(cfg.name)) { |
| 21 | spec+: { |
| 22 | replicas: 1, |
| 23 | template+: { |
| 24 | spec+: { |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 25 | containers_: { |
| 26 | default: kube.Container("default") { |
| 27 | image: cfg.image, |
| 28 | resources: { |
radex | 401aa5e | 2023-10-13 22:11:43 +0200 | [diff] [blame] | 29 | requests: { cpu: "25m", memory: "256Mi" }, |
| 30 | limits: { cpu: "500m", memory: "512Mi" }, |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 31 | }, |
| 32 | ports_: { |
| 33 | http: { containerPort: 8000 }, |
| 34 | }, |
radex | d60a68d | 2023-09-23 18:34:02 +0200 | [diff] [blame] | 35 | env_: { |
| 36 | LDAPWEB_ADMIN_GROUPS: 'ldap-admin,staff,zarzad', |
| 37 | LDAPWEB_ACTIVE_GROUPS: 'fatty,starving,potato', |
radex | 401aa5e | 2023-10-13 22:11:43 +0200 | [diff] [blame] | 38 | LDAPWEB_ADMIN_DN: 'cn=ldapweb,ou=services,dc=hackerspace,dc=pl', |
| 39 | LDAPWEB_ADMIN_PASSWORD: top.secrets.admin_password, |
| 40 | LDAPWEB_AVATAR_CACHE_TIMEOUT: '1800', |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 41 | } |
| 42 | }, |
| 43 | }, |
| 44 | }, |
| 45 | }, |
| 46 | }, |
| 47 | }, |
| 48 | |
| 49 | service: top.ns.Contain(kube.Service(cfg.name)) { |
| 50 | target_pod:: top.deployment.spec.template, |
| 51 | }, |
| 52 | |
Radek Pietruszewski | f584431 | 2023-10-27 22:41:18 +0200 | [diff] [blame] | 53 | ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) { |
| 54 | hosts:: [cfg.domain], |
| 55 | target_service:: top.service, |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 56 | }, |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 57 | } |