| local kube = import '../../../kube/kube.libsonnet'; |
| |
| { |
| local internet = self, |
| local cfg = internet.cfg, |
| cfg:: { |
| namespace: "internet", |
| appName: "internet-landing", |
| domain: "internet.hackerspace.pl", |
| |
| tag: "201907091256", |
| image: "registry.k0.hswaw.net/app/internet:" + cfg.tag, |
| |
| resources: { |
| requests: { |
| cpu: "25m", |
| memory: "50Mi", |
| }, |
| limits: { |
| cpu: "100m", |
| memory: "200Mi", |
| }, |
| }, |
| }, |
| |
| namespace: kube.Namespace(cfg.namespace), |
| |
| metadata(component):: { |
| namespace: cfg.namespace, |
| labels: { |
| "app.kubernetes.io/name": cfg.appName, |
| "app.kubernetes.io/managed-by": "kubecfg", |
| "app.kubernetes.io/component": component, |
| }, |
| }, |
| |
| deployment: kube.Deployment("nginx") { |
| metadata+: internet.metadata("nginx"), |
| spec+: { |
| replicas: 1, |
| template+: { |
| spec+: { |
| containers_: { |
| nginx: kube.Container("nginx") { |
| image: cfg.image, |
| ports_: { |
| http: { containerPort: 80 }, |
| }, |
| resources: cfg.resources, |
| }, |
| }, |
| }, |
| }, |
| }, |
| }, |
| |
| svc: kube.Service("frontend") { |
| metadata+: internet.metadata("frontend"), |
| target_pod:: internet.deployment.spec.template, |
| }, |
| |
| ingress: kube.Ingress("frontend") { |
| metadata+: internet.metadata("frontend") { |
| annotations+: { |
| "kubernetes.io/tls-acme": "true", |
| "certmanager.k8s.io/cluster-issuer": "letsencrypt-prod", |
| }, |
| }, |
| spec+: { |
| tls: [ |
| { hosts: [cfg.domain], secretName: "frontend-tls"} |
| ], |
| rules: [ |
| { |
| host: cfg.domain, |
| http: { |
| paths: [ |
| { path: "/", backend: internet.svc.name_port }, |
| ], |
| }, |
| }, |
| ], |
| }, |
| }, |
| } |