blob: 7984602c859ec5e710390a5246db6b7c8c74af65 [file] [log] [blame]
radex3ca84542023-10-08 23:52:08 +02001local kube = import "../../kube/kube.libsonnet";
2
3{
4 local top = self,
5 local cfg = self.cfg,
6
7 cfg:: {
8 name: 'capacifier',
9 namespace: 'capacifier',
10 domain: 'capacifier.hackerspace.pl',
11 image: 'registry.k0.hswaw.net/q3k/capacifier:1680390588',
12 },
13
14 ns: kube.Namespace(cfg.namespace),
15
16 deployment: top.ns.Contain(kube.Deployment(cfg.name)) {
17 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",
30 "-hspki_disable",
31 "-logtostderr",
32 "-api_listen", "0.0.0.0:8080",
33 "-ldap_bind_dn", "$(LDAP_DN)",
34 "-ldap_bind_pw", "$(LDAP_PW)",
35 ],
36 resources: {
37 requests: { cpu: "25m", memory: "64Mi" },
38 limits: { cpu: "500m", memory: "128Mi" },
39 },
40 ports_: {
41 http: { containerPort: 8080 },
42 },
43 },
44 },
45 },
46 },
47 },
48 },
49
50 service: top.ns.Contain(kube.Service(cfg.name)) {
51 target_pod:: top.deployment.spec.template,
52 },
53
54 ingress: top.ns.Contain(kube.Ingress(cfg.name)) {
55 metadata+: {
56 annotations+: {
57 "kubernetes.io/tls-acme": "true",
58 "cert-manager.io/cluster-issuer": "letsencrypt-prod",
59 "nginx.ingress.kubernetes.io/proxy-body-size": "0",
60 },
61 },
62 spec+: {
63 tls: [ { hosts: [ cfg.domain ], secretName: cfg.name + "-tls" } ],
64 rules: [
65 {
66 host: cfg.domain,
67 http: {
68 paths: [
69 { path: "/", backend: top.service.name_port },
70 ],
71 },
72 },
73 ],
74 },
75 },
76}