Validate Helm Charts / Build outline (pull_request) Successful in 8s
Validate Helm Charts / Build paperless-ngx (pull_request) Successful in 12s
Validate Helm Charts / Build patchmon (pull_request) Successful in 11s
Validate Helm Charts / Build rss-bridge (pull_request) Successful in 9s
Validate Helm Charts / Build samba (pull_request) Successful in 6s
Validate Helm Charts / Build satisfactory (pull_request) Successful in 10s
Validate Helm Charts / Build searxng (pull_request) Successful in 7s
Validate Helm Charts / Build stalwart (pull_request) Successful in 7s
Validate Helm Charts / Build sure (pull_request) Successful in 6s
Validate Helm Charts / Build template-chart (pull_request) Successful in 9s
Validate Helm Charts / Build teamspeak-server (pull_request) Successful in 8s
Validate Helm Charts / Build urlaubsverwaltung (pull_request) Successful in 20s
Validate Helm Charts / Build valkey (pull_request) Successful in 10s
Validate Helm Charts / Build voucher-vault (pull_request) Successful in 10s
Validate Helm Charts / Build ytdlp-web-player (pull_request) Successful in 9s
Validate Helm Charts / Build zipline (pull_request) Successful in 8s
Validate Helm Charts / Trivy config bentopdf (pull_request) Successful in 17s
Validate Helm Charts / Trivy config bulwark (pull_request) Successful in 17s
Validate Helm Charts / Trivy config calibre-web-automated (pull_request) Successful in 18s
Validate Helm Charts / Trivy config cyberchef (pull_request) Successful in 18s
Validate Helm Charts / Trivy config freesailarr (pull_request) Successful in 15s
Validate Helm Charts / Trivy config garage (pull_request) Successful in 17s
Validate Helm Charts / Trivy config gotenberg (pull_request) Successful in 27s
Validate Helm Charts / Trivy config homeassistant (pull_request) Successful in 18s
Validate Helm Charts / Trivy config keycloak (pull_request) Successful in 15s
Validate Helm Charts / Trivy config minecraft-server (pull_request) Successful in 17s
Validate Helm Charts / Trivy config rallly (pull_request) Successful in 11s
Validate Helm Charts / Trivy config samba (pull_request) Successful in 12s
Validate Helm Charts / Trivy config satisfactory (pull_request) Successful in 14s
Validate Helm Charts / Trivy config matrix-synapse (pull_request) Successful in 20s
Validate Helm Charts / Trivy config minecraft-router (pull_request) Successful in 17s
Validate Helm Charts / Trivy config outline (pull_request) Successful in 15s
Validate Helm Charts / Trivy config paperless-ngx (pull_request) Successful in 15s
Validate Helm Charts / Trivy config patchmon (pull_request) Successful in 13s
Validate Helm Charts / Trivy config rss-bridge (pull_request) Successful in 15s
Validate Helm Charts / Detect changed charts (pull_request) Successful in 4s
Validate Helm Charts / Trivy config stalwart (pull_request) Successful in 21s
Validate Helm Charts / Trivy config sure (pull_request) Successful in 14s
Validate Helm Charts / Trivy config teamspeak-server (pull_request) Successful in 16s
Validate Helm Charts / Trivy config urlaubsverwaltung (pull_request) Successful in 13s
Validate Helm Charts / Trivy config searxng (pull_request) Successful in 24s
Validate Helm Charts / Resource quantities (pull_request) Successful in 13s
Validate Helm Charts / HTTPRoute match (pull_request) Successful in 10s
Validate Helm Charts / Bump level (pull_request) Successful in 5s
Validate Helm Charts / NetworkPolicy (pull_request) Successful in 12s
Validate Helm Charts / Selector match (pull_request) Successful in 10s
Validate Helm Charts / Trivy config template-chart (pull_request) Successful in 13s
Validate Helm Charts / YAML scalars (pull_request) Successful in 17s
Validate Helm Charts / Trivy config valkey (pull_request) Successful in 26s
Validate Helm Charts / Trivy config voucher-vault (pull_request) Successful in 21s
Validate Helm Charts / Trivy config ytdlp-web-player (pull_request) Successful in 15s
Validate Helm Charts / Trivy config zipline (pull_request) Successful in 13s
Validate Helm Charts / Build apache-tika (pull_request) Successful in 5s
Validate Helm Charts / Trivy config apache-tika (pull_request) Successful in 22s
Validate Helm Charts / Build bulwark (pull_request) Successful in 6s
Validate Helm Charts / Build calibre-web-automated (pull_request) Successful in 5s
Validate Helm Charts / Build cyberchef (pull_request) Successful in 4s
Validate Helm Charts / Build bentopdf (pull_request) Successful in 8s
Validate Helm Charts / Build freesailarr (pull_request) Successful in 6s
Validate Helm Charts / Build garage (pull_request) Successful in 7s
Validate Helm Charts / Build gotenberg (pull_request) Successful in 6s
Validate Helm Charts / Build homeassistant (pull_request) Successful in 6s
Validate Helm Charts / Build keycloak (pull_request) Successful in 6s
Validate Helm Charts / Build matrix-synapse (pull_request) Successful in 6s
Validate Helm Charts / Build minecraft-router (pull_request) Successful in 5s
Validate Helm Charts / Build minecraft-server (pull_request) Successful in 5s
Validate Helm Charts / Build rallly (pull_request) Successful in 6s
Install-test / Install-test apache-tika (pull_request) Successful in 1m7s
Install-test / Install-test bentopdf (pull_request) Successful in 52s
Install-test / Install-test bulwark (pull_request) Successful in 1m16s
Install-test / Install-test calibre-web-automated (pull_request) Successful in 1m45s
Install-test / Install-test cyberchef (pull_request) Successful in 52s
Install-test / Install-test freesailarr (pull_request) Successful in 3m33s
Install-test / Install-test garage (pull_request) Successful in 1m10s
Install-test / Install-test gotenberg (pull_request) Successful in 1m10s
Install-test / Install-test homeassistant (pull_request) Successful in 2m8s
Install-test / Install-test keycloak (pull_request) Successful in 2m13s
Install-test / Install-test minecraft-server (pull_request) Successful in 1m41s
Install-test / Install-test rss-bridge (pull_request) Successful in 44s
Install-test / Install-test matrix-synapse (pull_request) Successful in 1m24s
Install-test / Install-test minecraft-router (pull_request) Successful in 38s
Install-test / Install-test outline (pull_request) Successful in 2m6s
Install-test / Install-test paperless-ngx (pull_request) Successful in 3m5s
Install-test / Install-test patchmon (pull_request) Successful in 1m21s
Install-test / Install-test rallly (pull_request) Successful in 1m45s
Install-test / Install-test samba (pull_request) Successful in 1m9s
Install-test / Install-test sure (pull_request) Successful in 2m11s
Install-test / Install-test urlaubsverwaltung (pull_request) Successful in 1m48s
Install-test / Install-test valkey (pull_request) Successful in 1m17s
Install-test / Install-test searxng (pull_request) Successful in 1m12s
Install-test / Install-test stalwart (pull_request) Successful in 1m37s
Install-test / Install-test teamspeak-server (pull_request) Successful in 1m14s
Install-test / Install-test voucher-vault (pull_request) Successful in 2m4s
Install-test / Install-test ytdlp-web-player (pull_request) Successful in 59s
Install-test / Install-test zipline (pull_request) Successful in 1m55s
Validate Helm Charts / Install-test (pull_request) Successful in 44m24s
matrix-synapse, paperless-ngx, freesailarr, valkey, stalwart. One major each.
All 29 installable charts plus template-chart now render a policy, and
ci/run-networkpolicy-test.sh passes over all 30 with 206 assertions held.
MATRIX-SYNAPSE renders TWO policies, one per workload, and the split is the
decision in that file. Synapse federates - it must be able to reach any
homeserver on the internet, so 443 and 8448 go to any destination - while the
delegation nginx serves two static JSON documents and calls nobody, so its
egress is DNS and nothing else. A single policy over both pods would have to
permit the union, handing full federation reach and the database port to an
nginx whose job is to return a constant, and it would read as one decision
rather than as a widening. networkPolicy.egress.extraPorts deliberately does
not reach the delegation policy for the same reason.
PAPERLESS-NGX names the two pods of its own release that this object does NOT
cover: the valkey subchart's pod, which carries its own labels and needs no
cover because the valkey chart ships a tighter policy of its own; and the
consume CronJob's pods, whose pod template carries NO LABELS AT ALL, so no
podSelector can match them. That second one is a real gap in the convention. It
is tolerable only because the job moves files between mounted volumes and
reaches the SMB share through a CSI volume the node mounts - the pod opens no
connection of its own - and if that ever changes the CronJob needs labels
before it can need a policy.
FREESAILARR is ten containers in one pod behind a VPN, and simpler than that
sounds: they share a network namespace, so all inter-container traffic is
localhost and no policy sees any of it. Because the namespace belongs to
gluetun, everything the *arr containers send is encapsulated before it leaves,
so three rules describe the whole outbound surface - DNS, UDP 51820 for the
tunnel, and 443 for gluetun's server-list API, which cannot go through the
tunnel because it runs before the tunnel exists. The tunnel rule is the one
that can break this chart and also the best covered: gluetun's health server
answers 200 only while the tunnel is up and all three of its probes address it,
so a blocked 51820 is a pod that never goes Ready - in the install-test, which
brings up a real tunnel.
VALKEY AND STALWART, the two charts that had a policy before this issue, are
pulled onto the convention without a single rule changing. What changed:
- the reasoning moved out of "#" comments, which are part of the rendered
object and travel into the cluster, into template comments. Both files
failed the new check; that is what it is for.
- stalwart gains networkPolicy.ingressController, which fixes a hole its own
comment described without being able to solve: it advised putting the
controller's namespace into allowedNamespaces, which is namespace-granular
and would have opened the http port to every pod in kube-system.
- stalwart's example was WRONG and is corrected. It suggested
["ingress-nginx"]; measured on 2026-10-14, ingress-nginx is gone from this
cluster entirely and the controller is rke2-traefik in kube-system. A policy
written against the old one would have been accepted, looked strict, and
silently blocked all web traffic.
Their justified specifics are untouched: valkey stays Ingress-only, because it
opens no outbound connection and an egress rule would constrain nothing while
making the object look stricter; and it keeps 6379 restricted by source with no
probeSources at all, which is safe only because all three of its probes are
exec probes and put no packet on the network. The convention was written to
accommodate both, and homeassistant and satisfactory now invoke valkey's rule
in the other direction.
ONE CHANGE TO THE TEST, forced by a structural fact rather than by convenience:
the rendered-comment assertion now skips documents from a SUBCHART. A
dependency is fetched from the Helm registry, not from the copy in this
repository, so the policy paperless-ngx and stalwart bundle is whatever valkey
version is PUBLISHED - and nothing in the parent chart can change its rendered
comments. Holding the parent responsible would have made the test unfixable
until valkey's next release and would fail a chart for a file its own diff does
not contain. The subchart's own pull request is where it is caught, because this
test runs over every chart including valkey itself. All twelve failure paths
were re-run against the change.
Part of #5
458 lines
25 KiB
Plaintext
458 lines
25 KiB
Plaintext
{{- /*
|
|
NOTHING IN CI READS THIS FILE. `helm template` does not emit notes and no
|
|
workflow or script under ci/ reads it, so every claim below carries
|
|
review-only assurance - it is checked by being read, not by a stage. A
|
|
rendering ERROR here does fail `helm template`, which is all the pipeline can
|
|
see of it.
|
|
*/ -}}
|
|
{{- $replicas := include "matrix-synapse.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.matrix.replicas) -}}
|
|
{{- $delegation := .Values.matrix.delegation | default dict -}}
|
|
{{- $httpRoute := .Values.httpRoute | default dict -}}
|
|
{{- $httpRouteDelegation := $httpRoute.delegation | default dict -}}
|
|
{{- /*
|
|
"Published" rather than "has an Ingress": the two modes are alternatives, and
|
|
every paragraph below that used to ask ingress.enabled was really asking
|
|
whether anything publishes this release. Gitea #114, and the sure.publishedOverTls
|
|
/ freesailarr.published shape.
|
|
*/ -}}
|
|
{{- $published := or .Values.ingress.enabled $httpRoute.enabled -}}
|
|
{{- $hostnames := $httpRoute.hostnames | default list -}}
|
|
{{- if not $hostnames -}}
|
|
{{- $hostnames = list .Values.ingress.domain -}}
|
|
{{- end -}}
|
|
{{- $delegationHostnames := $httpRouteDelegation.hostnames | default list -}}
|
|
{{- if not $delegationHostnames -}}
|
|
{{- $delegationHostnames = list $delegation.serverUrl -}}
|
|
{{- end -}}
|
|
{{- $delegationReplicas := include "matrix-synapse.replicas" (dict "scaleDown" .Values.scaleDown "replicas" $delegation.replicas) -}}
|
|
{{- $res := fromYaml (include "matrix-synapse.effectiveResources" .Values.matrix.resources) -}}
|
|
{{- $eph := index ($res.limits | default dict) "ephemeral-storage" | default "the computed ephemeral-storage limit" -}}
|
|
{{- $startup := fromYaml (include "matrix-synapse.startupProbe" .Values.matrix.startupProbe) -}}
|
|
{{- $budget := "" -}}
|
|
{{- if and (kindIs "float64" $startup.periodSeconds) (kindIs "float64" $startup.failureThreshold) -}}
|
|
{{- $budget = printf "%.0f seconds" (mulf $startup.periodSeconds $startup.failureThreshold) -}}
|
|
{{- end -}}
|
|
{{- $sfs := printf "%s-%s-sfs" .Release.Name .Chart.Name -}}
|
|
{{- $pod := printf "%s-0" $sfs -}}
|
|
Matrix Synapse {{ .Chart.AppVersion }} — release {{ .Release.Name }} in namespace {{ .Release.Namespace }}.
|
|
|
|
{{- if .Values.ingress.enabled }}
|
|
|
|
ACCESS — INGRESS MODE (ingress.enabled: true, httpRoute.enabled: false)
|
|
https://{{ .Values.ingress.domain }}
|
|
|
|
That host carries the whole client and federation API: the Ingress sends "/"
|
|
on it to the Synapse Service, which forwards port 80 to the container's
|
|
8008. The certificate is requested by cert-manager through the
|
|
"{{ .Values.ingress.clusterIssuer }}" cluster issuer; until it has been issued the browser
|
|
shows a warning and federation fails. Follow it with
|
|
|
|
kubectl -n {{ .Release.Namespace }} get certificate tls-{{ .Release.Name }}-{{ .Chart.Name }}-ingress
|
|
{{- else if $httpRoute.enabled }}
|
|
|
|
ACCESS — GATEWAY MODE (httpRoute.enabled: true, ingress.enabled: false)
|
|
{{- range $hostnames }}
|
|
https://{{ . }}
|
|
{{- end }}
|
|
|
|
That host carries the whole client and federation API: the HTTPRoute sends
|
|
"/" on it to the Synapse Service, which forwards port 80 to the container's
|
|
8008.
|
|
|
|
THIS RELEASE RENDERS {{ if $delegation.enabled }}TWO HTTPRoutes{{ else }}ONE HTTPRoute{{ end }} AND NOTHING ELSE of the routing
|
|
path — no Gateway, no class, no Certificate, no policy object.
|
|
|
|
{{ .Release.Name }}-{{ .Chart.Name }}-httproute {{ join ", " $hostnames }}
|
|
{{- if $delegation.enabled }}
|
|
{{ .Release.Name }}-{{ .Chart.Name }}-delegation-httproute {{ join ", " $delegationHostnames }}
|
|
{{- end }}
|
|
|
|
Three things therefore belong to the cluster, and if any is missing the
|
|
hostname does not answer — which for Matrix means federation is down, not
|
|
just the web client:
|
|
|
|
1. The Gateway-API CRDs. Without them this install would have failed, so
|
|
they are present — nothing to check.
|
|
2. The Gateway(s) named in parentRefs
|
|
{{- range $httpRoute.parentRefs }}
|
|
{{ .name }}{{ if .namespace }} in namespace {{ .namespace }}{{ end }}{{ if .sectionName }}, listener {{ .sectionName }}{{ end }} (homeserver)
|
|
{{- end }}
|
|
{{- if $delegation.enabled }}
|
|
{{- range ($httpRouteDelegation.parentRefs | default $httpRoute.parentRefs) }}
|
|
{{ .name }}{{ if .namespace }} in namespace {{ .namespace }}{{ end }}{{ if .sectionName }}, listener {{ .sectionName }}{{ end }} (delegation)
|
|
{{- end }}
|
|
{{- end }}
|
|
must exist AND their listeners must allow routes from this namespace
|
|
({{ .Release.Namespace }}) in allowedRoutes. A rejected attachment is visible only
|
|
in the route's status:
|
|
|
|
kubectl -n {{ .Release.Namespace }} get httproute {{ .Release.Name }}-{{ .Chart.Name }}-httproute -o yaml
|
|
|
|
Read status.parents[].conditions — "Accepted: True" and
|
|
"ResolvedRefs: True" is what a working attachment looks like. An empty
|
|
status means no controller has looked at the route at all.
|
|
3. {{ if $delegation.enabled }}The TLS certificates — one per hostname, on the Gateway's listeners,
|
|
or one wildcard listener covering both{{ else }}The TLS certificate for the hostname, on the Gateway's listener{{ end }}.
|
|
ingress.clusterIssuer is NOT used in this mode and is not required: the
|
|
chart renders no Certificate here, so there is no
|
|
tls-{{ .Release.Name }}-{{ .Chart.Name }}-ingress secret{{ if $delegation.enabled }} and no
|
|
tls-{{ .Release.Name }}-{{ .Chart.Name }}-delegation secret{{ end }} and nothing for
|
|
cert-manager to do for this release. MATRIX FEDERATION IS HTTPS-ONLY,
|
|
so a listener without a valid certificate for these names is a
|
|
federation outage that no probe in this release can see.
|
|
|
|
THE UPLOAD LIMIT IS NOT ENFORCED BY ANYTHING THIS CHART RENDERS.
|
|
|
|
In Ingress mode an operator sets
|
|
nginx.ingress.kubernetes.io/proxy-body-size through ingress.annotations —
|
|
this installation runs with 50m — because Synapse's media repository takes
|
|
uploads and nginx's default of 1m rejects nearly all of them. IN THIS MODE
|
|
THAT IS GONE: the Gateway API has no body-size field, it is implementation
|
|
policy rather than routing, and this chart renders no policy object on
|
|
purpose (it would bind the chart to one Gateway implementation).
|
|
|
|
The ceiling in force is the smaller of max_upload_size in your
|
|
homeserver.yaml — which this chart cannot see, it comes from 1Password —
|
|
and whatever the GATEWAY enforces. Neither number anyone can point at is
|
|
necessarily the one that decides. Set the Gateway's half, in your
|
|
implementation's own object, to match max_upload_size, BEFORE you point DNS
|
|
at it.
|
|
|
|
AND ONE THING NOT TO RE-CREATE. The live Ingress also carries a
|
|
configuration-snippet of three more_set_headers directives
|
|
(X-Forwarded-For $remote_addr, X-Forwarded-Proto $scheme, Host). It LOOKS
|
|
like what Synapse's x_forwarded setting depends on. It is not:
|
|
more_set_headers is the headers-more module's OUTPUT-header directive, so
|
|
those three headers go on the RESPONSE TO THE CLIENT and Synapse never sees
|
|
them. What Synapse reads with x_forwarded: true is the REQUEST's
|
|
X-Forwarded-For, which the proxy supplies by itself. Do not spend effort
|
|
rebuilding this at the Gateway, and do not read its absence as the cause of
|
|
a rate-limiting or federation problem. (This is a reading of the directive's
|
|
documented semantics; nothing here A/B-tested a Synapse instance.)
|
|
|
|
ingress.annotations is inert in this mode in general: the Gateway API has no
|
|
annotation channel for controller behaviour.
|
|
{{- else }}
|
|
|
|
ACCESS — NEITHER INGRESS NOR HTTPROUTE
|
|
ingress.enabled and httpRoute.enabled are both false, so this release has no
|
|
Ingress, no HTTPRoute and no certificate; ingress.clusterIssuer is not
|
|
needed.
|
|
{{- if $delegation.enabled }}
|
|
ingress.domain still is: the delegation nginx renders it into the
|
|
/.well-known/matrix/* documents, so it stays the host every other Matrix
|
|
server is told to talk to, not merely an Ingress entry.
|
|
{{- else }}
|
|
With the delegation off as well, ingress.domain is read by nothing in this
|
|
release — no object rendered here carries it.
|
|
{{- end }}
|
|
Reach the server inside the cluster with
|
|
|
|
kubectl -n {{ .Release.Namespace }} port-forward svc/{{ .Release.Name }}-{{ .Chart.Name }}-service 8008:80
|
|
|
|
and point a client at http://127.0.0.1:8008/. Nothing in this release
|
|
terminates TLS, and Matrix federation is HTTPS-only: no remote server can
|
|
reach this one until something in front of the cluster serves this Service
|
|
over HTTPS{{ if .Values.ingress.domain }} as https://{{ .Values.ingress.domain }}{{ end }}.
|
|
{{- end }}
|
|
{{- if $delegation.enabled }}
|
|
|
|
DELEGATION — TWO HOSTNAMES THAT ARE NOT INTERCHANGEABLE
|
|
matrix.delegation.enabled is true, so a second nginx Deployment serves the
|
|
two .well-known documents, filled in from ingress.domain:
|
|
|
|
/.well-known/matrix/server
|
|
→ {"m.server": "{{ .Values.ingress.domain }}:443"}
|
|
/.well-known/matrix/client
|
|
→ {"m.homeserver": {"base_url": "https://{{ .Values.ingress.domain }}"}}
|
|
{{- if $published }}
|
|
|
|
{{ if $httpRoute.enabled }}A SECOND HTTPRoute publishes{{ else }}The Ingress publishes{{ end }} them on a SECOND host. Read that split
|
|
carefully, because the chart cannot check it for you:
|
|
|
|
matrix.delegation.serverUrl ({{ $delegation.serverUrl }})
|
|
is the DELEGATING host — the domain in every user ID (@user:{{ $delegation.serverUrl }}).
|
|
Remote servers look up .well-known here, so this is the name that must
|
|
equal the server_name of the running homeserver.
|
|
ingress.domain ({{ .Values.ingress.domain }})
|
|
is where Synapse actually answers. It appears inside the documents
|
|
above and needs no relation to the server name.
|
|
|
|
Only the path /.well-known/matrix is routed to nginx on {{ join ", " $delegationHostnames }};
|
|
everything else on that host is not served by this release.
|
|
{{- if $httpRoute.enabled }}
|
|
|
|
AND THAT CO-EXISTENCE IS EASIER HERE THAN IT WAS. The server name is usually
|
|
an apex domain that already serves a website, and under ingress-nginx two
|
|
Ingress objects cannot both claim one hostname — the admission webhook
|
|
rejects the second — which is why the delegation rule had to sit inside this
|
|
chart's single Ingress object. HTTPRoutes attached to the same listener for
|
|
the same hostname are MERGED by the implementation, longest match winning,
|
|
so this route may sit beside whatever owns that apex without either side
|
|
knowing about the other.
|
|
|
|
Both hosts need a certificate ON THE GATEWAY'S LISTENERS — this chart renders
|
|
none in this mode — and a listener without a valid certificate for the server
|
|
name is a federation outage, not a cosmetic problem.
|
|
{{- else }}
|
|
Both hosts need
|
|
a certificate — the second one is tls-{{ .Release.Name }}-{{ .Chart.Name }}-delegation — and
|
|
cert-manager only issues it once {{ $delegation.serverUrl }} resolves to this cluster.
|
|
A pending certificate there is a federation outage, not a cosmetic problem.
|
|
{{- end }}
|
|
|
|
Check what is actually being served, from outside the cluster:
|
|
|
|
curl -s https://{{ first $delegationHostnames }}/.well-known/matrix/server
|
|
{{- else }}
|
|
|
|
Nothing publishes them, though: ingress.enabled and httpRoute.enabled are
|
|
both false, so the documents
|
|
exist only on the in-cluster Service {{ .Release.Name }}-{{ .Chart.Name }}-delegation-service, and
|
|
matrix.delegation.serverUrl ({{ $delegation.serverUrl }}) is rendered into no object of this
|
|
release. Whatever terminates TLS in front of the cluster has to route
|
|
https://<server name>/.well-known/matrix to that Service, or federation
|
|
never finds this homeserver. Inspect the documents meanwhile with
|
|
|
|
kubectl -n {{ .Release.Namespace }} port-forward svc/{{ .Release.Name }}-{{ .Chart.Name }}-delegation-service 8080:80
|
|
{{- end }}
|
|
|
|
The nginx image is pinned separately at {{ $delegation.image.repository }}:{{ $delegation.image.tag }} — it is the one
|
|
image in this chart that does not follow the chart's appVersion.
|
|
{{- else }}
|
|
|
|
NO DELEGATION IN THIS RELEASE — FEDERATION LIKELY DOES NOT WORK
|
|
matrix.delegation.enabled is false, so nothing here serves
|
|
/.well-known/matrix/server. A remote server that finds no such document
|
|
falls back to port 8448 of the server name — and this release exposes no
|
|
8448 anywhere: the container publishes 8008 only, and the Service maps port
|
|
80 onto it. Unless the delegation is served by something else (a static
|
|
.well-known on the server-name host, or an SRV record), federation stays
|
|
broken{{ if $published }} while clients on {{ first $hostnames }} work fine{{ end }}.
|
|
Setting matrix.delegation.enabled to true and matrix.delegation.serverUrl
|
|
to the server name lets this chart serve it.
|
|
{{- end }}
|
|
{{- if or (eq $replicas "0") (and $delegation.enabled (eq $delegationReplicas "0")) }}
|
|
|
|
SCALED TO ZERO
|
|
{{- if .Values.scaleDown }}
|
|
scaleDown: true — every workload of this release runs with replicas: 0.
|
|
{{- else }}
|
|
{{- if eq $replicas "0" }}
|
|
matrix.replicas: 0 — the Synapse StatefulSet runs with replicas: 0.
|
|
{{- end }}
|
|
{{- if and $delegation.enabled (eq $delegationReplicas "0") }}
|
|
matrix.delegation.replicas: 0 — the delegation nginx runs with replicas: 0,
|
|
so the .well-known documents 404 while remote servers keep asking for them.
|
|
{{- end }}
|
|
{{- end }}
|
|
The PVC, the Secret and the Services stay in place, so no data is lost{{ if .Values.ingress.enabled }} and
|
|
the certificates are not re-issued{{ else if $httpRoute.enabled }} and the
|
|
HTTPRoutes stay in place, so the hostnames keep pointing at Services with no
|
|
endpoints — the Gateway answers with an error of its own rather than with
|
|
nothing, and remote homeservers see a failing .well-known instead of an
|
|
unresolvable name{{ end }}. Set it back and upgrade again to
|
|
return.
|
|
{{- end }}
|
|
|
|
SECRETS — WHAT THE 1PASSWORD ITEM MUST CARRY
|
|
secrets.configSecretRef → {{ .Values.secrets.configSecretRef }}
|
|
→ OnePasswordItem and Secret {{ .Release.Name }}-{{ .Chart.Name }}-config-secret
|
|
|
|
The operator copies the item's FIELDS into that Secret, one key per field
|
|
name, and this chart reads exactly one of them. The item therefore needs a
|
|
field named literally
|
|
|
|
homeserver.yaml
|
|
|
|
holding the COMPLETE Synapse configuration file; it is mounted read-only at
|
|
/data/homeserver.yaml. A field spelled differently produces a Secret without
|
|
that key, the pod never starts, and the reason appears only as a volume
|
|
error in "kubectl -n {{ .Release.Namespace }} describe pod {{ $pod }}" — the
|
|
Secret itself exists, so the operator looks as if it had done its job.
|
|
|
|
Four settings inside that file are dictated by this chart's mounts, and
|
|
getting them wrong is not a config error the app reports clearly:
|
|
|
|
media_store_path: /media_store the second PVC subPath. The root
|
|
filesystem is read-only, so a path
|
|
outside /data, /media_store and /tmp
|
|
fails on the first upload.
|
|
signing_key_path: under /data the federation identity. Losing it
|
|
makes this server a stranger to every
|
|
server that ever spoke to it.
|
|
log_config: under /data anywhere else is unwritable.
|
|
a listener on port 8008, type http — the Service and all three probes
|
|
target that port by name.
|
|
|
|
This chart deploys NO database. Whatever "database:" names — an external
|
|
PostgreSQL, or an SQLite file, which then has to live under /data — must
|
|
exist and be reachable from namespace {{ .Release.Namespace }}.
|
|
|
|
Note that /data is the PVC and homeserver.yaml is mounted ON TOP of it: a
|
|
homeserver.yaml already lying in the volume (from a "synapse generate" run,
|
|
for instance) is shadowed and never read. What runs is the item's content.
|
|
|
|
CHANGING THE ITEM DOES NOT RESTART SYNAPSE
|
|
Pointing secrets.configSecretRef at a DIFFERENT item changes the rendered
|
|
StatefulSet and rolls the pod. Changing the content INSIDE the same item
|
|
does not: Helm never sees that content, so nothing in the pod template
|
|
changes — and because the file is a subPath mount, the kubelet does not
|
|
refresh it in the running container either. Both halves have to be undone
|
|
by hand:
|
|
|
|
kubectl -n {{ .Release.Namespace }} rollout restart statefulset/{{ $sfs }}
|
|
|
|
The operator's own "auto-restart" annotation is no substitute here: it
|
|
restarts Deployments, and this workload is a StatefulSet. The delegation
|
|
nginx is the opposite case — its ConfigMap is hashed into the pod template
|
|
(checksum/config), so a changed ingress.domain rolls it automatically.
|
|
|
|
THE SERVER NAME IS DECIDED ONCE, AND NOT BY matrix.serverName
|
|
matrix.serverName ({{ .Values.matrix.serverName }}) is rendered into the SYNAPSE_SERVER_NAME
|
|
environment variable. The server that actually runs reads its name from
|
|
"server_name:" in the mounted homeserver.yaml — the env var matters to the
|
|
image only when it generates a configuration, which is not what happens
|
|
here. Changing matrix.serverName alone rolls the pod and changes nothing
|
|
else.
|
|
|
|
And the name cannot be changed afterwards at all: it is baked into every
|
|
user ID, room ID and event this server has ever signed. A server that needs
|
|
a different name is a new server with a new database, not an upgrade. Decide
|
|
it before the first start — together with matrix.delegation.serverUrl, which
|
|
has to match it.
|
|
{{- if and $published $delegation.enabled .Values.matrix.serverName $delegation.serverUrl }}
|
|
{{- if ne (printf "%v" .Values.matrix.serverName) (printf "%v" $delegation.serverUrl) }}
|
|
|
|
MISMATCH IN THIS RELEASE: matrix.serverName is "{{ .Values.matrix.serverName }}" but the
|
|
delegation is published on "{{ $delegation.serverUrl }}". Remote servers resolve
|
|
.well-known on the SERVER NAME, so unless something outside this chart
|
|
serves it on "{{ .Values.matrix.serverName }}", the nginx deployed here is
|
|
never asked. Both values name the same host in a working setup.
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
WHAT A READY POD PROVES — AND WHAT IT DOES NOT
|
|
All three Synapse probes hit /health, which answers 200 as soon as the HTTP
|
|
listener is up. It says nothing about the database, the signing key or
|
|
federation: a homeserver.yaml pointing at an unreachable database usually
|
|
fails at start (CrashLoopBackOff, log only), but every problem that appears
|
|
later leaves the pod Ready. The startup probe covers the first start{{ if $budget }}
|
|
({{ $budget }}), which is where schema migrations and cache warmup happen{{ end }}:
|
|
|
|
kubectl -n {{ .Release.Namespace }} logs {{ $pod }}
|
|
{{- if $delegation.enabled }}
|
|
|
|
The delegation probe is weaker still. It requests
|
|
/.well-known/matrix/server, and that endpoint is a static "return 200" in
|
|
the generated nginx.conf — it passes with a wrong ingress.domain baked into
|
|
the document. Read the body, not the probe.
|
|
{{- end }}
|
|
|
|
THE VOLUME BELONGS TO THIS RELEASE
|
|
/data (database when SQLite, signing key, log config) and /media_store (all
|
|
uploaded media) are two subPaths of ONE ReadWriteOnce claim,
|
|
{{ .Release.Name }}-{{ .Chart.Name }}-pvc ({{ .Values.storage.amount }}{{ if .Values.storage.storageClass }} from storageClass {{ .Values.storage.storageClass }}{{ end }}). It is an
|
|
ordinary PVC in this release, not a StatefulSet volumeClaimTemplate, and it
|
|
carries no resource-policy annotation: "helm uninstall {{ .Release.Name }}" deletes it, and
|
|
with a Delete reclaim policy the media and the signing key go with it. Add
|
|
the annotation to the live PVC afterwards and it still will not help — Helm
|
|
reads that annotation from the release manifest. Back the volume up first.
|
|
|
|
Growing storage.amount only takes effect if the StorageClass allows volume
|
|
expansion; shrinking it is refused by Kubernetes and fails the next upgrade
|
|
on the PVC instead of touching the data. Media is what grows here, and it
|
|
grows without an upper bound unless the homeserver.yaml sets retention.
|
|
|
|
The container runs as uid/gid 1000 with fsGroup 1000 — the gosu default the
|
|
upstream image used before this chart pinned the user, so data written by
|
|
an older release stays readable. Files in the volume that belong to
|
|
another uid — restored from a backup, written by an older release — are not
|
|
readable, and the signing key (mode 0600) is the first thing to fail.
|
|
|
|
Everything else the process writes has to go to /tmp, which is an emptyDir
|
|
and counts against the container's ephemeral-storage limit ({{ $eph }}).
|
|
Raise matrix.resources.requests.ephemeralStorage to move it; the limit
|
|
follows through matrix.resources.limitFactor.
|
|
{{- if gt (atoi $replicas) 1 }}
|
|
|
|
MORE THAN ONE SYNAPSE REPLICA WILL NOT WORK
|
|
matrix.replicas is {{ $replicas }}, but every pod of this StatefulSet mounts the same
|
|
ReadWriteOnce claim {{ .Release.Name }}-{{ .Chart.Name }}-pvc and the same homeserver.yaml — there is
|
|
no volumeClaimTemplate and no per-pod configuration. Additional pods either
|
|
stay Pending on a node without the volume, or start as a second full
|
|
homeserver on the same data. Scaling Synapse means running workers with
|
|
distinct configurations, which this chart does not deploy.
|
|
{{- end }}
|
|
{{- if .Values.matrix.env }}
|
|
|
|
matrix.env IS APPENDED, NOT MERGED
|
|
Its {{ len .Values.matrix.env }} entr{{ if eq (len .Values.matrix.env) 1 }}y lands{{ else }}ies land{{ end }} after the three the chart sets itself —
|
|
SYNAPSE_SERVER_NAME, SYNAPSE_REPORT_STATS ("no") and TZ ({{ .Values.matrix.timezone }}) — so
|
|
repeating one of those names leaves two entries of the same name in the pod
|
|
spec. Values are rendered through tpl and may contain template expressions.
|
|
Anything sensitive belongs in valueFrom.secretKeyRef: a plain "value" is
|
|
stored in the pod spec and readable by everyone who can read pods in
|
|
{{ .Release.Namespace }}. Note that Synapse takes its real configuration from
|
|
homeserver.yaml, not from the environment.
|
|
{{- end }}
|
|
{{- if .Values.networkPolicy.enabled }}
|
|
|
|
NETWORKPOLICY IS ACTIVE — TWO OBJECTS, ONE PER WORKLOAD
|
|
{{ .Release.Name }}-{{ .Chart.Name }}-networkpolicy selects the Synapse pods and
|
|
{{ .Release.Name }}-{{ .Chart.Name }}-delegation-networkpolicy the delegation nginx. They are
|
|
separate because their needs are opposite: Synapse federates and must be able
|
|
to reach any homeserver on the internet, while the delegation server returns
|
|
two static JSON documents and calls nobody. One policy over both pods would
|
|
have to permit the union — handing full federation reach and the database port
|
|
to an nginx that serves a constant.
|
|
|
|
Synapse: inbound TCP 8008 only; outbound DNS, TCP 5432 (Postgres), 443 and
|
|
8448 (federation, remote media, push gateways, identity servers){{ with .Values.networkPolicy.egress }}{{ with .extraPorts }}, plus TCP
|
|
{{ join ", " . }}{{ end }}{{ end }}.
|
|
Delegation nginx: inbound TCP 8080 only; outbound DNS and nothing else —
|
|
networkPolicy.egress.extraPorts deliberately does not widen it.
|
|
|
|
Three limits, none of them visible in the objects themselves:
|
|
|
|
- FEDERATION CANNOT BE NARROWED. 443 and 8448 go to ANY destination, because
|
|
a federating homeserver may contact any other homeserver there is, and a
|
|
NetworkPolicy matches CIDRs and selectors but never hostnames — with this
|
|
cluster's CNI (Canal: Flannel plus Calico) there is no FQDN rule either.
|
|
What the cap still buys is real: Synapse can open NO other outbound port,
|
|
so a compromised instance reaches no other database, no SSH and no mail
|
|
server in the cluster.
|
|
- 5432 IS THE STANDARD PORT, NOT YOUR CONFIGURED ONE. Synapse's Postgres
|
|
connection lives inside secrets.configSecretRef, which this chart never
|
|
parses. A database elsewhere is blocked — put its port in
|
|
networkPolicy.egress.extraPorts. The same applies to a TURN server for
|
|
voice, or to SMTP if this release sends mail.
|
|
{{- if .Values.networkPolicy.probeSources }}
|
|
- THE PROBE PATHS ARE RESTRICTED in this release, because
|
|
networkPolicy.probeSources is set to
|
|
{{ join ", " .Values.networkPolicy.probeSources }}
|
|
Probes come from the IP of the WORKER NODE running the pod. If none of those
|
|
CIDRs covers the node a pod lands on, its probes are dropped and THE POD
|
|
NEVER BECOMES READY — the rollout times out and the symptom looks like a
|
|
broken application.
|
|
|
|
AND CHECK FEDERATION AFTER THIS CHANGE, not just the web UI. Inbound
|
|
federation reaches Synapse through the Ingress, and every remote homeserver
|
|
that wants to federate fetches /.well-known/matrix from the delegation
|
|
server — so a wrong ingressController here stops federation and stops it
|
|
being discoverable, and that failure appears on OTHER people's servers
|
|
before it appears on yours.
|
|
{{- else }}
|
|
- BOTH PROBE PORTS ARE OPEN INSIDE THE CLUSTER. networkPolicy.probeSources is
|
|
empty, so neither rule carries a source selector and any pod the CNI routes
|
|
to can reach them. Not from the internet — neither port has a NodePort —
|
|
but this is NOT pod-level isolation. Narrowing it means listing the worker
|
|
node IPs, because the kubelet probes from the node's own address and the
|
|
chart cannot know it; a wrong guess leaves the pod permanently un-Ready.
|
|
{{- end }}
|
|
|
|
Switch both off with networkPolicy.enabled: false. And remember that a policy
|
|
is only a boundary where the CNI enforces one — unenforced, both objects are
|
|
accepted and filter nothing, so everything reads as configured.
|
|
{{- end }}
|