调用AddVmAppToMesh接口添加非容器应用到服务网格。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Ips String 192.1**.*.*,192.1**.*.*

IP列表,多值时使用逗号分割

Labels String app=http-workload

标签列表,多值时使用逗号分割

Namespace String hello

命名空间

Ports String http:8000,http:8001

端口信息,格式为:端口名称:端口值,多值时使用逗号分割

ServiceMeshId String cb8963379255149cb98c8686f274****

服务网格ID

ServiceName String http-service

服务名称

Annotations String env=staging,group=0001

服务注解,多值时使用逗号分割

ServiceAccount String http-sa

服务账号

Force Boolean false

是否强制跳过创建失败项,默认值为false

返回数据

名称 类型 示例值 描述
Data String ...

返回信息

RequestId String BD65C0AD-D3C6-48D3-8D93-38D2015C****

请求ID


 {
  "RequestId": "9522f7c9-63a1-4603-b850-37d12a1e****",
  "Data": {
    "mesh-expansion-http-service": {
      "metadata": {
        "generation": 1,
        "uid": "95717103-d4b2-4c2d-b771-3acecc97****",
        "resourceVersion": "124747****",
        "creationTimestamp": "2020-08-11T09:14:45Z",
        "name": "mesh-expansion-http-service",
        "namespace": "hello",
        "selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/hello/serviceentries/mesh-expansion-http-service"
      },
      "apiVersion": "networking.istio.io/v1alpha3",
      "kind": "ServiceEntry",
      "spec": {
        "workloadSelector": {
          "labels": {
            "app": "http-workload"
          }
        },
        "hosts": [
          "http-service.hello.svc.cluster.local"
        ],
        "location": "MESH_INTERNAL",
        "ports": [
          {
            "number": 8000,
            "protocol": "HTTP",
            "name": "http-8000"
          },
          {
            "number": 8001,
            "protocol": "HTTP",
            "name": "http-8001"
          }
        ],
        "resolution": "STATIC"
      }
    },
    "http-service": [
      {
        "metadata": {
          "uid": "b447f308-2adf-4da6-99c3-f08ad1d8****",
          "resourceVersion": "114104****",
          "name": "http-service",
          "namespace": "hello",
          "creationTimestamp": "2020-08-11T09:14:45Z",
          "annotations": {
            "env": "staging",
            "group": "0001",
            "kubernetes.io/service-account.name": "http-sa"
          },
          "selfLink": "/api/v1/namespaces/hello/services/http-service",
          "labels": {
            "app": "http-workload"
          }
        },
        "spec": {
          "sessionAffinity": "None",
          "ports": [
            {
              "protocol": "TCP",
              "port": 8000,
              "name": "http-8000",
              "targetPort": 8000
            },
            {
              "protocol": "TCP",
              "port": 8001,
              "name": "http-8001",
              "targetPort": 8001
            }
          ],
          "type": "ClusterIP",
          "clusterIP": "172.21.**.**"
        },
        "status": {
          "loadBalancer": {}
        }
      }
    ],
    "mesh-expansion-http-service-2": {
      "metadata": {
        "generation": 1,
        "uid": "067a9df8-806c-4614-9683-12b5404****",
        "resourceVersion": "1247474706",
        "creationTimestamp": "2020-08-11T09:14:45Z",
        "name": "mesh-expansion-http-service-2",
        "namespace": "hello",
        "selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/hello/workloadentries/mesh-expansion-http-service-2"
      },
      "apiVersion": "networking.istio.io/v1alpha3",
      "kind": "WorkloadEntry",
      "spec": {
        "address": "192.168.0.3",
        "labels": {
          "app": "http-workload"
        }
      }
    },
    "mesh-expansion-http-service-1": {
      "metadata": {
        "generation": 1,
        "uid": "2b47a7e7-76f4-4a69-9988-5145e8a****",
        "resourceVersion": "12474****",
        "creationTimestamp": "2020-08-11T09:14:45Z",
        "name": "mesh-expansion-http-service-1",
        "namespace": "hello",
        "selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/hello/workloadentries/mesh-expansion-http-service-1"
      },
      "apiVersion": "networking.istio.io/v1alpha3",
      "kind": "WorkloadEntry",
      "spec": {
        "address": "192.168.0.2",
        "labels": {
          "app": "http-workload"
        }
      }
    }
  }
}

示例

请求示例

http(s)://[Endpoint]/?Action=AddVmAppToMesh
&<公共请求参数>

正常返回示例

XML 格式

<RequestId>BD65C0AD-D3C6-48D3-8D93-38D2015C****</RequestId>
<Data>...</Data>

JSON 格式

{"RequestId":"BD65C0AD-D3C6-48D3-8D93-38D2015C****","Data":"..."}

错误码

HttpCode 错误码 错误信息 描述
404 ServiceMesh.NotFound The Service Mesh cluster does not exist. 服务网格实例不存在

访问错误中心查看更多错误码。