88 lines
3.0 KiB
YAML
88 lines
3.0 KiB
YAML
{{- /*
|
|
Optional public ingress per app (apps.<name>.publicIngress.host). Unlike the regular
|
|
ingress it has NO LAN whitelist; protection instead:
|
|
- GeoIP: ingress-nginx answers the host only for clients from DE (map $geo_restricted_host
|
|
in the ingress-nginx values in apps-in-apps - the host has to be listed there too!)
|
|
- rate limits per client IP, and a much stricter one for the login endpoints
|
|
The DNS record must point at the public IP (DNS-only, NOT proxied through Cloudflare:
|
|
video over Cloudflare's free CDN violates their terms).
|
|
*/ -}}
|
|
{{- $root := . }}
|
|
{{- range $name, $app := .Values.apps }}
|
|
{{- if and $app.enabled $app.publicIngress }}
|
|
{{- $host := required (printf "apps.%s.publicIngress.host is required" $name) $app.publicIngress.host }}
|
|
{{- $common := dict "nginx.ingress.kubernetes.io/proxy-body-size" "100m" }}
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: Ingress
|
|
metadata:
|
|
name: {{ $name }}-public
|
|
namespace: {{ $root.Values.namespace }}
|
|
labels:
|
|
app.kubernetes.io/name: {{ $name }}
|
|
{{- include "media.labels" $root | nindent 4 }}
|
|
annotations:
|
|
# Only this ingress requests the certificate; -public-login reuses the secret.
|
|
cert-manager.io/cluster-issuer: {{ $root.Values.ingress.clusterIssuer }}
|
|
{{- toYaml $common | nindent 4 }}
|
|
nginx.ingress.kubernetes.io/limit-rps: {{ $app.publicIngress.limitRps | default "30" | quote }}
|
|
nginx.ingress.kubernetes.io/limit-burst-multiplier: "5"
|
|
nginx.ingress.kubernetes.io/limit-connections: {{ $app.publicIngress.limitConnections | default "30" | quote }}
|
|
{{- with $app.ingressAnnotations }}
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
ingressClassName: {{ $root.Values.ingress.className }}
|
|
tls:
|
|
- hosts:
|
|
- {{ $host }}
|
|
secretName: {{ $name }}-public-tls
|
|
rules:
|
|
- host: {{ $host }}
|
|
http:
|
|
paths:
|
|
- path: /
|
|
pathType: Prefix
|
|
backend:
|
|
service:
|
|
name: {{ $name }}
|
|
port:
|
|
name: http
|
|
{{- with $app.publicIngress.loginPaths }}
|
|
---
|
|
# Same host, login/password-reset endpoints only: at most 10 attempts per minute per IP.
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: Ingress
|
|
metadata:
|
|
name: {{ $name }}-public-login
|
|
namespace: {{ $root.Values.namespace }}
|
|
labels:
|
|
app.kubernetes.io/name: {{ $name }}
|
|
{{- include "media.labels" $root | nindent 4 }}
|
|
annotations:
|
|
{{- toYaml $common | nindent 4 }}
|
|
nginx.ingress.kubernetes.io/limit-rpm: "10"
|
|
nginx.ingress.kubernetes.io/limit-burst-multiplier: "1"
|
|
spec:
|
|
ingressClassName: {{ $root.Values.ingress.className }}
|
|
tls:
|
|
- hosts:
|
|
- {{ $host }}
|
|
secretName: {{ $name }}-public-tls
|
|
rules:
|
|
- host: {{ $host }}
|
|
http:
|
|
paths:
|
|
{{- range . }}
|
|
- path: {{ . }}
|
|
pathType: Prefix
|
|
backend:
|
|
service:
|
|
name: {{ $name }}
|
|
port:
|
|
name: http
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|