[EnMasse] Upcoming REST API changes

Ulf Lilleengen ulilleen at redhat.com
Tue May 8 03:17:13 UTC 2018


Hi all,

In the 0.20.0, there are plans to change the REST API in preparation for 
support custom resources. This will make it easy to enable custom 
resources, but it will not be available out of the box for this release 
as more work is needed to trust the kube-aggregator server.

Any comments on the following changes is welcome. The work is put up in 
a PR (https://github.com/EnMasseProject/enmasse/pull/1170) for those 
interested in the details.

For address spaces, there is a fundamental change in that address spaces 
will be now be namespaced. This means that address space names are no 
longer global, and an address space is only unique within a namespace.

To create address space:

POST /apis/enmasse.io/v1/namespaces/myproject/addressspaces
Return: the created address space

The 'namespace' field in the metadata previously decided in which 
namespace the messaging infrastructure was created. This is now instead 
indicated by the 'enmasse.io/namespace' annotation and should be 
regarded as an implementation detail as we eventually move towards 
sharing the infrastructure between address spaces.

To list address spaces:

GET /apis/enmasse.io/v1/namespaces/myproject/addressspaces
Return: list of address spaces

To get single address spaces:

GET /apis/enmasse.io/v1/namespaces/myproject/addressspaces/myspace
Return: myspace definition

To delete:
DELETE /apis/enmasse.io/v1/namespaces/myproject/addressspaces/myspace

For addresses, the REST API also changes in the same way, making the 
addresses scoped by both namespace and address space. The 
metadata.addressSpace field will be mandatory now that it cannot be 
inferred from the URL path anymore.

Creating multiple addresses at once using AddressList is removed, as 
this is handled client-side when using the kubectl command line and not 
server-side. We could still keep it at server side if we think it will 
be of value.

To create addresses:

POST /apis/enmasse.io/v1/namespaces/myproject/addresses

To retrieve all addresses:

GET /apis/enmasse.io/v1/namespaces/myproject/addresses

To retrieve all addresses for a given address space:

GET 
/apis/enmasse.io/v1/namespaces/myproject/addresses?labelSelector=addressSpace%3Dmyspace

To update an address (to update plans for instance. More on what will be 
allowed to change later):

PUT /apis/enmasse.io/v1/namespaces/myproject/addresses/addr1

To delete an address:

DELETE /apis/enmasse.io/v1/namespaces/myproject/addresses/addr1

Another nice addition is that all resource can be labeled and annotated 
as any other kubernetes resource, and also queried by adding the 
labelSelector query parameter as seen above.

Best regards,

Ulf




More information about the enmasse mailing list