blob: 805f019b106d9109a41aca6e2624ac2e9a504bc1 [file] [log] [blame]
Radek Pietruszewskif5844312023-10-27 22:41:18 +02001local kube = import "../../kube/hscloud.libsonnet";
radexb8d4a8a2023-09-22 23:46:05 +02002
3{
4 local top = self,
5 local cfg = self.cfg,
6
7 cfg:: {
8 name: 'ldapweb',
9 namespace: 'ldapweb',
10 domain: 'profile.hackerspace.pl',
radex6e0041d2023-11-23 20:41:15 +010011 image: 'registry.k0.hswaw.net/radex/ldapweb:20231123203042',
radex401aa5e2023-10-13 22:11:43 +020012 },
13
14 secrets:: {
15 admin_password: { secretKeyRef: { name: cfg.name, key: 'admin_password' } },
radex6e0041d2023-11-23 20:41:15 +010016 smtp_password: { secretKeyRef: { name: cfg.name, key: 'smtp_password' } },
radexb8d4a8a2023-09-22 23:46:05 +020017 },
18
19 ns: kube.Namespace(cfg.namespace),
20
21 deployment: top.ns.Contain(kube.Deployment(cfg.name)) {
22 spec+: {
23 replicas: 1,
24 template+: {
25 spec+: {
radexb8d4a8a2023-09-22 23:46:05 +020026 containers_: {
27 default: kube.Container("default") {
28 image: cfg.image,
29 resources: {
radex401aa5e2023-10-13 22:11:43 +020030 requests: { cpu: "25m", memory: "256Mi" },
31 limits: { cpu: "500m", memory: "512Mi" },
radexb8d4a8a2023-09-22 23:46:05 +020032 },
33 ports_: {
34 http: { containerPort: 8000 },
35 },
radexd60a68d2023-09-23 18:34:02 +020036 env_: {
37 LDAPWEB_ADMIN_GROUPS: 'ldap-admin,staff,zarzad',
38 LDAPWEB_ACTIVE_GROUPS: 'fatty,starving,potato',
radex401aa5e2023-10-13 22:11:43 +020039 LDAPWEB_ADMIN_DN: 'cn=ldapweb,ou=services,dc=hackerspace,dc=pl',
40 LDAPWEB_ADMIN_PASSWORD: top.secrets.admin_password,
radex6e0041d2023-11-23 20:41:15 +010041 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',
radex401aa5e2023-10-13 22:11:43 +020045 LDAPWEB_AVATAR_CACHE_TIMEOUT: '1800',
radexb8d4a8a2023-09-22 23:46:05 +020046 }
47 },
48 },
49 },
50 },
51 },
52 },
53
54 service: top.ns.Contain(kube.Service(cfg.name)) {
radex8b8f3872023-11-24 11:09:46 +010055 target:: top.deployment,
radexb8d4a8a2023-09-22 23:46:05 +020056 },
57
Radek Pietruszewskif5844312023-10-27 22:41:18 +020058 ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
59 hosts:: [cfg.domain],
60 target_service:: top.service,
radexb8d4a8a2023-09-22 23:46:05 +020061 },
radexb8d4a8a2023-09-22 23:46:05 +020062}