| // HSWAW / hscloud / k0-specific extensions to kube.libsonnet |
| |
| local kube = import "kube.libsonnet"; |
| |
| kube { |
| // Basic Ingress config pointing `hosts` to the `target` service, with HTTPS set up |
| SimpleIngress(name): kube.Ingress(name) { |
| local ingress = self, |
| hosts:: error "SimpleIngress.hosts must be defined", |
| target:: error "SimpleIngress.target service must be defined", |
| extraPaths:: [], |
| 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.name_port }, |
| ] + ingress.extraPaths, |
| }, |
| } |
| for host in ingress.hosts |
| ], |
| }, |
| }, |
| } |