| // HSWAW / hscloud / k0-specific extensions to kube.libsonnet |
| |
| local kube = import "kube.libsonnet"; |
| |
| kube { |
| // Basic Ingress config pointing `hosts` to `target_service`, with HTTPS set up |
| SimpleIngress(name): kube.Ingress(name) { |
| local ingress = self, |
| hosts:: error "hosts must be defined", |
| target_service:: error "target_service must be defined", |
| extra_paths:: [], |
| metadata+: { |
| annotations+: { |
| 'kubernetes.io/tls-acme': 'true', |
| 'cert-manager.io/cluster-issuer': 'letsencrypt-prod', |
| 'nginx.ingress.kubernetes.io/proxy-body-size': '0', |
| }, |
| }, |
| spec+: { |
| tls: [{ hosts: ingress.hosts, secretName: name + '-tls' }], |
| rules: [ |
| { |
| host: host, |
| http: { |
| paths: [ |
| { path: '/', backend: ingress.target_service.name_port }, |
| ] + ingress.extra_paths, |
| }, |
| } |
| for host in ingress.hosts |
| ], |
| }, |
| }, |
| } |