Project

General

Profile

Fix #43165

Feature #40907: mgr/dashboard: REST API improvements

mgr/dashboard: remove `/api/orchestrator/<resource>` endpoints if possible

Added by Kiefer Chang 10 months ago. Updated about 2 months ago.

Status:
New
Priority:
High
Assignee:
-
Category:
dashboard/backend
Target version:
% Done:

50%

Source:
Tags:
Backport:
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature:

Description

We are using `/api/orchestrator/<resource>` endpoints to expose information from orchestrator to users.
In order to make the API much RESTful, we should try to minimize the use of the endpoints and integrate those orchestrator calls into suitable existing endpoints.
See these discussions for more information:

Some thoughts of improvement:

/api/orchestrator/status

Keep it or move to /api/summary.

/api/orchestrator/inventory

We use this endpoint to expose devices that belonged to all hosts or one host.

/api/orchestrator/inventory
/api/orchestrator/inventory?hostname=node1

Which might be moved to:

/api/host/node1/devices
The difficulties here are:
  • /host/<hostname>/devices endpoints is already used for devices reported from Ceph. Which needs further integration.
  • There is a page Cluster -> Inventory that lists all devices on all hosts. To keep that page, we need to
    • forkjoin or merge individual calls for each host
    • Create a special endpoint to return all inventory devices, which is the reason I choose /api/orchestrator/inventory before.

/api/orchestrator/service (Moved to /api/services)

May just rename to /api/service.

/api/orchestrator/osd (Removed)

Integrate into /api/osd.

History

#1 Updated by Alfonso Martínez 10 months ago

  • Parent task set to #40907

#2 Updated by Lenz Grimmer 10 months ago

Adding a comment from Ernesto on PR#31851 :

If I were a user of this REST API and wanted to blink lights on a device device_id attached to host host_id I would first look for something like /api/host/<host_id>/device/<device_id>, but I wouldn't figure out that I need to go to some API endpoint called /orchestrator/identify_device

#3 Updated by Lenz Grimmer 10 months ago

  • Priority changed from Normal to High
  • Target version set to v15.0.0

Raising priority and setting target version to "15.0.0" - this ought to be fixed before the Octopus stable release.

#4 Updated by Ernesto Puerta 10 months ago

/api/orchestrator/status
Keep it or move to /api/summary.

We can keep this one (perhaps moving it to the root component /api/orchestrator). This simply returns something like:

{
  "available": true,
  "description": "" 
}

/api/orchestrator/inventory
The difficulties here are:
/host/<hostname>/devices endpoints is already used for devices reported from Ceph. Which needs further integration.
There is a page Cluster -> Inventory that lists all devices on all hosts. To keep that page, we need to
forkjoin or merge individual calls for each host
Create a special endpoint to return all inventory devices, which is the reason I choose /api/orchestrator/inventory before.

We may introduce URI templates - RFC6570 (as a way of mapping single URIs to multiple resources either client or server-side, and there are distro-packaged libraries for Python and JS). Nevertheless, the mapping is resolved statically. There's no such a thing as "/hosts/{*}/devices" meaning "fetch all devices from all hosts" (although "/hosts/{host_id}/devices" could do the trick). I think this server-side expansions can be dangerous, as they are basically "SELECT *"-like queries, which might cause scalability issues (e.g.: OSDs, RBD images, RGW buckets, etc.) and force the front-end to perform paged queries by default.

#5 Updated by Kiefer Chang 4 months ago

  • Description updated (diff)

Some endpoints are removed. The description is updated to reflect the current state.

#6 Updated by Ernesto Puerta 4 months ago

  • % Done changed from 0 to 50

Kiefer Chang wrote:

Some endpoints are removed. The description is updated to reflect the current state.

I will update the %progress of this issue. Would you mind adding a comment with the PR where this has been changed? Thanks a lot, Kiefer!

#7 Updated by Stephan Müller about 2 months ago

How about moving the calls

/api/orchestrator/inventory
/api/orchestrator/inventory?hostname=node1

to

/api/host/inventory
or
/ui-api/host/inventory

/api/host/<$host>/inventory
or
/api/host/inventory/<$host>

or

/api/inventory
/api/inventory/<$host>

Also available in: Atom PDF