Repository navigation
mgr/cephadm: track TLS spec changes in deps and cleanup stale certmgr entries on cert source transitions - #67308
Conversation
149c33a to
5ae0214
Compare
9685a8f to
469b7bd
Compare
469b7bd to
695a73d
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue with SSL certificate dependency tracking in cephadm. When services use SSL certificates, changes to the certificate source (inline, reference, or cephadm-signed) need to trigger service reconfiguration, and stale certificate artifacts need to be cleaned up when switching between sources.
Changes:
- Added
certificate_sourceas a tracked dependency for SSL-enabled services, ensuring reconfigurations occur when the certificate source changes - Implemented cleanup logic to remove stale certificate artifacts when services switch certificate sources, while preserving user-provisioned reference certificates
- Added user warnings when certificate sources are changed to inform about potential client disconnections
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/pybind/mgr/cephadm/tlsobject_store.py | Added get_tlsobject_if_exists method for safe certificate lookups without exceptions |
| src/pybind/mgr/cephadm/cert_mgr.py | Added cleanup methods try_rm_self_signed_cert_key_pair and rm_inline_saved_cert_key_pair for certificate lifecycle management |
| src/pybind/mgr/cephadm/services/cephadmservice.py | Updated base get_dependencies to track certificate_source, added reconciliation cleanup in get_certificates_generic, and refactored post_remove for proper scope-aware cleanup |
| src/pybind/mgr/cephadm/services/nfs.py | Removed local SSL dependency tracking in favor of parent class implementation |
| src/pybind/mgr/cephadm/services/monitoring.py | Fixed generate_config to pass spec to get_dependencies, enabling TLS dependency tracking |
| src/pybind/mgr/cephadm/services/ingress.py | Updated to call parent get_dependencies for TLS certificate dependencies |
| src/pybind/mgr/cephadm/services/iscsi.py | Updated to call parent get_dependencies for TLS certificate dependencies |
| src/pybind/mgr/cephadm/services/oauth2_proxy.py | Updated to call parent get_dependencies for TLS certificate dependencies |
| src/pybind/mgr/cephadm/services/mgmt_gateway.py | Updated to call parent get_dependencies for TLS certificate dependencies |
| src/pybind/mgr/cephadm/module.py | Added user warnings for certificate source changes and improved reference certificate provisioning instructions |
| src/pybind/mgr/cephadm/tests/test_services.py | Updated test expectations to account for new certificate_source dependency and adjusted daemon name indices in dependencies list |
| src/pybind/mgr/cephadm/tests/test_certmgr.py | Added comprehensive tests for certificate cleanup logic, dependency tracking, and cross-source transitions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d9e93cd to
474ea9c
Compare
c0e6609 to
6d4d9e9
Compare
|
Tested the PR with dashboard changes, check the screenplay in PR here . It consists of changing the certificate source for a service, where we can see the certificate source changes in the UI and old certs gets deleted Adding more testing logs asap. |
adk3798
left a comment
There was a problem hiding this comment.
The code seems to be doing what you intended it to. I am a bit worried about accidentally cleaning something up here we shouldn't . I didn't really go through the UT (I guess we also need to address how those were generated at some point) and maybe they cover everything, but I just want to stress that this needs to be done carefully. Especially when you consider the variety of different ways of storing and marking certs users could have on their old cluster before they upgrade to a version with this change.
221225e to
f1afafd
Compare
f16ca68 to
fccde2f
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
fccde2f to
a5f30b5
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
This is especially important for inline certificates, so the certmgr store is updated automatically whenever the user changes the values in the spec and reapplies it. Fixes: https://tracker.ceph.com/issues/75009 Signed-off-by: Redouane Kachach <[email protected]>
This PR improves certificate cleanup when a service switches certificate sources (cephadm-signed <-> inline/reference). It also adds best-effort post-remove helpers to purge stale cephadm-managed cert/key pairs. Inline-stored (non-editable) certs/keys are removed, while referenced/user-managed (editable) credentials are preserved. Fixes: https://tracker.ceph.com/issues/75009 Signed-off-by: Redouane Kachach <[email protected]>
a5f30b5 to
c089d26
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
src/pybind/mgr/cephadm/module.py:3945
- In the per-host reference instructions, the key command uses
--key-name {svc.cert_name}. This looks incorrect: it should reference the service's key object name (e.g.grafana_ssl_key), not the cert object name (grafana_ssl_cert). Using the cert name here will store the private key under the wrong object name and the service won't be able to fetch it.
f"\n\n\nWarning: SSL is configured with '{CertificateSource.REFERENCE.value}', and this service uses per-host certificates.\n\n"
f"To configure keys/certificates, run the following commands for each host daemons are deployed on:\n"
f" > ceph orch certmgr cert set --cert-name {svc.cert_name} --service-name {spec.service_name()} --hostname <host> -i <cert-file>\n"
f" > ceph orch certmgr key set --key-name {svc.cert_name} --service-name {spec.service_name()} --hostname <host> -i <key-file>\n\n"
f"Once all certificates are provisioned, run:\n"
b0ce107 to
513961d
Compare
This way we ensure it's called everytime there's a switch in the certificate Signed-off-by: Redouane Kachach <[email protected]>
Fixes: https://tracker.ceph.com/issues/75009 Signed-off-by: Redouane Kachach <[email protected]>
513961d to
16b7a0b
Compare
|
jenkins test make check arm64 |
|
Teuthology run was successful. Failing Test cases are not related to this PR: https://pulpito.ceph.com/rkachach-2026-05-21_15:15:07-orch:cephadm-wip-rkachach-testing-2026-05-21-0933-distro-default-trial/ |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
This PR improves TLS certificate handling for cephadm-managed services:
Include TLS-related spec fields in service deps (certificate_source + hashed ssl_cert/ssl_key/ssl_ca_cert) so changes reliably trigger reconciliation/reconfig.
When switching to certificate_source: reference, remove inline-saved / non-editable certmgr entries (service-scope) to avoid pinning to old inline values and let users provision editable certs/keys via certmgr.
Add best-effort cleanup for leftover TLS credentials during daemon removal and cert source changes, while keeping referenced/user-managed entries.
Fix self-signed “with label” lookup to use the host (not FQDN) when fetching stored credentials.
Fixes: https://tracker.ceph.com/issues/75009
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.