PIP-48: hierarchical admin api

Motivation

The current pulsar admin APIs (v2,v3) inherits the historical structure, managing entities as prefix to the api's route path in a flat fashion. Also, Pulsar evoled to the ability to manage multiple clusters.

For example to administrate a namespace, we used the following route v2/namespaces/:tenant-id/:namespace-id. This could be confusing, because we intend to manipulate a namespace under a tenant scope, which still requires here to give the tenant identifier in addition of the namespace identifier.

This proposal aims to

  • offer a more hierarchical routing approach reflecting the Pulsar semantic
  • proposes to officially name an ensemble of Pulsar cluster : a Constellation
  • to simplify the user experience for :
    • Topic management between persistent and non-persistent.
    • cluster management inside a Pulsar Constellation

Current admin api

Currently, we have the following admin api to control pulsar deployments.

Scope is on what the api deals with to execute the asked action.

pathdescriptionscope
v2/functionsmanage pulsar functionstenant, namespace, function
v2/clustersmanage clusterscluster
v2/resource-quotasmanage quota on resourcetenant, namespace
v2/tenantsmanage tenantstenant
v2/namespacesmanage namespacestenant, namespace
v2/non-persistentmanage non-persistent topictenant, namespace, topic
v2/persistentmanage persistent topictenant, namespace, topic
v2/schemasmanage schema on registrytenant, namespace, topic, schema
v2/brokersmanage brokerscluster, broker
v2/broker-statsretrieve broker statisticscluster, broker
v2/workermanage workercluster, worker
v2/worker-statsretrieve worker statisticscluster, worker
v2/bookiesretrieve bookies informationcluster, bookie
v3/sinkmanage pulsar-io sink connectorstenant, namespace, connector
v3/sinksmanage pulsar-io sink connectorstenant, namespace, connector
v3/sourcemanage pulsar-io source connectorstenant, namespace, connector
v3/sourcesmanage pulsar-io source connectorstenant, namespace, connector

Proposed changes

We would like to propose new v4 admin api which will have two level of reading.

The first one is the broker-level which means all information linked to the pulsar broker‘s instance. The second one is the constellation-level which means the administration of multiple pulsar’s cluster instances.

The “constellation” word is used to differentiate a pulsar‘s cluster instance and the management of multiple pulsar’s cluster instances.

Broker

The api at broker level will expose information of the broker, this aims to enhance the observability and operational tasks around the pulsar's broker.

pathdescriptionscope
v4/metricsbroker metrics (both broker and worker) in prometheus formatbroker, worker
v4/broker/statusretrieve broker statusbroker
v4/broker/statsreplacement of broker-statsbroker
v4/worker/statusretrieve worker statusworker
v4/worker/statsreplacement of worker-statsworker

Constellation

The api at constellation level will expose management of pulsar's cluster instances, tenants, namespaces, schemas...

pathdescriptionscope
v4/clustersList and create cluster instancesconstellation
v4/clusters/:cluster-idmanage cluster instance cluster-id. (*)cluster
v4/clusters/:cluster-id/tenantslist active tenants on this clustercluster
v4/clusters/:cluster-id/workersmanage workers of the cluster-idcluster, worker
v4/clusters/:cluster-id/brokersmanage brokers of the cluster-idcluster, broker
v4/clusters/:cluster-id/bookiesmanage bookies of the cluster-idcluster, bookie
v4/tenantsmanage tenantsconstellation, tenant
v4/tenants/:tenant-idmanage the tenant tenant-idconstellation, tenant
v4/tenants/:tenant-id/namespacesmanage namespaces of the tenant tenant-idconstellation, tenant, namespace
v4/tenants/:tenant-id/namespaces/:namespace-idmanage the namespace namespace-id of the tenant tenant-idconstellation, tenant, namespace
v4/tenants/:tenant-id/namespaces/:namespace-id/resource-quotasmanage quotas on resources of the tenant tenant-id and namespace namespace-idconstellation, tenant, namespace
v4/tenants/:tenant-id/namespaces/:namespace-id/topicsmanage topics of the tenant tenant-id and namespace namespace-idconstellation, tenant, namespace, topic
v4/tenants/:tenant-id/namespaces/:namespace-id/topics/:topic-id/schemamanage schema of the topic topic-id on the tenant tenant-id and namespace namespace-idconstellation, tenant, namespace, topic, schema
v4/tenants/:tenant-id/namespaces/:namespace-id/functionsmanage functions of the tenant tenant-id and namespace namespace-idconstellation, tenant, namespace, function
v4/tenants/:tenant-id/namespaces/:namespace-id/sinksmanage sinks of the tenant tenant-id and namespace namespace-idconstellation, tenant, namespace, connector
v4/tenants/:tenant-id/namespaces/:namespace-id/sourcesmanage sources of the tenant tenant-id and namespace namespace-idconstellation, tenant, namespace, connector

(*) Currently, Pulsar would always answer with local brokers, whatever the cluster given as parameters. If unintended requests (aka cluster A got a request for the cluster B), the cluster would answered with an http forward status (aka 301) to redirect to the right cluster by look up in the configuration store the service url. This rule is implied for sub-paths. This way we ensure consistency among brokers, using the local zookeeper where they're registered.