Radek Pietruszewski | f584431 | 2023-10-27 22:41:18 +0200 | [diff] [blame] | 1 | local kube = import "../../../kube/hscloud.libsonnet"; |
radex | ae2a725 | 2023-08-13 11:45:59 +0200 | [diff] [blame] | 2 | |
| 3 | { |
| 4 | local top = self, |
| 5 | local cfg = self.cfg, |
| 6 | |
| 7 | cfg:: { |
| 8 | name: "demo-next", |
radex | 5365e7e | 2023-08-15 18:07:28 +0200 | [diff] [blame] | 9 | image: "registry.k0.hswaw.net/radex/next-bruh:v2", |
radex | ae2a725 | 2023-08-13 11:45:59 +0200 | [diff] [blame] | 10 | domain: "demo-next.hs.radex.io", |
| 11 | }, |
| 12 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame^] | 13 | local ns = kube.Namespace("personal-radex"), |
radex | ae2a725 | 2023-08-13 11:45:59 +0200 | [diff] [blame] | 14 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame^] | 15 | deployment: ns.Contain(kube.Deployment(cfg.name)) { |
radex | ae2a725 | 2023-08-13 11:45:59 +0200 | [diff] [blame] | 16 | spec+: { |
radex | 5365e7e | 2023-08-15 18:07:28 +0200 | [diff] [blame] | 17 | replicas: 1, |
radex | ae2a725 | 2023-08-13 11:45:59 +0200 | [diff] [blame] | 18 | template+: { |
| 19 | spec+: { |
radex | 5365e7e | 2023-08-15 18:07:28 +0200 | [diff] [blame] | 20 | volumes_: { |
| 21 | data: kube.PersistentVolumeClaimVolume(top.data), |
| 22 | }, |
radex | ae2a725 | 2023-08-13 11:45:59 +0200 | [diff] [blame] | 23 | containers_: { |
| 24 | default: kube.Container("default") { |
| 25 | image: cfg.image, |
| 26 | resources: { |
| 27 | requests: { cpu: "0.01", memory: "64M" }, |
| 28 | limits: { cpu: "1", memory: "256M" }, |
| 29 | }, |
radex | 5365e7e | 2023-08-15 18:07:28 +0200 | [diff] [blame] | 30 | env_: { |
| 31 | DATA_PATH: "/data", |
| 32 | }, |
radex | ae2a725 | 2023-08-13 11:45:59 +0200 | [diff] [blame] | 33 | ports_: { |
| 34 | http: { containerPort: 3000 }, |
| 35 | }, |
radex | 5365e7e | 2023-08-15 18:07:28 +0200 | [diff] [blame] | 36 | volumeMounts_: { |
| 37 | data: { mountPath: '/data' }, |
| 38 | } |
radex | ae2a725 | 2023-08-13 11:45:59 +0200 | [diff] [blame] | 39 | }, |
| 40 | }, |
| 41 | }, |
| 42 | }, |
| 43 | }, |
| 44 | }, |
| 45 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame^] | 46 | data: ns.Contain(kube.PersistentVolumeClaim("data")) { |
radex | 36964dc | 2023-11-24 11:19:46 +0100 | [diff] [blame] | 47 | storage:: "1Gi", |
| 48 | storageClass:: "waw-hdd-redundant-3", |
radex | 5365e7e | 2023-08-15 18:07:28 +0200 | [diff] [blame] | 49 | }, |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame^] | 50 | service: ns.Contain(kube.Service(cfg.name)) { |
radex | 8b8f387 | 2023-11-24 11:09:46 +0100 | [diff] [blame] | 51 | target:: top.deployment, |
radex | ae2a725 | 2023-08-13 11:45:59 +0200 | [diff] [blame] | 52 | }, |
| 53 | |
radex | 99ed6a7 | 2023-11-24 11:42:55 +0100 | [diff] [blame^] | 54 | ingress: ns.Contain(kube.SimpleIngress(cfg.name)) { |
Radek Pietruszewski | f584431 | 2023-10-27 22:41:18 +0200 | [diff] [blame] | 55 | hosts:: [cfg.domain], |
| 56 | target_service:: top.service, |
| 57 | }, |
radex | ae2a725 | 2023-08-13 11:45:59 +0200 | [diff] [blame] | 58 | } |