Creating a Service Mesh

Function

This API is used to create a service mesh.

URI

POST /v1/meshes

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type or format.

X-Auth-Token

Yes

String

Requests for calling an API can be authenticated using either a token or AK/SK. If token-based authentication is used, this parameter is mandatory and must be set to a user token.

X-Apply-ProjectID

Yes

String

ID of the project that the service mesh belongs to.

Table 2 Parameters in the request body

Parameter

Mandatory

Type

Description

apiVersion

Yes

String

API version. The value is fixed at v1 and cannot be changed.

kind

Yes

String

API type. The value is fixed at Mesh or mesh and cannot be changed.

metadata

Yes

Table3 MeshMetadata object

Basic information about the service mesh. Metadata is a collection of attributes.

spec

Yes

Table 4 MeshSpec object

Detailed description of the service mesh. ASM creates or updates the service mesh by spec.

Table 3 MeshMetadata

Parameter

Mandatory

Type

Description

name

Yes

String

Service mesh name.

Enter 4 to 64 characters. The name must start with a lowercase letter and not end with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.

Table 4 MeshSpec

Parameter

Mandatory

Type

Description

region

Yes

String

Region where the control plane components of the service mesh are located.

type

Yes

String

Service mesh type.

InCluster: service mesh with an in-cluster control plane. The value is InCluster for the service mesh of the Basic edition.

version

Yes

String

Service mesh version.

extendParams

Yes

Table 5 MeshExtendParams object

Extensions of the service mesh.

Table 5 MeshExtendParams

Parameter

Mandatory

Type

Description

clusters

Yes

Array of Table 6 MeshCluster objects

Information about clusters in service meshes (only for the Basic edition).

Table 6 MeshCluster

Parameter

Mandatory

Type

Description

clusterID

Yes

String

Cluster ID, which is unique and can be used to query the cluster to be added.

projectID

Yes

String

ID of the project that the cluster belongs to.

injection

No

Table 7 InjectionConfig object

Sidecar injection configuration.

installation

Yes

Table 8 InstallationConfig object

Installation configuration of service mesh components.

Table 7 InjectionConfig

Parameter

Mandatory

Type

Description

namespaces

No

Table 9 Selector object

Namespaces where sidecars to be injected.

Table 8 InstallationConfig

Parameter

Mandatory

Type

Description

nodes

Yes

Table 9 Selector object

Nodes where service mesh components are installed.

Table 9 Selector

Parameter

Mandatory

Type

Description

fieldSelector

Yes

Table 10 FieldSelector object

Field selector.

Table 10 FieldSelector

Parameter

Mandatory

Type

Description

key

Yes

String

Key.

operator

Yes

String

Operator. The value can only be In.

values

Yes

Array of strings

Values.

Response Parameters

Status code: 201

Table 11 Parameters in the response body

Parameter

Type

Description

apiVersion

String

API version. The value is fixed at v1 and cannot be changed.

kind

String

API type. The value is fixed at Mesh or mesh and cannot be changed.

metadata

Table 12 MeshMetadata object

Basic information about the service mesh. Metadata is a collection of attributes.

spec

Table 13 MeshSpec object

Detailed description of the service mesh. ASM creates or updates the service mesh by spec.

status

Table 20 MeshStatus object

Service mesh status,

which is automatically generated by ASM.

Table 12 MeshMetadata

Parameter

Type

Description

name

String

Service mesh name.

uid

String

Service mesh ID, which is unique and automatically generated after the service mesh is created.

creationTimestamp

String

Time when the service mesh was created.

Table 13 MeshSpec

Parameter

Type

Description

region

String

Region where the control plane components of the service mesh are located.

type

String

Service mesh type.

InCluster: service mesh with an in-cluster control plane. The value is InCluster for the service mesh of the Basic edition.

version

String

Service mesh version.

extendParams

Table14 MeshExtendParams object

Extensions of the service mesh.

Table 14 MeshExtendParams

Parameter

Type

Description

clusters

Array of Table15 MeshCluster objects

Information about clusters in service meshes (only for the Basic edition).

Table 15 MeshCluster

Parameter

Type

Description

clusterID

String

Cluster ID, which is unique and can be used to query the cluster to be added.

projectID

String

ID of the project that the cluster belongs to.

injection

Table16 InjectionConfig object

Sidecar injection configuration.

installation

Table17 InstallationConfig object

Installation configuration of service mesh components.

Table 16 InjectionConfig

Parameter

Type

Description

namespaces

Table 18 Selector object

Namespaces where sidecars to be injected.

Table 17 InstallationConfig

Parameter

Type

Description

nodes

Table 18 Selector object

Nodes where service mesh components are installed.

Table 18 Selector

Parameter

Type

Description

fieldSelector

Table 19 FieldSelector object

Field selector.

Table 19 FieldSelector

Parameter

Type

Description

key

String

Key.

operator

String

Operator. The value can only be In.

values

Array of strings

Values.

Table 20 MeshStatus

Parameter

Type

Description

phase

String

Service mesh status. The options are as follows:

  • Running: The service mesh is running.

  • Creating: The service mesh is being created.

  • CreateFailed: The service mesh fails to be created.

  • Deleting: The service mesh is being deleted.

  • DeleteFailed: The service mesh fails to be deleted.

  • Upgrading: The service mesh is being upgraded.

  • UpgradeFailed: The service mesh fails to be upgraded.

  • RollingBack: The service mesh is being rolled back.

  • RollbackFailed: The service mesh fails to be rolled back.

updateTimestamp

String

Time when the service mesh was updated.

Status code: 400

Table 21 Parameters in the response body

Parameter

Type

Description

errorCode

String

Error code.

Minimum length: 8

Maximum length: 36

errorMsg

String

Error message.

Minimum length: 2

Maximum length: 512

Status code: 409

Table 22 Parameters in the response body

Parameter

Type

Description

errorCode

String

Error code.

Minimum length: 8

Maximum length: 36

errorMsg

String

Error message.

Minimum length: 2

Maximum length: 512

Status code: 500

Table 23 Parameters in the response body

Parameter

Type

Description

errorCode

String

Error code.

Minimum length: 8

Maximum length: 36

errorMsg

String

Error message.

Minimum length: 2

Maximum length: 512

Example Request

Creating a service mesh

POST /v1/meshes

{
  "apiVersion" : "v1",
  "kind" : "Mesh",
  "metadata" : {
    "name" : "mesh-test-api"
  },
  "spec" : {
    "type" : "InCluster",
    "version" : "1.15.7-r1",
    "region": "eu-de-01",
    "extendParams" : {
      "clusters" : [ {
        "clusterID" : "8df4c986-b052-xxxx-xxxx-0255ac101231",
        "projectID" : "719217bc273743eaxxxxxxxx8bc34480",
        "installation" : {
          "nodes" : {
            "fieldSelector" : {
              "key" : "UID",
              "operator" : "In",
              "values" : [ "b07b6512-b053-xxxx-xxxx-0255ac101231" ]
            }
          }
        },
        "injection" : {
          "namespaces" : {
            "fieldSelector" : {
              "key" : "UID",
              "operator" : "In",
              "values" : [ "xxxx" ]
            }
          }
        }
      } ]
    }
  }
}

Example Response

Status code: 201

The service mesh creation task is delivered and the service mesh creation starts.

{
  "apiVersion" : "v1",
  "kind" : "Mesh",
  "metadata" : {
    "name" : "mesh-test-api",
    "uid" : "2789682f-7e1b-11ee-9662-0255ac10080a",
    "creationTimestamp" : "2023-11-08T09:42:39Z"
  },
  "spec" : {
    "domainID": "06e6bafb794746xxxxxxxx536497ea95",
    "type" : "InCluster",
    "version" : "1.15.7-r1",
    "region": "eu-de-01",
    "extendParams" : {
      "clusters" : [ {
        "clusterID" : "8df4c986-b052-xxxx-xxxx-0255ac101231",
        "region": "eu-de-01",
        "projectID" : "719217bc273743eaxxxxxxxx8bc34480",
        "provider": "CCE",
        "proxyMode": "sidecar",
        "installation" : {
          "nodes" : {
            "fieldSelector" : {
              "key" : "UID",
              "operator" : "In",
              "values" : [ "b07b6512-b053-xxxx-xxxx-0255ac101231" ]
            }
          }
        },
        "injection" : {
          "namespaces" : {
            "fieldSelector" : {
              "key" : "UID",
              "operator" : "In",
              "values" : [ "xxxx" ]
            }
          }
        }
      } ]
    }
  },
  "status" : {
    "phase" : "Creating"
  }
}

Status Codes

Status Code

Description

201

The service mesh creation task is delivered and the service mesh creation starts.

400

Verification failed due to incorrect parameters for creating the service mesh.

409

The service mesh to be created conflicts with an existing service mesh.

500

An error occurs during the service mesh creation.