Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Architecture

Adriana Dimitrova edited this page Feb 13, 2018 · 11 revisions

Architecture

Roles

There can be two different roles for resource providers:

Developer

  • creates service instance
  • binds service instance to Resource Provider
  • modifies usage plans
  • (code) submits usage
  • unbinds service instance
  • deletes service instance

Operator

  • deploys Resource Provider
  • creates service instance with service-specific plans configuration
  • update service instance with service-specific plans configuration
  • binds service instance to Resource Provider

Flows

The Abacus Broker supports the following flows:

Provision Resource Provider

  1. Create service instance

    The resource_id is generated by the broker and used in Abacus. This id is global in CF installation/landscape, therefore it is important to be unique. It can be used to submit or retrieve usage later on.

  2. Create plans

    The plan id follows the format <RESOURCE_PROVIDER_ID>-<RESOURCE_ID>. This provides the ability to discover plans. The plans definition could be supplied via a command line parameter and should match the following format:

     {
       "plans": [
         {
           "plan": {
             "plan_id": "standard-object-storage",
             "measures": [
               {
                 "name": "storage",
                 "unit": "BYTE"
               }
             ],
             "metrics": [
               {
                 "name": "storage",
                 "unit": "GIGABYTE",
                 "type": "discrete",
                 "meter": "(m) => new BigNumber(m.storage).div(1073741824).toNumber()",
                 "accumulate": "(a, qty, start, end, from, to, twCell) => end < from || end >= to ? null : Math.max(a, qty)"
               }
             ]
           }
         }
       ]
     }

    ❗ With the current version only one metering plan is supported. For rating and pricing default sample plans are created. The field plan_id is required, but not used yet. In addition to the plan you could also include resource provider specific information. The resource provider section may look like this :

    {
      "plans": [
        {
          "plan": {
            ...
          },
          "resource_provider": {
            "service_name": "ML",
            "service_plan_name": "small"
          }
        }
      ]
    }

    In order to use this functionality you should implement Service plugin (API is described here). In case the parameter is not supplied, all plans are filled with default sample values.

  3. Create UAA client

    The UAA client is created with:

    • id abacus-<resource_id>-<binding_id>
    • scopes: abacus.usage.<resource_id>.read and abacus.usage.<resource_id>.write
  4. Service instance credentials

    credentials: {
      client_id: <UAA_CLIENT_ID>,
      client_secret: <UAA_CLIENT_SECRET>,
      collector_url: <COLLECTOR_URL>,
      resource_id: <RESOURCE_ID>,
      plans: [<RESOURCE_PROVIDER_ID>-<RESOURCE_ID>]
    }
    
  5. Access dashboard

The broker returns a dashboard URL, which points to the UI and contains the service instance ID. In order to return a working URL, we use a dashboard client, whose credentials are shared between the broker and the UI. Credentials also contain a resource_id and list of plans associated to it.

Demo video

Edit Plan

  1. Via dashboard

    1. Open dashboard

    2. Find all resource providers

      The dashboard does plan discovery by looking up all services created with Abacus broker.

    3. Open plan(s) for resource provider

      Since the service instance id is also the plan id we can directly reach Abacus to fetch the plan and display/edit it.

  2. Via command line

    Use the update-service command and provide the configuration parameters matching the format of the create plans above.

De-provision Resource Provider

  1. Delete service instance

  2. Delete UAA client

  3. Mark plans as deleted

    The plans are not deleted, since Abacus can recieve usage several days after the month ended (depends on SLACK setting). The plans are simply marked to be deleted. We can delete the marked-for-deletion plans together with the data after a certain period (usually after 3 to 6 months).