Sergiusz Bazanski | 94f8dbf | 2019-07-09 13:02:27 +0200 | [diff] [blame] | 1 | local kube = import '../../../kube/kube.libsonnet'; |
| 2 | |
| 3 | { |
| 4 | local internet = self, |
| 5 | local cfg = internet.cfg, |
| 6 | cfg:: { |
| 7 | namespace: "internet", |
| 8 | appName: "internet-landing", |
| 9 | domain: "internet.hackerspace.pl", |
| 10 | |
| 11 | tag: "201907091256", |
Serge Bazanski | 4836dff | 2019-10-11 16:08:48 +0200 | [diff] [blame] | 12 | image: "registry.k0.hswaw.net/app/internet:" + cfg.tag, |
Sergiusz Bazanski | 94f8dbf | 2019-07-09 13:02:27 +0200 | [diff] [blame] | 13 | |
| 14 | resources: { |
| 15 | requests: { |
| 16 | cpu: "25m", |
| 17 | memory: "50Mi", |
| 18 | }, |
| 19 | limits: { |
| 20 | cpu: "100m", |
| 21 | memory: "200Mi", |
| 22 | }, |
| 23 | }, |
| 24 | }, |
| 25 | |
| 26 | namespace: kube.Namespace(cfg.namespace), |
| 27 | |
| 28 | metadata(component):: { |
| 29 | namespace: cfg.namespace, |
| 30 | labels: { |
| 31 | "app.kubernetes.io/name": cfg.appName, |
| 32 | "app.kubernetes.io/managed-by": "kubecfg", |
| 33 | "app.kubernetes.io/component": component, |
| 34 | }, |
| 35 | }, |
| 36 | |
| 37 | deployment: kube.Deployment("nginx") { |
| 38 | metadata+: internet.metadata("nginx"), |
| 39 | spec+: { |
| 40 | replicas: 1, |
| 41 | template+: { |
| 42 | spec+: { |
| 43 | containers_: { |
| 44 | nginx: kube.Container("nginx") { |
| 45 | image: cfg.image, |
| 46 | ports_: { |
| 47 | http: { containerPort: 80 }, |
| 48 | }, |
| 49 | resources: cfg.resources, |
| 50 | }, |
| 51 | }, |
| 52 | }, |
| 53 | }, |
| 54 | }, |
| 55 | }, |
| 56 | |
| 57 | svc: kube.Service("frontend") { |
| 58 | metadata+: internet.metadata("frontend"), |
| 59 | target_pod:: internet.deployment.spec.template, |
| 60 | }, |
| 61 | |
| 62 | ingress: kube.Ingress("frontend") { |
| 63 | metadata+: internet.metadata("frontend") { |
| 64 | annotations+: { |
| 65 | "kubernetes.io/tls-acme": "true", |
| 66 | "certmanager.k8s.io/cluster-issuer": "letsencrypt-prod", |
| 67 | }, |
| 68 | }, |
| 69 | spec+: { |
| 70 | tls: [ |
| 71 | { hosts: [cfg.domain], secretName: "frontend-tls"} |
| 72 | ], |
| 73 | rules: [ |
| 74 | { |
| 75 | host: cfg.domain, |
| 76 | http: { |
| 77 | paths: [ |
| 78 | { path: "/", backend: internet.svc.name_port }, |
| 79 | ], |
| 80 | }, |
| 81 | }, |
| 82 | ], |
| 83 | }, |
| 84 | }, |
| 85 | } |