Certificates from mounted directories, reread when renewed #477

Merged
jcoffey-dev merged 1 commits from feat/certificate-file-reload into main 2026-11-19 15:12:23 +00:00
Owner

For the chart's certificates (K-C8, inbuxa/inbuxa-charts#8).

In Kubernetes, cert-manager keeps a certificate in a TLS Secret and renews it in place. Until now the server read certificates only at start and when a Certificate changed in the store. A renewal waited for a restart, and a stored Certificate pointing at the files had to be made by hand on each new store. The seed can't do it: it runs before cert-manager has issued anything.

  • INBUXA_TLS_CERTIFICATE_DIRS names directories that each hold tls.crt and tls.key, as a TLS Secret mounts them. Their certificates are used for the names in them, and aren't stored.
  • Every node checks once a minute the files of those directories and of file-backed stored certificates, and reloads its certificates when they change. A stored one with new dates is written back, which tells the other nodes to reload too.
  • A directory that can't be read, or a certificate that isn't valid now, is a build error and is left out.

Tested with the release build on kind (inbuxa-k8s-lab cert-test.sh): IMAPS serves the Secret's certificate. After the Secret's certificate is replaced, every connection gets the new one in 115 s (the kubelet's sync plus the one-minute check), and no pod restarts. The sign-in test passes.

No new log event for a reload: that would mean seven places in the generated event table. A renewed stored certificate shows by its dates in the console, and errors are logged. Docs: inbuxa/inbuxa.org#174.

For the chart's certificates (K-C8, inbuxa/inbuxa-charts#8). In Kubernetes, cert-manager keeps a certificate in a TLS Secret and renews it in place. Until now the server read certificates only at start and when a Certificate changed in the store. A renewal waited for a restart, and a stored Certificate pointing at the files had to be made by hand on each new store. The seed can't do it: it runs before cert-manager has issued anything. - `INBUXA_TLS_CERTIFICATE_DIRS` names directories that each hold `tls.crt` and `tls.key`, as a TLS Secret mounts them. Their certificates are used for the names in them, and aren't stored. - Every node checks once a minute the files of those directories and of file-backed stored certificates, and reloads its certificates when they change. A stored one with new dates is written back, which tells the other nodes to reload too. - A directory that can't be read, or a certificate that isn't valid now, is a build error and is left out. Tested with the release build on kind (inbuxa-k8s-lab `cert-test.sh`): IMAPS serves the Secret's certificate. After the Secret's certificate is replaced, every connection gets the new one in 115 s (the kubelet's sync plus the one-minute check), and no pod restarts. The sign-in test passes. No new log event for a reload: that would mean seven places in the generated event table. A renewed stored certificate shows by its dates in the console, and errors are logged. Docs: inbuxa/inbuxa.org#174.
jcoffey-dev added 1 commit 2026-11-19 14:15:53 +00:00
Certificates from mounted directories, reread when renewed
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 13m26s
34c5ee53aa
In Kubernetes, cert-manager keeps a certificate in a TLS Secret and renews
it in place. The server read certificates only at start and when a
Certificate changed in the store, so a renewal waited for a restart, and a
stored Certificate pointing at the files had to be created by hand on
every new store.

INBUXA_TLS_CERTIFICATE_DIRS names directories, each holding tls.crt and
tls.key as a TLS Secret mounts them. Their certificates are used for the
names in them and aren't stored. Every node checks the files of these and
of file-backed stored certificates once a minute, and reloads its
certificates when they change. A directory that can't be read, or a
certificate not valid now, is a build error and left out. K-C8.
jcoffey-dev merged commit 915aff1fcc into main 2026-11-19 15:12:23 +00:00
jcoffey-dev deleted branch feat/certificate-file-reload 2026-11-19 15:12:23 +00:00
Sign in to join this conversation.