Deployment Manager API

Use the Deployment Manager API to manage the Instabase platform infrastructure. This handles operations such as initializing the database and managing configurations. See the Deployment Manager documentation for more details.

Info

Deployment Manager was previously called the Instabase control plane. Some backend elements, such as Deployment Manager API endpoints, variables, and files, still reference this name.

Note

For installation-related API documentation, see the Installer API page. For upgrade-related API documentation, see the Upgrade API page. These endpoints are documented separately to allow for additional context.

Conventions and authentication

For this API, api_root defines where to route API requests for your Instabase instance.

Note

During the initial Instabase installation, this should access Deployment Manager directly, either by port-forwarding the Deployment Manager port (9500) or by creating a temporary ingress.

In this document api_root defines where to route API requests for your Instabase instance and includes the stem of the API path.

import json, requests

api_root = 'https://www.instabase.com/api/v1/control_plane'

In this document token defines the Deployment Manager token. All API requests must include your valid Deployment Manager token to authenticate the request. The Deployment Manager API Token is created in the cluster with a default, changeable value when the Deployment Manager YAML is applied.

To fetch the Deployment Manager API token, run the following command in the command line, where $IB_NS is your Instabase namespace:

export TOKEN=$(kubectl -n $IB_NS get \
secret/control-plane-metadata \
--template={{.data.api_token}} | base64 -d)

You can then reference the token in your calls using $TOKEN in place of token.

Set up Deployment Manager

Method Syntax
GET api_root/setup

Description

Use this API to set up the Instabase deployment manager for an existing installation. This initializes the Deployment Manager metadata in your database.

Examples

Request

Example (Python):

url = api_root + '/setup'
headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Response

If successful:

HTTP STATUS CODE 200

# body
{
  "status": "OK"
}

Deployment Manager set up status

Method Syntax
POST api_root/setup/status

Description

Use this API to check if the necessary database tables and default resource label bindings for Deployment Manager are created.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Type Description Value
isSetup boolean Whether the database tables are setup. true or false

Examples

Request

Example (Python):

url = api_root + '/setup/status'
headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Response

The response body is a JSON object:

{
  "isSetup": "true"
}

Database initialization

Method Syntax
POST api_root/database/setup

Description

Use this API to initialize the Instabase database by creating all the necessary Instabase tables. Use this API for a new installation.

Request parameters

The request body must be a JSON object with these parameters. Parameters are required unless marked as optional.

Name Type Description Values
create_admin_account boolean Whether or not to create an admin account during database initialization. true, false
admin_email string Optional if create_admin_account is true. Admin email with which to create the admin account. Email address
admin_username string Optional. Admin username with which to create the admin account. Default: admin
enable_control_plane boolean Optional. Whether or not to create the Deployment Manager database models. true, false. Default: false
enable_key_service boolean Optional. Whether or not to create the key service database models. true, false. Default: false
enable_ml_studio boolean Optional. Whether or not to create the model training database models. true, false. Default: false
enable_model_registry_pv boolean Optional. Whether or not to create model registry database models. true, false. Default: false
enable_repo_projects boolean Optional. Whether or not to enable the database schema change to support Solution Builder projects. true, false. Default: false

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Description Value
status Whether or not the operation was successful. "OK"
error A string explaining what went wrong. A message, such as Tables have already been set up or Invalid parameters.

Examples

Request

Python example:

url = api_root + '/database/setup'

data = dict(
  create_admin_account = "true",
  admin_email = "admin@email.com", # optional (only if 'create_admin_account' is true)
  admin_username = "admin", # optional (default: 'admin')
  enable_control_plane = "false", # optional (default: 'false')
  enable_key_service = "false", # optional (default: 'false')
  enable_models = "false" # optional (default: 'false')
)

headers = {
  'Token': token,
}
resp = requests.post(url, headers=headers, data=json.dumps(data)).json()

Response

If successful:

HTTP STATUS CODE 200

# body
{
  "status": "OK"
}

Database mock DDL for initialization

Method Syntax
POST api_root/database/mock_ddl

Description

Use this API to get a mock DDL that initializes the Instabase database.

Request parameters

The request body must be a JSON object with these parameters. Parameters are required unless marked as optional.

Name Type Description Values
create_admin_account boolean Whether or not to create an admin account during database initialization. true, false
admin_email string Optional if create_admin_account is true. Admin email with which to create the admin account. Email address
admin_username string Optional. Admin username with which to create the admin account. Default: admin
enable_control_plane boolean Optional. Whether or not to create the Deployment Manager database models. true, false. Default: false
enable_key_service boolean Optional. Whether or not to create the key service database models. true, false. Default: false
enable_ml_studio boolean Optional. Whether or not to create the model training database models. true, false. Default: false
enable_model_registry_pv boolean Optional. Whether or not to create model registry database models. true, false. Default: false
enable_repo_projects boolean Optional. Whether or not to enable the database schema change to support Solution Builder projects. true, false. Default: false

Response schema

The response is a JSON object. All keys are returned in the response by default, unless marked as optional.

Key Description Value
ddls A list of DDL strings that would be used for database initialization. [“DDL1…”, “DDL2…”,…]

Examples

Request

POST api_root/database/mock_ddl

# body
{
  "create_admin_account": "true",
  "admin_email": "admin@email.com", # optional (only if 'create_admin_account' is true)
  "admin_username": "admin", # optional (default: 'admin')
  "enable_control_plane": "false", # optional (default: 'false')
  "enable_key_service": "false", # optional (default: 'false')
  "enable_ml_studio": "false", # optional (default: 'false')
  "enable_model_registry_pv": "false" # optional (default: 'false')
}

Example (Python):

url = api_root + '/database/mock_ddl'

data = dict(
  create_admin_account = "true",
  admin_email = "admin@email.com", # optional (only if 'create_admin_account' is true)
  admin_username = "admin", # optional (default: 'admin')
  enable_control_plane = "false", # optional (default: 'false')
  enable_key_service = "false", # optional (default: 'false')
  enable_models = "false" # optional (default: 'false')
)

headers = {
  'Token': token,
}
resp = requests.post(url, headers=headers, data=json.dumps(data)).json()

Response

If successful:

HTTP STATUS CODE 200

# body
{
  "ddls": [
    ..., <string: the DDL strings>
  ]
}

If error:

HTTP STATUS CODE 400
HTTP STATUS CODE 500

Test database connection

Method Syntax
GET api_root/database/connection

Description

Use this API to test the connection to the Instabase DB.

Examples

Request

GET api_root/database/connection

Example (Python):

url = api_root + '/database/connection'

headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Response

If successful:

HTTP STATUS CODE 200

If error:

HTTP STATUS CODE 500

Create base configs

Method Syntax
POST api_root/base_configs

Description

Info

Using this API to update your base configs for version upgrades is no longer supported, but will continue to function until release 24.01. To complete a version upgrade by API, follow the upgrades API documentation.

Use this API to create or update the base configs in Deployment Manager. You can also use this API to perform updates to Instabase, by supplying a new set of base configs corresponding to a new version of the platform. There are two ways to upload new base configs, either as text or as a compressed archive to upload many base configs at once. Multiple configurations may be uploaded together, by separating each block with the Kubernetes config delimiter (---). Your Instabase representative may provide a new set of base configurations for a new version of Instabase as a zip or tar archive; this can be uploaded directly.

Request parameters

Parameters are required unless marked as optional. Valid content types are application/x-www-form-urlencoded and multipart/form-data.

Name Type Description Values
release_version string The release version of the base configs A valid release version, such as 21.0.12
base_config string The base configuration. Multiple configurations may be uploaded together, by separating each block with the Kubernetes config delimiter (---). Only exists when content-type is application/x-www-form-urlencoded . Valid Kubernetes configs.
file file The base configs in a compressed archive. Only exists when content-type is multipart/form-data. .zip, .tar.gz

Examples

Request

Shell:

curl -i -X POST -H "Content-Type: multipart/form-data" -H 'Token: token' \
-F "file=@configs.zip" -F "release_version=21.x.0" api_root/base_configs

Python:

url = api_root + '/base_configs'

data = dict(
  release_version = "21.x.0", # release version of the base configs
  base_config = "...", # the configuration
)

headers = {
  'Token': token,
  'Content-type': contentType,
}
resp = requests.post(url, headers=headers, data=json.dumps(data)).json()

Response

If successful:

HTTP STATUS CODE 200

{
  "data": {
    "successful_apply": [
      <string: the names of the objects that were successfully updated in the cluster>
    ]
  },
  "status_code": 200
}

If failure:

HTTP STATUS CODE 500

{
  "data": {
    "successful_apply": [
      <string: the names of the objects that were successfully updated in the cluster>
    ],
    "failed_to_apply": [
      <string: the names of the objects that failed to get updated in the cluster>
    ],
  },
  "status_code": <number: the status code of the response>,
  "error": <string: the reason for the failure>
}

Get all base configuration versions

Method Syntax
GET api_root/base_configs/versions

Description

Use this API to fetch details of all base configurations stored in Deployment Manager.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Description Value
baseConfigVersions The list of base configs to versions. A list of objects where each object contains the below keys for a base config object and its versions.
baseConfigVersions/objectName The object name of the base config. A string, such as objectName.
baseConfigVersions/Versions The list of version strings for a given object name. A list of strings, such as ["release-1", "release2"].

Examples

Example (Python):

url = api_root + '/base_configs/versions'

headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Request

GET api_root/base_configs/versions

Response

If successful:

HTTP STATUS CODE 200

# body
{
  "baseConfigVersions": [
    {
      "objectName": <string: the Kubernetes object name>,
      "Versions": <list of strings: the release versions of the object stored in Deployment Manager>
    },
    ...
  ]
}

If error:

HTTP STATUS CODE 500

Get base configuration versions of object

Method Syntax
GET api_root/base_configs/OBJECT_NAME/versions

Description

Use this API to fetch details of the base configurations for a specific Kubernetes object stored in Deployment Manager.

Request parameters

Name Type Description Values
OBJECT_NAME string The name of the Kubernetes object. The name of any valid Kubernetes object.

Response schema

Key Description Value
versions A list of strings. Each release version of the object stored in Deployment Manager.
error A string explaining what went wrong. An error message, such as “Could not get base config history.”

Examples

Request

Python example:

url = api_root + '/base_configs/' + object_name + '/versions'

headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Response

If successful:

HTTP STATUS CODE 200

# body
{
  "versions": [
    <string: each release version of the object stored in Deployment Manager>,
    ...
  ]
}

Update base config image

Method Syntax
POST api_root/base_configs/image

Description

Use this API to update the image of an object’s base configuration.

Request parameters

Parameters are required unless marked as optional. Valid content types are application/x-www-form-urlencoded.

Name Type Description Values
image string The new image value. A valid image. For example, gcr.io/instabase-public/image:tag.
object string The name of the object to update the image for. A valid object name. For example, deployment-core-platform-service.
comment string The comment to indicate the change this image provides. A comment on the update. For example,numpy-package-update. Valid characters are a-zA-z0-9-_ with a 40 character limit.
container string The name of the container to update the image for. Some objects may have more than one container. A valid container name. For example, container1. If left blank, defaults to first container in the list.

Examples

Request

Shell:

curl -i -X POST -H "Content-Type: application/x-www-form-urlencoded" -H 'Token: token' \
--data-urlencode 'image=imageValue' --data-urlencode 'object=deployment-core-platform-service' --data-urlencode 'comment=numpy-package-update' api_root/patches/apply api_root/base_configs/image

Python:

url = api_root + '/base_configs/image'

data = dict(
  image = "...", 
  object = "...",
  comment = "...",
  container = "..."
)

headers = {
  'Token': token,
  'Content-Type': 'application/x-www-form-urlencoded',
}
resp = requests.post(url, headers=headers, data=json.dumps(data)).json()

Response

If successful:

HTTP STATUS CODE 200

{
  "data": {
    "successful_apply": [
      <string: the names of the object that were successfully updated in the cluster>
    ]
  },
  "status_code": 200
}

If not successful:

HTTP STATUS CODE 500

{
  "data": {
    "successful_apply": [
      <string: the names of the object that were successfully updated in the cluster>
    ],
    "failed_to_apply": [
      <string: the names of the object that failed to get updated in the cluster>
    ],
  },
  "status_code": <number: the status code of the response>,
  "error": <string: the reason for the failure>
}

Apply patch

Method Syntax
POST api_root/patches/apply

Description

Use this API to apply a patch config to objects or labels in Deployment Manager.

For more information on how to create labels, see the create resource label bindings API.

Request parameters

Parameters are required unless marked as optional. Valid content-types are application/x-www-form-urlencoded and multipart/form-data.

Name Type Description Values
patch string The configuration patch to be applied as text. This can either be in YAML or JSON format. Only exists when content-type is application/x-www-form-urlencoded. Any valid YAML string or marshalled JSON string.
file file The patch as a file, or compressed archive of configuration patches. Only exists when content-type is multipart/form-data. .yml, .yaml, .json, .zip, or .tar.gz file
description string Optional. The description of why the patch is needed. Any valid string.
dry_run boolean Optional. Set to true to see the new materialized config after a patch is applied without writing to database. true or false

Examples

Request

curl -i -X POST -H "Content-Type: application/x-www-form-urlencoded" -H 'Token: token' \
--data-urlencode 'patch=patchText' api_root/patches/apply

JSON patch

JSON patches are used in Deployment Manager when you need finer control over array elements within a config (for example ports in a NetworkPolicies). They use their own format, which is defined below:

Key Description Value
kind The kind of the object the patch is targeting. Any valid Kubernetes resource kind.
target Optional. The object or label the patch is going to be applied to. string
comment Comment about what the patch is doing. string
patch The actual patch that will be applied. This is an array of operations. More information about this can be found in the JSON patch page. array
patch/op The operation to be applied by this item. add, copy, remove, replace, move
patch/from Optional. Used for copy and move operations. string
patch/path The target for the operation. string
patch/value Optional. The new value for the field. Used for add operations. map, array, string, number

Example JSON Patch:

{
  "comment": "Open new egress port for external service",
  "kind": "NetworkPolicy",
  "target": "some-network-policy",
  "patch": [
    {
      "op": "add",
      "path": "/spec/egress/1/ports/-",
      "value": {
        "protocol": "TCP",
        "port": 9999
      }
    }
  ]
}

Set patch targets

Every patch (file or string) must include a target tag before the patch body:

# target: targetName
apiVersion: v1
kind: Deployment
...

Every .yml in a compressed archive can have a different target.

String patch example (Python):

url = api_root + '/patches/apply'

data = dict(
  patch = "...", # body of the patch - include target tag at beginning of string
  description = "This patch updates the number of replicas for the given service",
)

headers = {
  'Token': token,
  'Content-Type': 'application/x-www-form-urlencoded',
}

resp = requests.post(url, headers=headers, data=data).json()

File patch example (Python):

url = api_root + '/patches/apply'

files=[
  ('file',('patch.yml',open('patch.yml','rb'),'application/octet-stream'))
]

data = {
    "description" : "..."
}

headers = {
    'Token': token
}

resp = requests.post(url, headers=headers, files=files, data=data).json()

File patch example (Curl):

curl --location 'api_root/patches/apply' \
--header 'token: your_token' \
--form 'file=@"patch.yml"' \
--form 'description="This patch updates the number of replicas for the given service"'

Response

When dry_run is not set or false:

If successful:

HTTP STATUS CODE 200

# body
{
  "data": {
    "successful_apply": [
      <string: the names of the objects that were successfully updated in the cluster>,
      ...
    ],
  },
  "status_code": 200
}

If failure:

# body
{
  "data": {
    "successful_apply": [
      <string: the names of the objects that were successfully updated in the cluster>,
      ...
    ],
    "failed_to_apply": [
      <string: the names of the objects that failed to get updated in the cluster>,
      ...
    ],
  },
  "status_code": <number: the status code of the response>,
  "error": <string: the reason for the failure>
}

Dry-run example response

When dry_run is true:

This is a dry-run patch response for two targets: object-1 and object-2. object-1 is an object with an existing base configuration. object-2 is a target with no associated objects.

# body
{
    "statusCode": 200,
    "data": {
        "dryRuns": [
            {
                "message": null,
                "dryRun": {
                    "objectName": "object-1",
                    "releaseVersion": "21.1.0",
                    "patchVersion": null,
                    "previousReleaseVersion": null,
                    "previousPatchVersion": null,
                    "state": null,
                    "config": "apiVersion: batch/v1\nkind: Deployment\nmetadata:\n  name: object-1\n  namespace:instabase",
                    "metadata": "{\"type\":\"Deployment\",\"isEncrypted\":false}",
                    "timestampMS": 1652116484052
                }
            },
            {
                "message": "Target 'object-2' is a nonexistent object. If you apply a patch to this target there will be no configuration file associated with it until an object called 'object-2' is created.",
                "dryRun": null
            }
        ]
    },
    "error": null
}

Get all patches

Method Syntax
GET api_root/patches

Description

Use this API to fetch all of the patches stored in Deployment Manager.

Response schema

All keys are returned in the response by default, unless marked as optional.

Name Type Description Values
data JSON object An object containing the list of patches. {"patches" : []}
data/patches list of JSON objects A list of json objects representing patches [{"version":...}, ...].
data/patches[]/version integer The version of the patch. A patch version, such as 1658866352520.
data/patches[]/nextVersion integer The version of the next patch. A patch version, such as 1658866353683.
data/patches[]/target string The target the patch was applied to. <targetName>.
data/patches[]/patch string The body of the patch A Kubernetes configuration patch.
data/patches[]/metadata string Metadata of the patch. Patch metadata, such as "{\"type\":\"Deployment\",\"isEncrypted\":false}".
data/patches[]/description string Description input by the user when creating the patch. Description string, such as “Bumping up replica count”.
statusCode integer An HTTP status code. Status code, such as 200, 400, or 500.

Examples

Python

Request

url = api_root + '/patches'

headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Response

HTTP STATUS CODE 200
{
    "statusCode": 200,
    "data": {
        "patches": [
            {
                "version": 1658866352520,
                "nextVersion": 1658866353683,
                "target": "deployment-core-platform-service",
                "state": "NOT_GOLDEN",
                "patch": "apiVersion: apps/v1\nkind: Deployment\nspec:\n  template:\n    spec:\n      containers:\n        - name: CONTAINER_NAME\n          env:\n            - name: S3_SERVER_URL\n              value: \"test-server-url\"\n            - name: S3_SERVER_IS_SECURE\n              value: \"true\"\n            - name: S3_SERVER_CALLING_FORMAT\n              value: \"SubdomainCallingFormat\"\n            - name: AWS_ACCESS_KEY_ID\n              value: \"test-access-key\"\n            - name: AWS_SECRET_ACCESS_KEY\n              value: \"test-secret-key\"\n            - name: S3_AWS_REGION\n              value: \"us-east-1\"\n            - name: HOSTING_BUCKET\n              value: \"test-bucket-name\"\n            - name: INSTABASE_BUCKET\n              value: \"test-bucket-name\"\n            - name: HOSTED_STORAGE_TYPE\n              value: \"S3\"\n            - name: HOSTED_S3_ENCRYPTION_TYPE\n              value: \"aws_sse_s3\"\n            - name: USE_VIRTUAL_STYLE_URL\n              value: \"true\"",
                "metadata": "{\"type\":\"Deployment\",\"isEncrypted\":false,\"format\":\"YAML\",\"createdBy\":\"Installer\"}",
                "description": "Control Plane Installation Patch: s3_storage_patch"
            }
        ]
    },
    "error": null
}

Get all patches for object

Method Syntax
GET api_root/patches/OBJECT_NAME

Description

Use this API to fetch all of the patches stored in Deployment Manager for a specific object.

Request parameters

Parameters are required unless marked as optional.

Name Type Description Values
OBJECT_NAME string The name of the Kubernetes object. Any valid Kubernetes object name.

Response schema

You can add /list to the end of the URL to get just the version, target, and description parameters back in the response.

Name Type Description Values
data JSON object An object containing the list of patches. {"patches" : []}
data/patches list of JSON objects A list of JSON objects representing patches. [{"version":...}, ...]
data/patches[]/version integer The version of the patch. A patch version, such as 1658866352520.
data/patches[]/nextVersion integer The version of the next patch. A patch version, such as 1658866353683.
data/patches[]/target string The target the patch was applied to. <targetName>.
data/patches[]/patch string The body of the patch. A Kubernetes configuration patch.
data/patches[]/metadata string Metadata of the patch. Patch metadata, such as "{\"type\":\"Deployment\",\"isEncrypted\":false}".
data/patches[]/description string Description input by the user when creating the patch. Description string such as “Bumping up replica count”.
statusCode integer An HTTP status code. Status code, such as 200, 400, or 500.

Examples

Request

Python example:

url = api_root + '/patches/deployment-core-platform-service'

headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Response

HTTP STATUS CODE 200
{
    "statusCode": 200,
    "data": {
        "patches": [
            {
                "version": 1658866352520,
                "nextVersion": 1658866353683,
                "target": "deployment-core-platform-service",
                "state": "NOT_GOLDEN",
                "patch": "apiVersion: apps/v1\nkind: Deployment\nspec:\n  template:\n    spec:\n      containers:\n        - name: CONTAINER_NAME\n          env:\n            - name: S3_SERVER_URL\n              value: \"test-server-url\"\n            - name: S3_SERVER_IS_SECURE\n              value: \"true\"\n            - name: S3_SERVER_CALLING_FORMAT\n              value: \"SubdomainCallingFormat\"\n            - name: AWS_ACCESS_KEY_ID\n              value: \"test-access-key\"\n            - name: AWS_SECRET_ACCESS_KEY\n              value: \"test-secret-key\"\n            - name: S3_AWS_REGION\n              value: \"us-east-1\"\n            - name: HOSTING_BUCKET\n              value: \"test-bucket-name\"\n            - name: INSTABASE_BUCKET\n              value: \"test-bucket-name\"\n            - name: HOSTED_STORAGE_TYPE\n              value: \"S3\"\n            - name: HOSTED_S3_ENCRYPTION_TYPE\n              value: \"aws_sse_s3\"\n            - name: USE_VIRTUAL_STYLE_URL\n              value: \"true\"",
                "metadata": "{\"type\":\"Deployment\",\"isEncrypted\":false,\"format\":\"YAML\",\"createdBy\":\"Installer\"}",
                "description": "Control Plane Installation Patch: s3_storage_patch"
            }
        ]
    },
    "error": null
}

Delete patch

Method Syntax
DELETE api_root/patches/VERSION

Description

Use this API to forcibly remove a patch from Deployment Manager and regenerate the materialized configs affected by the patch.

Request parameters

Parameters are required unless marked as optional.

Name Type Description Values
VERSION string Version of the patch to be deleted. A string specifying an existing patch version.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Type Description Value
data JSON object An object containing lists of objects. {"data": {"successful_apply": []}}
data/successful_apply list of strings A list of objects successfully updated in the cluster. {"successful_apply": ["deployment-apps-server"]}
data/failed_to_apply list of strings A list of objects failed to apply in the cluster. {"failed_to_apply": ["deployment-api-server"]}
statusCode integer A HTTP status code. Status code, such as 200, 400, or 500.
error string If failed, reason for the failure.

Examples

Request

Example (Python):

url = api_root + '/patches/' + version

headers = {
  'Token': token,
}
resp = requests.delete(url, headers=headers)

Response

The response body is a JSON object.

If successful:

HTTP STATUS CODE 200

{
  "data": {
    "successful_apply": [
      <string: the names of the objects that were successfully updated in the cluster>
    ]
  },
  "status_code": 200
}

If failure:

# body
{
  "data": {
    "successful_apply": [
      <string: the names of the objects that were successfully updated in the cluster>
    ],
    "failed_to_apply": [
      <string: the names of the objects that failed to get updated in the cluster>
    ],
  },
  "status_code": <number: the status code of the response>,
  "error": <string: the reason for the failure>
}

Update namespace

Description

Method Syntax
POST api_root/patches/namespace

Use this API to update the namespace of all configs. Note that existing objects with the old namespace will not be deleted—these must be cleaned up manually.

Request parameters

The request body must be a JSON object with these parameters. Parameters are required unless marked as optional.

Name Type Description Values
namespace string The new namespace. A string specifying a valid namespace.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Type Description Value
data JSON Object An object containing lists of objects. {"data": {"successful_apply": []}}
data/successful_apply List of string A list of objects successfully updated in the cluster. {"successful_apply": ["deployment-apps-server"]}
data/failed_to_apply List of string A list of objects failed to apply in the cluster. {"failed_to_apply": ["deployment-api-server"]}
statusCode Integer A HTTP status code. Status code, such as 200, 400, or 500.
error String If failed, reason of the failure.

Examples

Request

Example (Python):

url = api_root + '/patches/namespace'
data = dict(
  namespace = "instabase", # the new namespace for Instabase to run in
  description = "The namespace for the new cluster.",
)
headers = {
  'Token': token,
}
resp = requests.post(url, headers=headers, data=json.dumps(data)).json()

Response

The response body is a JSON object.

If successful:

HTTP STATUS CODE 200
{
  "data": {
    "successful_apply": [
      <string: the names of the objects that were successfully updated in the cluster>
    ]
  },
  "status_code": 200
}

If failure:

# body
{
  "data": {
    "successful_apply": [
      <string: the names of the objects that were successfully updated in the cluster>
    ],
    "failed_to_apply": [
      <string: the names of the objects that failed to get updated in the cluster>
    ],
  },
  "status_code": <number: the status code of the response>,
  "error": <string: the reason for the failure>
}

Set image registry

Method Syntax
POST api_root/patches/registry

Description

Use this API to set the image registry of all configs.

Request parameters

The request body must be a JSON object with these parameters. Parameters are required unless marked as optional.

Param Type Name Type Description Values
Body registry string The new image registry. A string specifying a valid image registry.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Type Description Value
data JSON object An object containing lists of objects. {"data": {"successful_apply": []}}
data/successful_apply list of strings A list of objects successfully updated in the cluster. {"successful_apply": ["deployment-apps-server"]}
data/failed_to_apply list of strings A list of objects failed to apply in the cluster. {"failed_to_apply": ["deployment-api-server"]}
statusCode integer A HTTP status code. Status code, such as 200, 400, or 500.
error string If failed, reason for the failure.

Examples

Request

Example (Python):

url = api_root + '/patches/registry'

data = dict(
  registry = "gcr.io/instabase-public", # the new image registry to pull the Instabase docker images from
)

headers = {
  'Token': token,
}
resp = requests.post(url, headers=headers, data=json.dumps(data)).json()

Response

The response body is a JSON object.

If successful:

HTTP STATUS CODE 200

{
  "data": {
    "successful_apply": [
      <string: the names of the objects that were successfully updated in the cluster>
    ]
  },
  "status_code": 200
}

If failure:

# body
{
  "data": {
    "successful_apply": [
      <string: the names of the objects that were successfully updated in the cluster>
    ],
    "failed_to_apply": [
      <string: the names of the objects that failed to get updated in the cluster>
    ],
  },
  "status_code": <number: the status code of the response>,
  "error": <string: the reason for the failure>
}

Get all latest materialized configurations

Method Syntax
GET api_root/configs

Description

Use this API to fetch the latest materialized configuration for all resources.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Description Value
configs A list of all materialized configurations.
objectName The Kubernetes object name.
releaseVersion The release version of the materialized configuration.
patchVersion The patch version of the materialized configuration.
previousReleaseVersion The release version of the previous materialized configuration.
previousPatchVersion The patch version of the previous materialized configuration.
state Whether the materialized configuration is currently active. IS_GOLDEN if currently active, NOT_GOLDEN otherwise
config The text of the materialized configuration.
metadata Metadata of the materialized configuration.
timestampMS Unix timestamp of the materialized configuration create time.

Examples

Request

Example (Python):

url = api_root + '/configs'

headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Response

If successful:

HTTP STATUS CODE 200

# body
{
  "configs": [
    {
      "objectName": <string>,
      "releaseVersion": <string>,
      "patchVersion": <integer>,
      "previousReleaseVersion": <string>,
      "previousPatchVersion": <integer>,
      "state": <string>,
      "config": <string>,
      "metadata": <string>,
      "timestampMS": <integer>
    }
    ...
  ]
}

Get materialized configuration of object

Method Syntax
GET api_root/configs/OBJECT_NAME

Description

Use this API to fetch the materialized configuration file of a single object.

Request parameters

Parameters are required unless marked as optional.

Name Type Description Values
OBJECT_NAME string The Kubernetes object name to fetch the materialized configuration file from. A string specifying a valid name of a Kubernetes object.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Description Value
objectName The Kubernetes object name. A string of the object name.
releaseVersion The release version of the materialized configuration. A string of the release version.
patchVersion The patch version of the materialized configuration. An integer of the patch version.
previousReleaseVersion The release version of the previous materialized configuration. An integer of the previous release version.
previousPatchVersion The patch version of the previous materialized configuration. An integer of the previous patch version.
state Whether the materialized configuration is currently active. The string “IS_GOLDEN” if the materialized configuration is currently active, otherwise the string “NOT_GOLDEN”.
config The text of the materialized configuration. A string of the text of the materialized configuration.
metadata Metadata of the materialized configuration. A string of the metadata of the materialized configuration.
timestampMS Unix timestamp of the materialized configuration creation time. An integer of the unix timestamp.

Examples

Example (Python):

url = api_root + '/configs/service-victoriametrics'

headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Request

GET api_root/configs/service-victoriametrics

Response

{
    "objectName": "service-victoriametrics",
    "releaseVersion": "$RELEASE_VERSION",
    "patchVersion": 0,
    "previousReleaseVersion": "",
    "previousPatchVersion": 0,
    "state": "NOT_GOLDEN",
    "config": "apiVersion: v1\nkind: Service\nmetadata:\n  name: service-victoriametrics\n  namespace: instabase\n  labels:\n    app: 
victoriametrics\n  annotations:\n    monitoring/enabled: \"true\"\nspec:\n  selector:\n    app: victoriametrics\n  ports:\n    - name: http\n      
protocol: TCP\n      port: 8428\n      targetPort: http\n  clusterIP: None\n",
    "metadata": "{\"type\":\"Service\",\"isEncrypted\":false}",
    "timestampMS": 1656287479653
}

Push latest materialized configs to cluster

Method Syntax
POST api_root/deployment/update

Description

Use this API to push all the latest materialized configs to the Instabase cluster.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Description Value
statusCode The status code of the request. An integer of the status code.
data The objects which have successfully updated their materialized configs. An object with key “successful_apply”, which is a string. Value is an array of the object names that have successfully updated their materialized configs.
error The error message, if an error had occurred. A string of the error messsage, or null if successful.

Examples

Example (Python):

url = api_root + '/deployment/update'

headers = {
  'Token': token,
}
resp = requests.post(url, headers=headers, data=json.dumps(data)).json()

Request

POST api_root/deployment/update

Response

{
    "statusCode": 200,
    "data": {
        "successful_apply": [
           "alertmanager-egress",
           "api-server-apps-egress",
           "service-victoriametrics"
        ]
    },
    "error": null
}

Get all resource labels

Method Syntax
GET api_root/resource_labels

Description

Use this API to get a list of all the unique resource labels that exist. This can be used to help with targeting a patch to a label.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Description Value
statusCode The status code of the request. An integer of the status code.
data Contains an object “labels”, which contains the names of the labels. An object with key “labels”, which contains a string array of the names of the resource labels.
error The error message, if an error had occurred. A string of the error messsage, or null if successful.

Examples

Example (Python):

url = api_root + '/resource_labels'

headers = {
  'Token': token,
}
resp = requests.post(url, headers=headers, data=json.dumps(data)).json()

Request

POST api_root/deployment/update

Response

{
    "statusCode": 200,
    "data": {
        "labels": [
           "ConfigMap",
           "Deployment",
           "Job"
        ]
    },
    "error": null
}

Create resource label bindings

Method Syntax
POST api_root/resource_labels/binding

Description

Use this API to create the resource label bindings between objects and labels.

Request parameters

Parameters are required unless marked as optional. The request body must be a URL-encoded form with the parameters below.

When there are multiple labels or object names, the API generates all possible label-object pairs based on all given labels and object names, and creates a binding between each pair.

Name Type Description Values
label string Can have multiple labels by sending duplicate “label” keys. A string specifying a resource label.
object_name string Can have multiple object names by sending duplicate “object_name” keys. All the objects in object_names will be assigned all of the labels in label. A string specifying the object name of the created resource label.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Description Value
statusCode The status code of the request. An integer of the status code.
data Contains an object “successful_apply”, which contains the names of the objects successfully updated in the cluster with the new labels. Also contains an object “failed_to_apply” with the object names of unsuccessful updates. An object with key “successful_apply” that contains a string array of the object names successfully updated in the cluster and with key “failed_to_apply” that contains a string array of the object names unsuccessfully updated.
error The error message, if an error had occurred. A string of the error messsage, or null if successful.

Request

Example (Python):

url = api_root + '/resource_labels/binding'

data = ("label=database"
        "&label=grpc"
        "&object_name=deployment-a-service"
        "&object_name=deployment-b-service"
        "&object_name=deployment-c-service")

headers = {
    'Token': token,
    'content-type': 'application/x-www-form-urlencoded'
}

resp = requests.post(url, headers=headers, data=data)

Response

{
    "statusCode": 200,
    "data": {
        "successful_apply": [
           "alertmanager-egress",
           "api-server-apps-egress",
           "service-victoriametrics"
        ]
    },
    "error": null
}

Get object names by label

Method Syntax
GET api_root/resource_labels/objects/LABEL?must_exist=false

Description

Use this API to fetch all object names that are bound to the label.

Request parameters

Parameters are required unless marked as optional.

Name Type Description Values
LABEL string Required. The label to fetch the resource label bindings from.
must_exist boolean Optional. If true, fetches only objects that have associated base configs. Default value is false.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Description Value
objects List of Kubernetes object names.

Examples

Request

Get the object names that are bound to the label by sending a GET request to api_root/resource_labels/objects/LABEL?must_exist=BOOL, where:

GET api_root/resource_labels/objects/LABEL?must_exist=false

Example (Python):

url = api_root + '/resource_labels/objects/' + label

headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Response

If successful:

HTTP STATUS CODE 200

# body
{
  "objects": <list<string: Kubernetes object name>>
}

Get labels by object name

Method Syntax
GET api_root/resource_labels/labels/OBJECT_NAME

Description

Use this API to fetch all labels that are bound to the object.

Request parameters

Parameters are required unless marked as optional.

Name Type Description Values
OBJECT_NAME string The Kubernetes object name to fetch the resource label bindings from.

Response schema

All keys are returned in the response by default, unless marked as optional.

Key Description Value
labels List of label names.

Examples

Request

Get the labels that are bound to the object by sending a GET request to api_root/resource_labels/labels/OBJECT_NAME, where:

GET api_root/resource_labels/labels/OBJECT_NAME

Example (Python):

url = api_root + '/resource_labels/labels/' + object_name

headers = {
  'Token': token,
}
resp = requests.get(url, headers=headers).json()

Response

If successful:

HTTP STATUS CODE 200

# body
{
  "labels": <list<string: label name>>
}

Delete object bindings

Method Syntax
DELETE api_root/resource_labels/binding/OBJECT_NAME

Description

Use this API to delete all resource label bindings of an object. After using this API, the specified object will no longer have any label bindings associated with it.

Request parameters

Parameters are required unless marked as optional.

Name Type Description Values
OBJECT_NAME string Kubernetes object name.

Examples

Request

Delete all resource label bindings of an object by sending a DELETE request to api_root/resource_labels/binding/OBJECT_NAME.

DELETE api_root/resource_labels/binding/OBJECT_NAME

Example (Python):

url = api_root + '/resource_labels/binding/' + object_name

headers = {
  'Token': token,
}
resp = requests.delete(url, headers=headers)

Response

If successful:

HTTP STATUS CODE 200

Update default resource labels

Method Syntax
POST api_root/resource_labels/update-defaults

Description

Use this API to keep your default resource labels up-to-date. It will check the default labels in Deployment Manager, and create the new ones if missing.

Examples

Request

Update the defalut resource labels by sending a POST request to api_root/resource_labels/update-defaults.

POST api_root/resource_labels/update-defaults

Example (Python):

url = api_root + '/resource_labels/update-defaults'

headers = {
  'Token': token,
}
resp = requests.post(url, headers=headers)

Response

If successful:

HTTP STATUS CODE 200