Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com> Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com> Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
59 KiB
Creating a Service Mesh
Function
This API is used to create a service mesh.
URI
POST /v1/meshes
Request 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. |
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. |
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. |
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. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
clusters |
Yes |
Array of Table 6 MeshCluster objects |
Information about clusters in service meshes (only for the Basic edition). |
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. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
namespaces |
No |
Table 9 Selector object |
Namespaces where sidecars to be injected. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
nodes |
Yes |
Table 9 Selector object |
Nodes where service mesh components are installed. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
fieldSelector |
Yes |
Table 10 FieldSelector object |
Field selector. |
Response Parameters
Status code: 201
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. |
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. |
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. |
Parameter |
Type |
Description |
|---|---|---|
clusters |
Array of Table15 MeshCluster objects |
Information about clusters in service meshes (only for the Basic edition). |
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. |
Parameter |
Type |
Description |
|---|---|---|
namespaces |
Table 18 Selector object |
Namespaces where sidecars to be injected. |
Parameter |
Type |
Description |
|---|---|---|
nodes |
Table 18 Selector object |
Nodes where service mesh components are installed. |
Parameter |
Type |
Description |
|---|---|---|
fieldSelector |
Table 19 FieldSelector object |
Field selector. |
Parameter |
Type |
Description |
|---|---|---|
key |
String |
Key. |
operator |
String |
Operator. The value can only be In. |
values |
Array of strings |
Values. |
Parameter |
Type |
Description |
|---|---|---|
phase |
String |
Service mesh status. The options are as follows:
|
updateTimestamp |
String |
Time when the service mesh was updated. |
Status code: 400
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
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
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
{
"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. |