ghost-helm-chart/charts/ghost/templates/ingress.yaml

124 lines
4.1 KiB
YAML

{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "ghost.fullname" . }}
labels:
{{- include "ghost.labels" . | nindent 4 }}
annotations:
{{- if and .Values.activity_pub.enabled (eq .Values.ingress.className "nginx") }}
nginx.ingress.kubernetes.io/use-regex: "true"
{{- end }}
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- secretName: {{ .secretName }}
hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- if and $.Values.activity_pub.enabled (not $.Values.proxy.enabled) }}
# ActivityPub routes (must come before the catch-all route)
- path: /\.ghost/activitypub/.*
pathType: ImplementationSpecific
backend:
service:
name: {{ include "ghost.fullname" $ }}-activitypub
port:
number: {{ $.Values.activity_pub.service.port }}
- path: /\.well-known/webfinger
pathType: ImplementationSpecific
backend:
service:
name: {{ include "ghost.fullname" $ }}-activitypub
port:
number: {{ $.Values.activity_pub.service.port }}
- path: /\.well-known/nodeinfo
pathType: ImplementationSpecific
backend:
service:
name: {{ include "ghost.fullname" $ }}-activitypub
port:
number: {{ $.Values.activity_pub.service.port }}
{{- end }}
# regular ghost stuff
{{- range .paths }}
- path: {{ .path }}
{{- with .pathType }}
pathType: {{ . }}
{{- end }}
backend:
service:
{{- if $.Values.proxy.enabled }}
name: {{ include "ghost.fullname" $ }}-proxy
port:
number: {{ $.Values.proxy.service.port }}
{{- else}}
name: {{ include "ghost.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
# Admin domain
- host: {{ $.Values.ghost.admin_domain | quote }}
http:
paths:
{{- if and $.Values.activity_pub.enabled (not $.Values.proxy.enabled) }}
# ActivityPub routes (must come before the catch-all route)
- path: /\.ghost/activitypub/.*
pathType: ImplementationSpecific
backend:
service:
name: {{ include "ghost.fullname" $ }}-activitypub
port:
number: {{ $.Values.activity_pub.service.port }}
- path: /\.well-known/webfinger
pathType: ImplementationSpecific
backend:
service:
name: {{ include "ghost.fullname" $ }}-activitypub
port:
number: {{ $.Values.activity_pub.service.port }}
- path: /\.well-known/nodeinfo
pathType: ImplementationSpecific
backend:
service:
name: {{ include "ghost.fullname" $ }}-activitypub
port:
number: {{ $.Values.activity_pub.service.port }}
{{- end }}
- path: /
pathType: Prefix
backend:
service:
{{- if $.Values.proxy.enabled }}
name: {{ include "ghost.fullname" $ }}-proxy
port:
number: {{ $.Values.proxy.service.port }}
{{- else}}
name: {{ include "ghost.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- end }}