blob: 23cc20fc80eb549dd068249dd3ec9b4a5b9fe5f9 [file] [log] [blame]
radexdf18c802023-08-12 14:16:39 +02001local kube = import "../../../kube/kube.libsonnet";
2
3{
4 local top = self,
5 local cfg = self.cfg,
6
7 cfg:: {
8 name: "demo",
radexe6322632023-08-12 15:27:32 +02009 image: "registry.k0.hswaw.net/radex/bruh:v3",
radexdf18c802023-08-12 14:16:39 +020010 domain: "demo.hs.radex.io",
11 },
12
13 ns: kube.Namespace("personal-radex"),
14
15 deployment: top.ns.Contain(kube.Deployment(cfg.name)) {
16 spec+: {
17 replicas: 3,
18 template+: {
19 spec+: {
20 containers_: {
21 default: kube.Container("default") {
22 image: cfg.image,
23 resources: {
24 requests: { cpu: "0.01", memory: "64M" },
25 limits: { cpu: "1", memory: "256M" },
26 },
27 ports_: {
radexe6322632023-08-12 15:27:32 +020028 http: { containerPort: 8080 },
radexdf18c802023-08-12 14:16:39 +020029 },
30 },
31 },
32 },
33 },
34 },
35 },
36
37 service: top.ns.Contain(kube.Service(cfg.name)) {
38 target_pod:: top.deployment.spec.template,
39 },
40
41 ingress: top.ns.Contain(kube.Ingress(cfg.name)) {
radex5e475372023-08-12 14:26:31 +020042 metadata+: {
43 annotations+: {
44 "kubernetes.io/tls-acme": "true",
45 "cert-manager.io/cluster-issuer": "letsencrypt-prod",
46 "nginx.ingress.kubernetes.io/proxy-body-size": "0",
47 },
48 },
radexdf18c802023-08-12 14:16:39 +020049 spec+: {
radex5e475372023-08-12 14:26:31 +020050 tls: [ { hosts: [ cfg.domain ], secretName: cfg.name + "-tls" } ],
radexdf18c802023-08-12 14:16:39 +020051 rules: [
52 {
53 host: cfg.domain,
54 http: {
55 paths: [
56 { path: "/", backend: top.service.name_port },
57 ],
58 },
59 },
60 ],
61 },
62 }
63}