core: delete bootstrap keys

Delete the client.boostrap.* keys. These keys are not created by rook so
it can't rotate them. This PR just delete these keys in the
postMonStartUpAction.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
This commit is contained in:
Santosh Pillai
2025-09-01 08:55:23 +05:30
parent ffcb0d31d6
commit 4cdba0df54
+17
View File
@@ -525,6 +525,11 @@ func (c *cluster) postMonStartupActions() error {
return errors.Wrap(err, "failed to create cluster rbd bootstrap peer token")
}
// Delete the client.bootstrap-* keys. These keys are created automatically by Ceph and are unused.
// Ceph might remove these keys in the future. It is safe for Rook to remove them if they exist.
// client.bootstrap-osd is used by Rook and is not removed here.
c.deleteBootstrapKeys()
return nil
}
@@ -870,3 +875,15 @@ func initClusterCephxStatus(c *cluster) error {
})
return err
}
func (c *cluster) deleteBootstrapKeys() {
bootstrapKeys := []string{"client.bootstrap-mds", "client.bootstrap-mgr", "client.bootstrap-rbd", "client.bootstrap-rbd-mirror", "client.bootstrap-rgw"}
for _, bootstrapkey := range bootstrapKeys {
err := client.AuthDelete(c.context, c.ClusterInfo, bootstrapkey)
if err != nil {
logger.Debugf("failed to delete bootstrap key %q in the namespace %q. Error: %v", bootstrapkey, c.Namespace, err)
} else {
logger.Infof("successfully deleted bootstrap key %q in the namespace %q", bootstrapkey, c.Namespace)
}
}
}