You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Next »

The following document describes the v2 api for the scheduler.

For the V1 API, please refer to MultiCloud K8s-Plugin-service API

Projects API

Projects are new concept that has been introduced in the v2 api. They allow multi-tenancy in the application from a user perspective.

POST

POST
POST
URL: /v2/project
POST BODY:
{
  name: "Name of Project" //must be unique
}

RETURN STATUS: 201
RETURN BODY: 
{
  name: "name of the project"
}

GET, DELETE


GET, DELETE
GET
URL: /v2/project/{project-name}

RETURN STATUS: 200
RETURN BODY: 
{
  name: "Name of Project" //must be unique
}

DELETE
URL: /v2/project/{project-name}

RETURN STATUS: 204

Resource Bundle API

The resource bundle API is now keyed off the Project API

Resource Bundle Names and Versions are unique within a Project.

POST

POST
URL: /v2/project/{project-name}/rb
POST BODY:
{
    "rb-name": "test-rbdef",
    "rb-version": "v1",
    "description": "testing resource bundle definition api",
}

RETURN STATUS: 201
RETURN BODY: {  "rb-name": "test-rbdef",
  "rb-version": "v1",
  "description": "testing resource bundle definition api",}

GET, DELETE

GET, DELETE
GET
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}

RETURN STATUS: 200
RETURN BODY: 
{  
  "rb-name": "test-rbdef",
  "rb-version": "v1",
  "description": "testing resource bundle definition api"
}

DELETE
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}

RETURN STATUS: 204

Profile API

The Profile API is now keyed off the new rb API based on projects

Profile names are unique within a resource bundle and version.

Changes with respect to V1 API:

  • rb-name, rb-version is removed as it is part of the path
  • release-name is removed as profile-name will be used
  • kubernetes-version is removed as that is no longer in the scope of the profile

POST

POST
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/profile
POST BODY:
{
    "profile-name": "test-rbdef",
    "namespace": "onap", //Kubernetes namespace to install the charts in
    "description": "testing resource bundle definition api",
}

RETURN STATUS: 201
RETURN BODY: 
{  
  "rb-name": "test-rbdef",
  "rb-version": "v1", 
  "profile-name": "test-rbdef",
  "namespace": "v1",
  "description": "testing resource bundle definition api"
}

GET, DELETE

GET, DELETE
GET
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/profile/{profile-name}

RETURN STATUS: 200
RETURN BODY: 
{  
  "rb-name": "test-rbdef",
  "rb-version": "v1", 
  "profile-name": "test-rbdef",
  "namespace": "v1",
  "description": "testing resource bundle definition api"
}

DELETE
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/profile/{profile-name}

RETURN STATUS: 204

Intent Group API

Intent Group API is used to create Intent Groups that can then will be used at instantiation time. Some intents that can be part of an Intent Group are Generic Placement Intent, HPA Intent, and traffic controller Intent.

POST

POST
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/intent-group
POST BODY:
{
   "intent-group-name":"intent-group-1",
   "description":"Intent Group for Customer1",
   "group":[
      {
         "generic":"xyz-generic-placement-intent"
      },
      {
         "hpa":"xyz-hpa-intent"
      },
      {
         "traffic":"xyz-traffic-intent"
      }
   ]
}

RETURN STATUS: 201
RETURN BODY: 
{ 
  "intent-name": "intent-group-1",
  "description": "Intent Group for Customer1"
}

GET, DELETE

POST
GET
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/intent-group/{intent-group-name}

RETURN STATUS: 200
RETURN BODY: 
{
   "intent-group-name":"intent-group-1",
   "description":"Intent Group for Customer1",
   "group":[
      {
         "generic":"xyz-generic-placement-intent"
      },
      {
         "hpa":"xyz-hpa-intent"
      },
      {
         "traffic":"xyz-traffic-intent"
      }
   ]
}

DELETE
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/intent-group/{intent-group-name}

RETURN STATUS: 204

Generic Placement Intent API

Generic Placement Intent API is used to create generic placement intents for sub-applications in an application. Intent created using this API will be added to an Intent Group for using during instantiation.

POST

POST
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/generic-placement-intent
POST BODY:
{
   "intent-name":"intent-1",
   "description":"Intent-1 for Customer1",
   "applications":[
	{
        "name":"app1",
        "anyOf":[
           {
              "cluster-name":"edge1"
           },
           {
              "cluster-name":"edge2"
           }
        ]
     },
     {
        "name":"app2",
        "allOf":[
           {
              "cluster-name":"edge1"
           },
           {
              "cluster-name":"edge2"
           }
        ]
     },
     {
        "name":"app3",
        "allOf":[
           {
              "cluster-name":"edge1"
           },
           {
              "cluster-name":"edge2"
           },
           {
              "anyOf":[
                 {
                    "label-name":"east-us1"
                 },
                 {
                    "label-name":"east-us2"
                 }
              ]
           }
        ]
     }
  ]
}

RETURN STATUS: 201
RETURN BODY: 
{ 
  "intent-name": "intent-1",
  "description": "Intent-1 for Customer1"
}

GET, DELETE

POST
GET
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/generic-placement-intent/{intent-name}

RETURN STATUS: 200
RETURN BODY: 
{
   "intent-name":"intent-1",
   "description":"Intent-1 for Customer1",
   "applications":[
	{
        "name":"app1",
        "anyOf":[
           {
              "cluster-name":"edge1"
           },
           {
              "cluster-name":"edge2"
           }
        ]
     },
     {
        "name":"app2",
        "allOf":[
           {
              "cluster-name":"edge1"
           },
           {
              "cluster-name":"edge2"
           }
        ]
     },
     {
        "name":"app3",
        "allOf":[
           {
              "cluster-name":"edge1"
           },
           {
              "cluster-name":"edge2"
           },
           {
              "anyOf":[
                 {
                    "label-name":"east-us1"
                 },
                 {
                    "label-name":"east-us2"
                 }
              ]
           }
        ]
     }
  ]
}

DELETE
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/generic-placement-intent/{intent-name}

RETURN STATUS: 204

Instantiation API

Instantiation API is now based on the Profile API instead of having its own URL root.

POST

POST
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/profile/{profile-name}/instance
POST BODY:
{
	"logical-cloud": "logical-cloud-name" //name of logical cloud to use for instantiation. The DCM API will provide the list of clusters that are part of the logical-cloud
	"intent-group": "intent-group-name", //name of intent-group to use for collecting intents which will be used during instantiation
	//override-values overrides values from the helm charts and allows for instantiation time
    //variable overrides.
    "override-values": {
		imageRepository: "registry.hub.docker.com"
	}
}

RETURN STATUS: 201
RETURN BODY: 
{  
  "id": "laughing_robinson",
  "rb-name": "test-rbdef",
  "rb-version": "v1", 
  "profile-name": "test-rbdef",
  "cloudRegion": "kud",
  "namespace": "testinstallns",
  "resources": [
    {
      "GVK": {
        "Group": "",
        "Version": "v1",
        "Kind": "Service"
      },
      "Name": "mongo"
    },
    {
      "GVK": {
        "Group": "",
        "Version": "v1",
        "Kind": "Service"
      },
      "Name": "mongo-read"
    }
  ]
}

GET, DELETE

GET, DELETE
GET
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/profile/{profile-name}/instance/{instance-id}

RETURN STATUS: 200
RETURN BODY: 
{  
  "id": "laughing_robinson",
  "rb-name": "test-rbdef",
  "rb-version": "v1", 
  "profile-name": "test-rbdef",
  "cloudRegion": "kud",
  "namespace": "testinstallns",
  "resources": [
    {
      "GVK": {
        "Group": "",
        "Version": "v1",
        "Kind": "Service"
      },
      "Name": "mongo"
    },
    {
      "GVK": {
        "Group": "",
        "Version": "v1",
        "Kind": "Service"
      },
      "Name": "mongo-read"
    }
  ]
}

DELETE
URL: /v2/project/{project-name}/rb/{rb-name}/{rb-version}/profile/{profile-name}/instance/{instance-id}

RETURN STATUS: 204

Cluster Registration API

API to support Reachability for Kubernetes Cloud

POST

POST
URL: /v2/cluster-registration
POST BODY:
{
    “cloud-region” : “<name>”,   // Must be unique 
    “cloud-owner” :  “<owner>”,
}

RETURN STATUS: 201
RETURN BODY: 
{ 
    “cloud-region” : “<name>”,   // Must be unique 
    “cloud-owner” :  “<owner>”,
}

This is a multipart upload and here is how you do the POST for this.

#Using a json file containing content as above;

curl -i -F "metadata=<jsonfile;type=application/json" -F file=@/home/user/.kube/config -X POST http://NODE_IP:PORT/v2/cluster-registration

GET, DELETE

POST
GET
URL: /v2/cluster-registration/{cloud-region-name}

RETURN STATUS: 200
RETURN BODY: 
{
    “cloud-region” : “<name>”,   // Must be unique across
    “cloud-owner” :  “<owner>”,
}

DELETE
URL: /v2/cluster-registeration/{cloud-region-name}

RETURN STATUS: 204

Add Label to a cluster

POST

POST
URL: /v2/cluster-registration/{cloud-region-name}/label
POST BODY:
{
    “label-name” : “<label>”
}

RETURN STATUS: 201
RETURN BODY: 
{ 
     “label-name” : “<label>”
}

GET, DELETE

POST
GET
URL: /v2/cluster-registration/{cloud-region-name}/label/<label>

RETURN STATUS: 200
RETURN BODY: 
{
      “label-name” : “<label>”
}

DELETE
URL: /v2/cluster-registeration/{cloud-region-name}/label/<label>

RETURN STATUS: 204

Add key-value pair to a cluster

POST

POST
URL: /v2/cluster-registration/{cloud-region-name}/kv-pair
POST BODY:
{
   "kv":[
      {
         "key1":"val1"
      },
      {
         "key2":"val2"
      }
   ]
}

RETURN STATUS: 201
RETURN BODY: 
{ 
    "kv":[
      {
         "key1":"val1"
      },
      {
         "key2":"val2"
      }
   ]
}

GET, DELETE

POST
GET
URL: /v2/cluster-registration/{cloud-region-name}/kv-pair/<key>

RETURN STATUS: 200
RETURN BODY: 
{ 
   "key1":"val1"
}

DELETE
URL: /v2/cluster-registeration/{cloud-region-name}/kv-pair/<key>

RETURN STATUS: 204
  • No labels