blob: afca927a03f9f32a3592f8a532394777e1fa0f5b [file] [log] [blame]
Radek Pietruszewskif5844312023-10-27 22:41:18 +02001// HSWAW / hscloud / k0-specific extensions to kube.libsonnet
2
3local kube = import "kube.libsonnet";
4
5kube {
radexd45584a2023-11-24 12:51:57 +01006 // Basic Ingress config pointing `hosts` to the `target` service, with HTTPS set up
Radek Pietruszewskif5844312023-10-27 22:41:18 +02007 SimpleIngress(name): kube.Ingress(name) {
8 local ingress = self,
radexd45584a2023-11-24 12:51:57 +01009 hosts:: error "SimpleIngress.hosts must be defined",
10 target:: error "SimpleIngress.target service must be defined",
11 extraPaths:: [],
Radek Pietruszewskif5844312023-10-27 22:41:18 +020012 metadata+: {
13 annotations+: {
14 'kubernetes.io/tls-acme': 'true',
15 'cert-manager.io/cluster-issuer': 'letsencrypt-prod',
16 'nginx.ingress.kubernetes.io/proxy-body-size': '0',
17 },
18 },
19 spec+: {
20 tls: [{ hosts: ingress.hosts, secretName: name + '-tls' }],
21 rules: [
22 {
23 host: host,
24 http: {
25 paths: [
radexd45584a2023-11-24 12:51:57 +010026 { path: '/', backend: ingress.target.name_port },
27 ] + ingress.extraPaths,
Radek Pietruszewskif5844312023-10-27 22:41:18 +020028 },
29 }
30 for host in ingress.hosts
31 ],
32 },
33 },
34}