blob: c7dcad11045af1db4fe6beccf971f287c16db7c3 [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
radex1439fde2023-11-24 12:22:22 +010014 secretRefs:: {
15 ldap_pw: { secretKeyRef: { name: cfg.name, key: 'ldap_pw' } },
16 },
17
radex99ed6a72023-11-24 11:42:55 +010018 local ns = kube.Namespace(cfg.namespace),
radex3ca84542023-10-08 23:52:08 +020019
radex99ed6a72023-11-24 11:42:55 +010020 deployment: ns.Contain(kube.Deployment(cfg.name)) {
radex3ca84542023-10-08 23:52:08 +020021 spec+: {
22 replicas: 3,
23 template+: {
24 spec+: {
25 containers_: {
26 default: kube.Container("default") {
27 image: cfg.image,
28 env_: {
29 LDAP_DN: "cn=capacifier,ou=Services,dc=hackerspace,dc=pl",
radex1439fde2023-11-24 12:22:22 +010030 LDAP_PW: top.secretRefs.ldap_pw,
radex3ca84542023-10-08 23:52:08 +020031 },
32 command: [
33 "/hswaw/capacifier/capacifier",
radex3ca84542023-10-08 23:52:08 +020034 "-logtostderr",
35 "-api_listen", "0.0.0.0:8080",
36 "-ldap_bind_dn", "$(LDAP_DN)",
37 "-ldap_bind_pw", "$(LDAP_PW)",
38 ],
39 resources: {
40 requests: { cpu: "25m", memory: "64Mi" },
41 limits: { cpu: "500m", memory: "128Mi" },
42 },
43 ports_: {
44 http: { containerPort: 8080 },
45 },
46 },
47 },
48 },
49 },
50 },
51 },
52
radex99ed6a72023-11-24 11:42:55 +010053 service: ns.Contain(kube.Service(cfg.name)) {
radex8b8f3872023-11-24 11:09:46 +010054 target:: top.deployment,
radex3ca84542023-10-08 23:52:08 +020055 },
56
radex99ed6a72023-11-24 11:42:55 +010057 ingress: ns.Contain(kube.SimpleIngress(cfg.name)) {
Radek Pietruszewskif5844312023-10-27 22:41:18 +020058 hosts:: [cfg.domain],
59 target_service:: top.service,
radex3ca84542023-10-08 23:52:08 +020060 },
61}