]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: distribute client.admin keyring+conf to label:_admin on bootstrap
authorSage Weil <sage@newdream.net>
Thu, 22 Apr 2021 12:12:49 +0000 (08:12 -0400)
committerSage Weil <sage@newdream.net>
Tue, 4 May 2021 16:22:23 +0000 (11:22 -0500)
If we are placing ceph.conf in /etc/ceph (the default), tell the cluster
to continue doing this going forward to hosts with the '_admin' label.

This doesn't induce the user to add the admin label to other hosts too,
unfortunately--e probably want them to add the admin label to other mons,
for instance--but it is a start.

Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit 08d21ccc949aa19c08c7e806a5b58c0180f5cbe2)

src/cephadm/cephadm

index 093019aebf6b0cdf284e253c98123264bdd30186..305416f0e99d400a2fbedadb5fffba8b05857319 100755 (executable)
@@ -4147,6 +4147,14 @@ def command_bootstrap(ctx):
     if not ctx.skip_dashboard:
         prepare_dashboard(ctx, uid, gid, cli, wait_for_mgr_restart)
 
+    if ctx.output_config == '/etc/ceph/ceph.conf' and not ctx.skip_admin_label:
+        logger.info('Enabling client.admin keyring and conf on hosts with "admin" label')
+        try:
+            cli(['orch', 'client-keyring', 'set', 'client.admin', 'label:_admin'])
+            cli(['orch', 'host', 'label', 'add', get_hostname(), '_admin'])
+        except Exception:
+            logger.info('Unable to set up "admin" label; assuming older version of Ceph')
+
     if ctx.apply_spec:
         logger.info('Applying %s to cluster' % ctx.apply_spec)
 
@@ -7684,6 +7692,10 @@ def _get_parser():
     parser_bootstrap.add_argument(
         '--output-pub-ssh-key',
         help="location to write the cluster's public SSH key")
+    parser_bootstrap.add_argument(
+        '--skip-admin-label',
+        action='store_true',
+        help='do not create admin label for ceph.conf and client.admin keyring distribution')
     parser_bootstrap.add_argument(
         '--skip-ssh',
         action='store_true',