Closed lucabello closed 1 year ago
I don't think it's necessarily in the scope of this issue, which is the failed replan; this behavior when TLS is enabled has been implemented in the TLS PR :)
I'll add it anyway!
After noticing the itests were passing locally, rerunning them fixed things :D
Issue
Fixes #506.
This likely happens when
_configure()
is called by something other than_on_server_cert_changed
(e.g., a perfectly timedupdate-status
), but when the certificate is already in relation data (or Prometheus has already been related through thecertificates
interface but the certificate is not ready yet).Solution
Only add the
tls_server_config
for Prometheus if the certificate exists on the file sytstem.The
_configure()
method is also called by_on_server_cert_changed()
, which (sequentially) writes the cert to disk before calling_configure()
. This means we don't risk skip adding the TLS configuration with this extra check.Testing Instructions
It's pretty much a race condition, so it's hard to add a test for it. I guess trying to replicate the issue is something, though of course it doesn't guarantee it.
Release Notes
Only add the
tls_server_config
for Prometheus if the certificate exists on the file sytstem.