Repository navigation
Conversation
This patch changes a few things in order to handle cases where a host is no longer logged into a registry but nothing triggers cephadm to attempt to log it back in. The triggers for logins prior to this patch are - New registry login credentials are added (adds all hosts) - A host is newly added to the cluster (just that host) - The entire metadata for a host is invalidated (happens when a host's addr is changed or it is taken out of offline/maintenance status) - mgr failover (adds all hosts) This patch now checks the login status during gather-facts if the module find login credentials available. If we check and are not logged in that host is added to the registry login queue. This patch also now has us mark the existence of login credentials at mgr startup or when new credentials are provided. That should cover the only times we'd need to assuming nobody is manually changing the mgr/cephadm/registry_credentials mon db entry. We also now kick the serve loop after storing new credentials in order to make the login happen quicker in cases where the serve loop was idle. Signed-off-by: Adam King <[email protected]> Resolves: https://tracker.ceph.com/issues/82680
There was a problem hiding this comment.
🟡 Changes recommended
The changes can crash agent metadata collection when the new context attribute is absent and block private-registry logins after bootstrap when cached credential state remains stale.
4 open issues
What changed in this PR
This PR adds registry-login checks to cephadm host-fact collection so hosts that lose authentication can be queued for login again.
Changes:
- Adds a registry-check option to
gather-factsand reports login status in host facts. - Caches credential availability and registry URLs, then queues hosts that report missing logins.
- Wakes the serve loop after credentials are stored and adds queueing tests.
| File | Description |
|---|---|
src/pybind/mgr/cephadm/tests/test_facts.py |
Tests login queueing for false, true, and absent status. |
src/pybind/mgr/cephadm/serve.py |
Passes registry URLs to fact collection and gates queued logins. |
src/pybind/mgr/cephadm/module.py |
Caches credential state and wakes the serve loop after updates. |
src/pybind/mgr/cephadm/inventory.py |
Queues hosts whose facts report missing registry logins. |
src/cephadm/cephadmlib/host_facts.py |
Adds registry-login status to host facts. |
src/cephadm/cephadmlib/container_engines.py |
Adds a container-engine login-status probe. |
src/cephadm/cephadm.py |
Adds the registry-check argument to gather-facts. |
Review effort: Balanced
| @property | ||
| def logged_into_all_container_registries(self) -> bool: | ||
| """Check if host is logged into all container registries if provided to gather-facts command""" | ||
| if not self.ctx.container_registries_to_check: |
| self.mgr.cache.metadata_up_to_date[host] = True | ||
|
|
||
| if self.mgr.cache.host_needs_registry_login(host) and self.mgr.get_store('registry_credentials'): | ||
| if self.mgr.registry_credentials_present and self.mgr.cache.host_needs_registry_login(host): |
| engine = ctx.container_engine | ||
| cmd = [engine.path, 'login', '--get-login', url] | ||
| if isinstance(engine, Podman): | ||
| cmd.append('--authfile=/etc/ceph/podman-auth.json') |
| # on the off chance someone put something that isn't a json object | ||
| # here make sure the module doesn't crash while loading | ||
| try: | ||
| credentials_list = json.loads(registry_credentials).get('registry_credentials', []) |
|
@adk3798 this is a review from Claude, could you plz double check? Review of #73500The approach is sound: Blockers1. The cephadm agent crashes when it gathers facts.
Should-fix2. On Docker hosts the check always fails, so every facts refresh triggers a login.
3. Clusters with old-format credentials never get the check.
4. A failed check logs noise on every refresh. 5. Bad credentials now retry forever. 6. The check only covers the case where the auth entry is missing. Polish
Good as is
|


This patch changes a few things in order to handle cases where a host is no longer logged into a registry but nothing triggers cephadm to attempt to log it back in. The triggers for logins prior to this patch are
This patch now checks the login status during gather-facts if the module find login credentials available. If we check and are not logged in that host is added to the registry login queue.
This patch also now has us mark the existence of login credentials at mgr startup or when new credentials are provided. That should cover the only times we'd need to assuming nobody is manually changing the mgr/cephadm/registry_credentials mon db entry.
We also now kick the serve loop after storing new credentials in order to make the login happen quicker in cases where the serve loop was idle.
Signed-off-by: Adam King [email protected]
Resolves: https://tracker.ceph.com/issues/82680
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.