tree: 9208795557a329fd755f715c5111249744afc24e [path history] [tgz]
  1. allocator/
  2. allocatord/
  3. allocator.vdl.go
  5. service.vdl

Allocator service

Allocator allows users to create an instance of a pre-defined service, e.g. syncbase, that they can use for testing purposes.

It leverages the functionality provided by the cluster package to run the service on Kubernetes.

The allocator server API has 3 methods:

  • Create()
  • Destroy()
  • List()


Create is used to create a new instance of the service.

When the server receives the Create() request, it creates a new Kubernetes Deployment that is based on a pre-defined template. The template is expanded with the following data:

  • Name: The name of the kubernetes Deployment and its persistent disk.
  • AccessList: A JSON-encoded AccessList that contains the caller's blessing names.
  • MountName: The name where the new instance should publish itself.
  • CreatorInfo: A JSON-encoded string describing the caller, suitable to be used as an annotation.
  • OwnerHash: A hash of the creator's email address.


Destroy destroys the instance whose name is passed as argument, along with its persistent disk.


List shows all the instances that are owned by the calling user.



Refer to the Tools and Create a cluster sections of the Vanadium Cluster documentation.

This document assumes that the Kubernetes cluster already exists and that we have a vkube.cfg file for it.

Deployment template

Allocatord doesn't know anything about the service to allocate. Instead, it takes a user-defined template as argument.

Let's use syncbase as a simplified example.

 cat - <<EOF> syncbased-deployment.json-template
  "apiVersion": "extensions/v1beta1",
  "kind": "Deployment",
  "metadata": {
    "name": "{{.Name}}",
    "annotations": {
      "": {{.CreatorInfo}}
    "labels": {
      "ownerHash": "{{.OwnerHash}}"
  "spec": {
    "template": {
      "metadata": {
        "labels": {
          "application": "{{.Name}}"
      "spec": {
        "containers": [
            "name": "syncbased",
            "image": ""
            "command": [
            "volumeMounts": [ { "name": "data-disk", "mountPath": "/data" } ]
        "volumes": [
          { "name": "data-disk", "gcePersistentDisk": { "pdName": "{{.Name}}", "fsType": "ext4" } }

Run allocatord

allocatord \
  --deployment-template=syncbased-deployment.json-template \
  --name=syncbase-allocator \
  --server-name=syncbased \

Creating a new service instance

allocator --allocator=syncbase-allocator create

This command returns the name of the newly created syncbase instance.