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', |
radex | 6e0041d | 2023-11-23 20:41:15 +0100 | [diff] [blame] | 11 | image: 'registry.k0.hswaw.net/radex/ldapweb:20231123203042', |
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 | 6e0041d | 2023-11-23 20:41:15 +0100 | [diff] [blame] | 16 | smtp_password: { secretKeyRef: { name: cfg.name, key: 'smtp_password' } }, |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 17 | }, |
| 18 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame] | 19 | local ns = kube.Namespace(cfg.namespace), |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 20 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame] | 21 | deployment: ns.Contain(kube.Deployment(cfg.name)) { |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 22 | spec+: { |
| 23 | replicas: 1, |
| 24 | template+: { |
| 25 | spec+: { |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 26 | containers_: { |
| 27 | default: kube.Container("default") { |
| 28 | image: cfg.image, |
| 29 | resources: { |
radex | 401aa5e | 2023-10-13 22:11:43 +0200 | [diff] [blame] | 30 | requests: { cpu: "25m", memory: "256Mi" }, |
| 31 | limits: { cpu: "500m", memory: "512Mi" }, |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 32 | }, |
| 33 | ports_: { |
| 34 | http: { containerPort: 8000 }, |
| 35 | }, |
radex | d60a68d | 2023-09-23 18:34:02 +0200 | [diff] [blame] | 36 | env_: { |
| 37 | LDAPWEB_ADMIN_GROUPS: 'ldap-admin,staff,zarzad', |
| 38 | LDAPWEB_ACTIVE_GROUPS: 'fatty,starving,potato', |
radex | 401aa5e | 2023-10-13 22:11:43 +0200 | [diff] [blame] | 39 | LDAPWEB_ADMIN_DN: 'cn=ldapweb,ou=services,dc=hackerspace,dc=pl', |
| 40 | LDAPWEB_ADMIN_PASSWORD: top.secrets.admin_password, |
radex | 6e0041d | 2023-11-23 20:41:15 +0100 | [diff] [blame] | 41 | LDAPWEB_PROTECTED_GROUPS: 'ldap-admin,staff,zarzad', |
| 42 | LDAPWEB_SMTP_USER: 'ldapweb', |
| 43 | LDAPWEB_SMTP_PASSWORD: top.secrets.smtp_password, |
| 44 | LDAPWEB_PAPERTRAIL_RECIPIENTS: 'zarzad@hackerspace.pl', |
radex | 401aa5e | 2023-10-13 22:11:43 +0200 | [diff] [blame] | 45 | LDAPWEB_AVATAR_CACHE_TIMEOUT: '1800', |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 46 | } |
| 47 | }, |
| 48 | }, |
| 49 | }, |
| 50 | }, |
| 51 | }, |
| 52 | }, |
| 53 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame] | 54 | service: ns.Contain(kube.Service(cfg.name)) { |
radex | 8b8f387 | 2023-11-24 11:09:46 +0100 | [diff] [blame] | 55 | target:: top.deployment, |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 56 | }, |
| 57 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame] | 58 | ingress: ns.Contain(kube.SimpleIngress(cfg.name)) { |
Radek Pietruszewski | f584431 | 2023-10-27 22:41:18 +0200 | [diff] [blame] | 59 | hosts:: [cfg.domain], |
| 60 | target_service:: top.service, |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 61 | }, |
radex | b8d4a8a | 2023-09-22 23:46:05 +0200 | [diff] [blame] | 62 | } |