blob: 7f1edc2fbd273b9501e19b9d56710c5c6ffacd5f [file] [log] [blame]
Radek Pietruszewskif5844312023-10-27 22:41:18 +02001local kube = import "../../kube/hscloud.libsonnet";
radex3ca84542023-10-08 23:52:08 +02002
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 Bazanski4768e2f2023-10-28 17:31:13 +000011 image: 'registry.k0.hswaw.net/q3k/capacifier@sha256:fd94b29bf711267235c96e5102ac4024e83e5851869a5e8814b83e76490c00af',
radex3ca84542023-10-08 23:52:08 +020012 },
13
radex99ed6a72023-11-24 11:42:55 +010014 local ns = kube.Namespace(cfg.namespace),
radex3ca84542023-10-08 23:52:08 +020015
radex99ed6a72023-11-24 11:42:55 +010016 deployment: ns.Contain(kube.Deployment(cfg.name)) {
radex3ca84542023-10-08 23:52:08 +020017 spec+: {
18 replicas: 3,
19 template+: {
20 spec+: {
21 containers_: {
22 default: kube.Container("default") {
23 image: cfg.image,
24 env_: {
25 LDAP_DN: "cn=capacifier,ou=Services,dc=hackerspace,dc=pl",
26 LDAP_PW: { secretKeyRef: { name: cfg.name, key: 'ldap_pw' } },
27 },
28 command: [
29 "/hswaw/capacifier/capacifier",
radex3ca84542023-10-08 23:52:08 +020030 "-logtostderr",
31 "-api_listen", "0.0.0.0:8080",
32 "-ldap_bind_dn", "$(LDAP_DN)",
33 "-ldap_bind_pw", "$(LDAP_PW)",
34 ],
35 resources: {
36 requests: { cpu: "25m", memory: "64Mi" },
37 limits: { cpu: "500m", memory: "128Mi" },
38 },
39 ports_: {
40 http: { containerPort: 8080 },
41 },
42 },
43 },
44 },
45 },
46 },
47 },
48
radex99ed6a72023-11-24 11:42:55 +010049 service: ns.Contain(kube.Service(cfg.name)) {
radex8b8f3872023-11-24 11:09:46 +010050 target:: top.deployment,
radex3ca84542023-10-08 23:52:08 +020051 },
52
radex99ed6a72023-11-24 11:42:55 +010053 ingress: ns.Contain(kube.SimpleIngress(cfg.name)) {
Radek Pietruszewskif5844312023-10-27 22:41:18 +020054 hosts:: [cfg.domain],
55 target_service:: top.service,
radex3ca84542023-10-08 23:52:08 +020056 },
57}