]> 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, 27 Apr 2021 22:29:49 +0000 (18:29 -0400)
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>
src/cephadm/cephadm

index 15fbb4cf21eeaef99f5d28198c87eb77187a7bd2..ab1ae911827df721a9c6b5ac1936c30d470e01cf 100755 (executable)
@@ -4128,6 +4128,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)
 
@@ -7665,6 +7673,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',