blob: aebd110000e5c0ce828e1cb6f941e98c388f5321 [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',
radex401aa5e2023-10-13 22:11:43 +020011 image: 'registry.k0.hswaw.net/radex/ldap-web:1697292240',
12 },
13
14 secrets:: {
15 admin_password: { secretKeyRef: { name: cfg.name, key: 'admin_password' } },
radexb8d4a8a2023-09-22 23:46:05 +020016 },
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+: {
radexb8d4a8a2023-09-22 23:46:05 +020025 containers_: {
26 default: kube.Container("default") {
27 image: cfg.image,
28 resources: {
radex401aa5e2023-10-13 22:11:43 +020029 requests: { cpu: "25m", memory: "256Mi" },
30 limits: { cpu: "500m", memory: "512Mi" },
radexb8d4a8a2023-09-22 23:46:05 +020031 },
32 ports_: {
33 http: { containerPort: 8000 },
34 },
radexd60a68d2023-09-23 18:34:02 +020035 env_: {
36 LDAPWEB_ADMIN_GROUPS: 'ldap-admin,staff,zarzad',
37 LDAPWEB_ACTIVE_GROUPS: 'fatty,starving,potato',
radex401aa5e2023-10-13 22:11:43 +020038 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',
radexb8d4a8a2023-09-22 23:46:05 +020041 }
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 Pietruszewskif5844312023-10-27 22:41:18 +020053 ingress: top.ns.Contain(kube.SimpleIngress(cfg.name)) {
54 hosts:: [cfg.domain],
55 target_service:: top.service,
radexb8d4a8a2023-09-22 23:46:05 +020056 },
radexb8d4a8a2023-09-22 23:46:05 +020057}