容器引擎相关接口

创建应用

创建一个或多个微服务的集合。

描述

  • 一个应用或一组应用(通过标签归类)组成一个完整的业务功能。
  • 每个应用由一个或多个微服务组成,每个微服务可以独立启动、运行、治理。

URI

POST /cks/apps/v1/applications

请求参数

名称 是否必须 描述
displayName 应用名称
tag 应用标签
description 应用描述

返回参数

名称 位置 类型 是否必须 描述
id body Integer UUID
name body String 应用ID
displayName body String 应用名称
tag body String 应用标签
description body String 应用描述
ownerId body Integer 应用所有者ID
creatorId body Integer 应用创建者ID
ownerGroup body String 应用所属组
createdTime body String 应用创建时间
updatedTime body String 应用更新时间
deletedTime body String 应用删除时间

示例

  • Sample Request(请求):
POST /cks/apps/v1/applications
  • 请求Body:
{"displayName":"app-29z84fqn","tag":"instance","description":"应用实例创建"}
  • Sample Response(响应):

  • json格式

{
  "updatedTime": "2019-07-12T02:43:47Z",
  "displayName": "app-29z84fqn",
  "creatorId": 0,
  "creatorName": "iopdev",
  "ownerGroup": "group-cloud-operator",
  "description": "应用实例创建",
  "ownerId": 0,
  "requestId": "f20858cf-faac-4134-9d02-f5875ff2901d",
  "name": "app-5kdnbzhb",
  "namespace": "",
  "createdTime": "2019-07-12T02:43:47Z",
  "id": 6610,
  "tag": "instance",
  "deletedTime": "0001-01-01T00:00:00Z",
  "appenvSpec": null
}

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
201.999400 请求数据格式失败,读取请求数据失败 400
201.011001 创建应用失败 500

应用遍历

描述

  • 获取应用列表

URI

GET /cks/apps/v1/applications

返回参数

名称 是否必须 描述
id UUID
name 应用ID
displayName 应用名称
namespace 命名空间编码
tag 应用标签
description 应用描述
ownerId 应用所有者ID
creatorId 应用创建者ID
ownerGroup 应用所属组
createdTime 应用创建时间
updatedTime 应用更新时间
deletedTime 应用删除时间
appenvSpec 应用实例列表

示例

  • Sample Request(请求):
GET /cks/apps/v1/applications
  • Sample Response(响应):

  • json格式

{
  "data": [
    {
      "updatedTime": "2019-07-09T06:02:58Z",
      "displayName": "test",
      "creatorId": 0,
      "creatorName": "iopdev",
      "ownerGroup": "group-cloud-operator",
      "description": "",
      "ownerId": 0,
      "name": "app-lzdpcqhj",
      "namespace": "",
      "createdTime": "2019-07-09T06:02:58Z",
      "id": 6570,
      "tag": "ceshi",
      "deletedTime": "0001-01-01T00:00:00Z",
      "appenvSpec": [
        {
          "serviceType": "",
          "containerImageId": "container-001#registry.cluster11.com:5000/trident_iopdev/yuio@sha256:f04288efc7e65a84be74d4fc63e235ac3c6c603cf832e442e0bd3f240b10a91b",
          "virtualService": {
            "metadata": {
              "creationTimestamp": null
            },
            "spec": {}
          },
          "displayName": "app-kehys",
          "creatorId": 0,
          "creatorName": "iopdev",
          "routePathMatchType": "",
          "type": "DeploymentImage",
          "ownerId": 0,
          "accessMode": "domain",
          "deploymentSpec": null,
          "routeruleSpec": null,
          "environmentId": "9439c591-b8c9-486d-8793-8d8f8eb9f292",
          "deploymentDetail": null,
          "createdTime": "2019-07-10T06:12:04Z",
          "id": 5528,
          "servicePort": null,
          "tag": "",
          "cronJobDetail": null,
          "releaseStrategyType": "RollingUpdate",
          "deletedTime": "0001-01-01T00:00:00Z",
          "containerImage": "container-001#registry.cluster11.com:5000/trident_iopdev/yuio:poiu",
          "serviceSpec": null,
          "updatedTime": "2019-07-10T06:12:04Z",
          "appName": "app-lzdpcqhj",
          "replicas": 1,
          "ownerGroupId": "group-cloud-operator",
          "softPackageImage": "",
          "routeSubDomain": "",
          "routeHost": "",
          "ingressSpec": {},
          "isCreateRoute": false,
          "podSpec": {
            "containers": null
          },
          "serviceName": "",
          "routePath": "",
          "autoSwitchTraffic": "1",
          "name": "app-kehys",
          "namespace": "default",
          "serviceList": null,
          "statefulsetDetail": null
        }
      ]
    }
  ],
  "requestId": "d3bfcfb4-d4c5-4401-9c89-8412ad271832"
}

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
201.011904 查询应用数据失败 500

应用详情

描述

  • 获取应用的详细信息

URI

GET /cks/apps/v1/applications/{id}

请求参数

名称 是否必须 描述
id UUID

返回参数

名称 位置 类型 是否必须 描述
id body Integer UUID
name body String 应用ID
displayName body String 应用名称
namespace body String 命名空间编码
tag body String 应用标签
description body String 应用描述
ownerId body Integer 应用所有者ID
creatorId body Integer 应用创建者ID
ownerGroup body String 应用所属组
createdTime body String 应用创建时间
updatedTime body String 应用更新时间
deletedTime body String 应用删除时间
appenvSpec body Object(appenvSpec列表) 应用实例列表

示例

  • Sample Request(请求):
GET /cks/apps/v1/applications/201808201435602
  • Sample Response(响应):

  • json格式:

{
  "updatedTime": "2019-07-09T08:13:21Z",
  "displayName": "xj20190708",
  "creatorId": 0,
  "creatorName": "iopdev",
  "ownerGroup": "group-cloud-operator",
  "description": "",
  "ownerId": 0,
  "requestId": "c581e100-2e06-4038-9f48-ed6654baa96c",
  "name": "app-29z84fqn",
  "namespace": "",
  "createdTime": "2019-07-09T08:13:21Z",
  "id": 6574,
  "tag": "xjtest",
  "deletedTime": "0001-01-01T00:00:00Z",
  "appenvSpec": [
    {
      "serviceType": "",
      "containerImageId": "container-001#registry.cluster11.com:5000/trident_iopdev/nginx@sha256:c662b511116086245e66993e5f4199b3d11a3f6a57d184a61c8928d8cae51cb3",
      "virtualService": {
        "metadata": {
          "uid": "78545ed2-a440-11e9-9d8d-6c92bf743ff6",
          "resourceVersion": "265175624",
          "name": "app-y5v4b-default-gateway",
          "namespace": "default",
          "creationTimestamp": "2019-07-12T01:00:41Z",
          "annotations": {
            "cloud.inspur.com/defaultsvc": "true"
          },
          "selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/app-y5v4b-default-gateway",
          "labels": {
            "app": "app-y5v4b",
            "user_group": "group-cloud-operator",
            "application": "app-29z84fqn",
            "appinstance": "app-y5v4b",
            "app-y5v4b-default-svc": "service",
            "scope": "gateway",
            "user": "iopdev"
          }
        },
        "apiVersion": "networking.istio.io/v1alpha3",
        "kind": "VirtualService",
        "spec": {
          "gateways": [
            "default.istio-system.svc.cluster.local"
          ],
          "hosts": [
            "app-y5v4b-default.10.110.25.114.xip.io"
          ],
          "http": [
            {
              "route": [
                {
                  "destination": {
                    "port": {
                      "number": 161
                    },
                    "host": "app-y5v4b-default-svc.default.svc.cluster.local",
                    "subset": "rollingupdate"
                  }
                }
              ],
              "match": [
                {
                  "uri": {
                    "prefix": "/"
                  }
                }
              ]
            }
          ]
        }
      },
      "displayName": "app-y5v4b",
      "creatorId": 0,
      "creatorName": "iopdev",
      "routePathMatchType": "",
      "type": "DeploymentImage",
      "ownerId": 0,
      "accessMode": "domain",
      "deploymentSpec": null,
      "routeruleSpec": null,
      "environmentId": "9439c591-b8c9-486d-8793-8d8f8eb9f292",
      "deploymentDetail": [
        {
          "newReplicaSet": {
            "containerImages": [
              {
                "containerName": "container-001",
                "containerImage": "registry.cluster11.com:5000/trident_iopdev/nginx@sha256:c662b511116086245e66993e5f4199b3d11a3f6a57d184a61c8928d8cae51cb3"
              }
            ],
            "typeMeta": {
              "kind": "replicaset"
            },
            "objectMeta": {
              "name": "app-y5v4b-6b567c5876",
              "namespace": "default",
              "creationTimestamp": "2019-07-12T01:00:34Z",
              "annotations": {
                "deployment.inspur.com/role": "rollingupdate",
                "deployment.kubernetes.io/max-replicas": "2",
                "sidecar.istio.io/inject": "true",
                "deployment.kubernetes.io/revision": "1",
                "deployment.kubernetes.io/desired-replicas": "1",
                "kubernetes.io/change-cause": "应用初始化部署"
              },
              "labels": {
                "app": "app-y5v4b",
                "user_group": "group-cloud-operator",
                "application": "app-29z84fqn",
                "appinstance": "app-y5v4b",
                "pod-template-hash": "2612371432",
                "user": "iopdev",
                "version": "rollingupdate",
                "deployment": "app-y5v4b"
              }
            },
            "pods": {
              "running": 1,
              "current": 1,
              "desired": 1,
              "pending": 0,
              "warnings": [],
              "failed": 0,
              "succeeded": 0
            },
            "initContainerImages": null
          },
          "statusInfo": {
            "unavailable": 0,
            "replicas": 1,
            "available": 1,
            "updated": 1
          },
          "eventList": {
            "listMeta": {
              "totalItems": 0
            },
            "events": null
          },
          "replicas": 1,
          "podList": {
            "listMeta": {
              "totalItems": 0
            },
            "pods": null,
            "cumulativeMetrics": null,
            "errors": null,
            "status": {
              "running": 0,
              "pending": 0,
              "failed": 0,
              "succeeded": 0
            }
          },
          "rollingUpdateStrategy": {
            "maxSurge": "25%",
            "maxUnavailable": "25%"
          },
          "oldReplicaSetList": {
            "listMeta": {
              "totalItems": 0
            },
            "replicaSets": null,
            "cumulativeMetrics": null,
            "errors": null,
            "status": {
              "running": 0,
              "pending": 0,
              "failed": 0,
              "succeeded": 0
            }
          },
          "typeMeta": {
            "kind": "deployment"
          },
          "objectMeta": {
            "name": "app-y5v4b",
            "namespace": "default",
            "creationTimestamp": "2019-07-12T01:00:33Z",
            "annotations": {
              "deployment.inspur.com/role": "rollingupdate",
              "sidecar.istio.io/inject": "true",
              "deployment.kubernetes.io/revision": "1",
              "kubernetes.io/change-cause": "应用初始化部署"
            },
            "labels": {
              "app": "app-y5v4b",
              "user_group": "group-cloud-operator",
              "application": "app-29z84fqn",
              "appinstance": "app-y5v4b",
              "user": "iopdev",
              "version": "rollingupdate",
              "deployment": "app-y5v4b"
            }
          },
          "selector": {
            "app": "app-y5v4b",
            "user_group": "group-cloud-operator",
            "application": "app-29z84fqn",
            "appinstance": "app-y5v4b",
            "user": "iopdev",
            "version": "rollingupdate",
            "deployment": "app-y5v4b"
          },
          "revisionHistoryLimit": 10,
          "minReadySeconds": 0,
          "strategy": "RollingUpdate",
          "horizontalPodAutoscalerList": {
            "horizontalpodautoscalers": null,
            "listMeta": {
              "totalItems": 0
            },
            "errors": null
          },
          "errors": []
        }
      ],
      "createdTime": "2019-07-12T01:00:41Z",
      "id": 5535,
      "servicePort": null,
      "tag": "",
      "cronJobDetail": null,
      "releaseStrategyType": "RollingUpdate",
      "deletedTime": "0001-01-01T00:00:00Z",
      "containerImage": "container-001#registry.cluster11.com:5000/trident_iopdev/nginx:latest",
      "serviceSpec": null,
      "updatedTime": "2019-07-12T01:00:41Z",
      "appName": "app-29z84fqn",
      "replicas": 1,
      "ownerGroupId": "group-cloud-operator",
      "softPackageImage": "",
      "routeSubDomain": "",
      "routeHost": "",
      "ingressSpec": {},
      "isCreateRoute": false,
      "podSpec": {
        "containers": null
      },
      "serviceName": "",
      "routePath": "",
      "autoSwitchTraffic": "1",
      "name": "app-y5v4b",
      "namespace": "default",
      "serviceList": null,
      "statefulsetDetail": null
    }
  ]
}

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
201.011905 查询应用数据失败 500

删除应用

描述

  • 删除一个应用

URI

DELETE /cks/apps/v1/applications/{id}

请求参数

名称 是否必须 描述
id UUID

示例

  • Sample Request(请求):
DELETE /cks/apps/v1/applications/201808201435602
  • Sample Response(响应):
  • json格式

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
201.011905 删除应用数据失败 500

发布应用实例

创建一个应用实例。

描述

  • 一个应用实例可以通过指定程序包或一个镜像创建,每个应用实例包含一个服务或多个服务。
  • 可简单的配置发布策略,实现应用的滚动发布、蓝绿发布或灰度发布。 在高级配置中可以指定应用本身所需的环境变量、卷、资源限额等信息以及服务路由信息。

URI

POST /cks/apps/v1/clusters/{clusterId}/instances

请求参数

名称 是否必须 描述
clusterId 集群环境ID
displayName 实例名称
name 实例ID
appName 应用ID
namespace 命名空间
containerImage 镜像名称
containerImageId 镜像编码
releaseStrategyType 发布策略
replicas 副本数
podSpec 实例描述
servicePort 服务端口
environmentId 集群环境ID
routeHost 域名前缀
routeSubDomain 域名后缀
accessMode 访问方式

返回参数

名称 位置 类型 是否必须 描述
id body Integer UUID
name body String 实例ID
displayName body String 实例名称
appName body String 所属应用ID
namespace body String 命名空间
environmentId body String 集群环境ID
accessMode body String 访问方式
ownerId body Integer 实例所有者ID
creatorId body Integer 实例创建者ID
ownerGroup body String 实例所属组
createdTime body String 实例创建时间
updatedTime body String 实例更新时间
deletedTime body String 实例删除时间
containerImage body String 镜像名称
containerImageId body String 镜像编码
releaseStrategyType body String 发布策略
replicas body Integer 副本数
podSpec body Object(PodSpec 实例描述
servicePort body Object(ServicePort 服务端口

示例

  • Sample Request(请求):
POST /cks/apps/v1/clusters/9439c591-b8c9-486d-8793-8d8f8eb9f292/instances
  • 请求Body:
{
  "autoSwitchTraffic": "1",
  "displayName": "app-s65ag",
  "name": "app-s65ags",
  "namespace": "default",
  "appName": "app-6qfcq7f6",
  "containerImage": "container-001#registry.cluster11.com:5000/trident_iopdev/iot-streammgr:4.5-beta",
  "containerImageId": "container-001#registry.cluster11.com:5000/trident_iopdev/iot-streammgr@sha256:4e54cf9be83458973f4102f9b768f31fe3f0466f0c65adb555fea586a6e5de62",
  "releaseStrategyType": "RollingUpdate",
  "replicas": 1,
  "podSpec": {
    "restartPolicy": "Always",
    "affinity": {
      "nodeAffinity": {

      },
      "podAffinity": {

      },
      "podAntiAffinity": {

      }
    },
    "containers": [
      {
        "image": "registry.cluster11.com:5000/trident_iopdev/iot-streammgr@sha256:4e54cf9be83458973f4102f9b768f31fe3f0466f0c65adb555fea586a6e5de62",
        "ports": [
          {
            "containerPort": 80,
            "protocol": "TCP"
          }
        ],
        "volumeMounts": [

        ],
        "name": "container-001"
      }
    ],
    "initContainers": [

    ],
    "volumes": [

    ]
  },
  "serviceType": "ClusterIP",
  "volumeMount": {
    "pvcMount": [

    ],
    "dynamicMount": [

    ],
    "staticMount": [

    ]
  },
  "servicePort": [
    {
      "targetPort": 80,
      "protocol": "TCP"
    }
  ],
  "environmentId": "9439c591-b8c9-486d-8793-8d8f8eb9f292",
  "type": "DeploymentImage",
  "routeHost": "",
  "routeSubDomain": ".10.110.25.114.xip.io",
  "accessMode": "domain"
}
  • Sample Response(响应):

  • json格式

{
  "serviceType": "ClusterIP",
  "containerImageId": "container-001#registry.cluster11.com:5000/trident_iopdev/iot-streammgr@sha256:4e54cf9be83458973f4102f9b768f31fe3f0466f0c65adb555fea586a6e5de62",
  "volumeMount": {},
  "virtualService": {
    "metadata": {
      "creationTimestamp": null
    },
    "spec": {}
  },
  "displayName": "app-s65ag",
  "creatorId": 0,
  "creatorName": "iopdev",
  "routePathMatchType": "",
  "type": "DeploymentImage",
  "ownerId": 0,
  "accessMode": "domain",
  "deploymentSpec": [
    {
      "serviceType": "ClusterIP",
      "imagePullPolicy": "Always",
      "cpuRequirement": null,
      "podManagementPolicy": "",
      "variables": null,
      "containerCommandArgs": null,
      "isExternal": false,
      "softPackageName": "",
      "replicas": 1,
      "softPackageImage": "",
      "description": null,
      "annotations": [
        {
          "value": "应用初始化部署",
          "key": "kubernetes.io/change-cause"
        },
        {
          "value": "rollingupdate",
          "key": "deployment.inspur.com/role"
        },
        {
          "value": "true",
          "key": "sidecar.istio.io/inject"
        }
      ],
      "statefulsetUpdateType": "",
      "podSpec": {
        "imagePullSecrets": [
          {
            "name": "trident-iopdev-registry"
          }
        ],
        "containers": [
          {
            "image": "registry.cluster11.com:5000/trident_iopdev/iot-streammgr@sha256:4e54cf9be83458973f4102f9b768f31fe3f0466f0c65adb555fea586a6e5de62",
            "imagePullPolicy": "Always",
            "name": "container-001",
            "resources": {},
            "ports": [
              {
                "protocol": "TCP",
                "name": "bqdr2-tcp-80",
                "containerPort": 80
              }
            ]
          }
        ],
        "restartPolicy": "Always",
        "affinity": {
          "nodeAffinity": {},
          "podAffinity": {},
          "podAntiAffinity": {}
        }
      },
      "serviceName": "",
      "containerCommand": null,
      "portMappings": [
        {
          "protocol": "TCP",
          "port": 15684,
          "name": "http-15684-80-hknff",
          "targetPort": 80,
          "nodePort": 0
        }
      ],
      "labels": [
        {
          "value": "app-s65ags",
          "key": "app"
        },
        {
          "value": "app-6qfcq7f6",
          "key": "application"
        },
        {
          "value": "app-s65ags",
          "key": "appinstance"
        },
        {
          "value": "group-cloud-operator",
          "key": "user_group"
        },
        {
          "value": "iopdev",
          "key": "user"
        },
        {
          "value": "rollingupdate",
          "key": "version"
        },
        {
          "value": "app-s65ags",
          "key": "deployment"
        }
      ],
      "imagePullSecret": "trident-iopdev-registry",
      "name": "app-s65ags",
      "namespace": "default",
      "memoryRequirement": null,
      "runAsPrivileged": false,
      "containerImage": "container-001#registry.cluster11.com:5000/trident_iopdev/iot-streammgr:4.5-beta"
    }
  ],
  "routeruleSpec": null,
  "environmentId": "9439c591-b8c9-486d-8793-8d8f8eb9f292",
  "requestId": "80ebcf1a-64d1-4433-9e3d-225f80084fb2",
  "deploymentDetail": null,
  "createdTime": "2019-07-15T06:43:41Z",
  "id": 5559,
  "servicePort": [
    {
      "protocol": "TCP",
      "port": 15684,
      "name": "http-15684-80-hknff",
      "targetPort": 80
    }
  ],
  "tag": "",
  "cronJobDetail": null,
  "releaseStrategyType": "RollingUpdate",
  "deletedTime": "0001-01-01T00:00:00Z",
  "containerImage": "container-001#registry.cluster11.com:5000/trident_iopdev/iot-streammgr:4.5-beta",
  "serviceSpec": null,
  "updatedTime": "2019-07-15T06:43:41Z",
  "appName": "app-6qfcq7f6",
  "replicas": 1,
  "ownerGroupId": "group-cloud-operator",
  "softPackageImage": "",
  "routeSubDomain": ".10.110.25.114.xip.io",
  "routeHost": "",
  "ingressSpec": {},
  "isCreateRoute": false,
  "podSpec": {
    "containers": [
      {
        "image": "registry.cluster11.com:5000/trident_iopdev/iot-streammgr@sha256:4e54cf9be83458973f4102f9b768f31fe3f0466f0c65adb555fea586a6e5de62",
        "imagePullPolicy": "Always",
        "name": "container-001",
        "resources": {},
        "ports": [
          {
            "protocol": "TCP",
            "name": "bqdr2-tcp-80",
            "containerPort": 80
          }
        ]
      }
    ],
    "restartPolicy": "Always",
    "affinity": {
      "nodeAffinity": {},
      "podAffinity": {},
      "podAntiAffinity": {}
    }
  },
  "serviceName": "",
  "routePath": "",
  "autoSwitchTraffic": "1",
  "name": "app-s65ags",
  "namespace": "default",
  "serviceList": null,
  "statefulsetDetail": null
}

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码 说明
204.001902 获取集群信息失败 500 连接集群失败
201.999400 请求数据格式失败,读取请求数据失败 400 请求数据格式有误
201.012001 创建应用实例失败 500 应用容器数量为0,请至少创建1个应用容器
201.012003 容器数量已达配额上限 500 容器数量超过最大可建容器数量
201.012002 创建应用实例失败 500 获取卷详细信息失败,卷名已存在等原因
201.019001 连接集群失败,无法创建服务 500 集群连接异常
201.013021 连接集群失败,无法创建无状态负载 500 集群连接异常
201.012005 负载数量已达配额上限,无法创建实例 500 负载数量已达最大可创建负载数量
201.016001 连接集群失败,无法创建有状态负载 500 集群连接异常
201.012901 保存应用实例数据失败 500 数据库保存数据失败

实例遍历

条件查询应用实例列表。

描述

  • 可以根据不同的集群和不同的名称空间进行实例列表查询
  • 可以根据实例名称和应用名称查询实例

URI

GET /cks/apps/v1/clusters/{clusterId}/instances?namespace=&appName=&appenvName=

请求参数

名称 是否必须 描述
clusterId 集群环境ID
appenvName 实例名称
appName 应用名称
namespace 命名空间

返回参数

名称 位置 类型 是否必须 描述
Object body Object(InstanceSpec列表) 应用实例列表

示例

  • Sample Request(请求):
GET /cks/apps/v1/clusters/9439c591-b8c9-486d-8793-8d8f8eb9f292/instances?namespace=&appName=&appenvName=
  • Sample Response(响应):

  • json格式

{
  "data": [
    {
      "serviceType": "",
      "containerImageId": "container-001#registry.cluster11.com:5000/trident_iopdev/nginx@sha256:8ae79811f8d183544805d5e20a06dcb2d735e2712c11ce602babe18f58f82e3f",
      "virtualService": {
        "metadata": {
          "creationTimestamp": null
        },
        "spec": {}
      },
      "displayName": "app-4891x",
      "creatorId": 0,
      "creatorName": "iopdev",
      "routePathMatchType": "",
      "type": "DeploymentImage",
      "ownerId": 0,
      "accessMode": "cluster",
      "deploymentSpec": null,
      "routeruleSpec": null,
      "environmentId": "9439c591-b8c9-486d-8793-8d8f8eb9f292",
      "deploymentDetail": null,
      "createdTime": "2019-07-09T06:49:34Z",
      "id": 5521,
      "servicePort": null,
      "tag": "",
      "cronJobDetail": null,
      "releaseStrategyType": "RollingUpdate",
      "deletedTime": "0001-01-01T00:00:00Z",
      "containerImage": "container-001#registry.cluster11.com:5000/trident_iopdev/nginx:test",
      "serviceSpec": null,
      "updatedTime": "2019-07-09T08:16:02Z",
      "appName": "app-5552s5lz",
      "replicas": 1,
      "ownerGroupId": "group-cloud-operator",
      "softPackageImage": "",
      "routeSubDomain": "",
      "routeHost": "",
      "ingressSpec": {},
      "isCreateRoute": false,
      "podSpec": {
        "containers": null
      },
      "serviceName": "",
      "routePath": "",
      "autoSwitchTraffic": "1",
      "name": "app-4891x",
      "namespace": "default",
      "serviceList": null,
      "statefulsetDetail": null
    }
  ],
  "requestId": "d13976f6-3de3-41ab-b8a7-8ead5e479ecd"
}

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
204.001902 获取集群信息失败 500
201.012905 查询应用实例数据失败 500

实例详情

获取某个实例的详情信息。

描述

  • 通过应用实例ID获取该实例的详情信息

URI

GET /cks/apps/v1/clusters/{clusterId}/instances/{id}

请求参数

名称 是否必须 描述
clusterId 集群环境ID
id 实例ID
type 实例类型

返回参数

名称 位置 类型 是否必须 描述
id body Integer UUID
name body String 实例ID
displayName body String 实例名称
appName body String 所属应用ID
namespace body String 命名空间
environmentId body String 集群环境ID
accessMode body String 访问方式
ownerId body Integer 实例所有者ID
creatorId body Integer 实例创建者ID
ownerGroup body String 实例所属组
createdTime body String 实例创建时间
updatedTime body String 实例更新时间
deletedTime body String 实例删除时间
containerImage body String 镜像名称
containerImageId body String 镜像编码
releaseStrategyType body String 发布策略
replicas body Integer 副本数
podSpec body Object(PodSpec 实例描述
serviceList body Object(ServicePort 服务列表
virtualService body Object(VirtualService 服务路由
deploymentDetail body Object(DeploymentDetail 部署详情

示例

  • Sample Request(请求):
GET /cks/apps/v1/clusters/9439c591-b8c9-486d-8793-8d8f8eb9f292/instances/5542
  • Sample Response(响应):

  • json格式

{
  "serviceType": "",
  "containerImageId": "container-001#registry.cluster11.com:5000/trident_iopdev/iot-streammgr@sha256:4e54cf9be83458973f4102f9b768f31fe3f0466f0c65adb555fea586a6e5de62",
  "virtualService": {
    "metadata": {
      "creationTimestamp": null
    },
    "spec": {}
  },
  "displayName": "app-ddqxa",
  "creatorId": 0,
  "creatorName": "iopdev",
  "routePathMatchType": "",
  "type": "DeploymentImage",
  "ownerId": 0,
  "accessMode": "domain",
  "deploymentSpec": null,
  "routeruleSpec": null,
  "environmentId": "9439c591-b8c9-486d-8793-8d8f8eb9f292",
  "requestId": "405abe18-9a71-40d7-950b-cb66a51659b2",
  "deploymentDetail": [
    {
      "newReplicaSet": {
        "containerImages": [
          {
            "containerName": "container-001",
            "containerImage": "trident_iopdev/iot-streammgr@sha256:4e54cf9be83458973f4102f9b768f31fe3f0466f0c65adb555fea586a6e5de62"
          }
        ],
        "typeMeta": {
          "kind": "replicaset"
        },
        "objectMeta": {
          "name": "app-ddqxa-5f957bbdd9",
          "namespace": "default",
          "creationTimestamp": "2019-07-12T03:36:53Z",
          "annotations": {
            "deployment.inspur.com/role": "rollingupdate",
            "deployment.kubernetes.io/max-replicas": "2",
            "sidecar.istio.io/inject": "true",
            "deployment.kubernetes.io/revision": "3",
            "deployment.kubernetes.io/desired-replicas": "1",
            "kubernetes.io/change-cause": "手动触发更新"
          },
          "labels": {
            "app": "app-ddqxa",
            "user_group": "group-cloud-operator",
            "application": "app-qn22mvcn",
            "appinstance": "app-ddqxa",
            "pod-template-hash": "1951366885",
            "user": "iopdev",
            "version": "rollingupdate",
            "deployment": "app-ddqxa"
          }
        },
        "pods": {
          "running": 1,
          "current": 1,
          "desired": 1,
          "pending": 0,
          "warnings": [],
          "failed": 0,
          "succeeded": 0
        },
        "initContainerImages": null
      },
      "statusInfo": {
        "unavailable": 0,
        "replicas": 1,
        "available": 1,
        "updated": 1
      },
      "eventList": {
        "listMeta": {
          "totalItems": 0
        },
        "events": []
      },
      "replicas": 1,
      "podList": {
        "listMeta": {
          "totalItems": 1
        },
        "pods": [
          {
            "nodeName": "slave2",
            "typeMeta": {
              "kind": "pod"
            },
            "podStatus": {
              "podPhase": "Running",
              "containerStates": [
                {
                  "running": {
                    "startedAt": "2019-07-12T06:22:22Z"
                  }
                },
                {
                  "running": {
                    "startedAt": "2019-07-12T03:37:00Z"
                  }
                }
              ],
              "status": "Running"
            },
            "restartCount": 21,
            "objectMeta": {
              "name": "app-ddqxa-5f957bbdd9-zgbjs",
              "namespace": "default",
              "creationTimestamp": "2019-07-12T03:36:53Z",
              "annotations": {
                "sidecar.istio.io/status": "{\"version\":\"b64ff87990d99becd4433f619b4b51b0913453430ba4ab54dfce844f9d37f1dc\",\"initContainers\":[\"istio-init\"],\"containers\":[\"istio-proxy\"],\"volumes\":[\"istio-envoy\",\"istio-certs\"],\"imagePullSecrets\":null}",
                "deployment.inspur.com/role": "rollingupdate",
                "cluster.inspur.com/container-image": "{\"container-001\":\"registry.cluster11.com:5000/trident_iopdev/iot-streammgr:0.1.0\"}",
                "sidecar.istio.io/inject": "true",
                "kubernetes.io/change-cause": "应用初始化部署"
              },
              "labels": {
                "app": "app-ddqxa",
                "user_group": "group-cloud-operator",
                "application": "app-qn22mvcn",
                "appinstance": "app-ddqxa",
                "pod-template-hash": "1951366885",
                "user": "iopdev",
                "version": "rollingupdate",
                "deployment": "app-ddqxa"
              }
            },
            "warnings": [],
            "metrics": null
          }
        ],
        "cumulativeMetrics": [],
        "errors": [],
        "status": {
          "running": 0,
          "pending": 0,
          "failed": 0,
          "succeeded": 0
        }
      },
      "rollingUpdateStrategy": {
        "maxSurge": "25%",
        "maxUnavailable": "25%"
      },
      "oldReplicaSetList": {
        "listMeta": {
          "totalItems": 0
        },
        "replicaSets": [],
        "cumulativeMetrics": [],
        "errors": [],
        "status": {
          "running": 0,
          "pending": 0,
          "failed": 0,
          "succeeded": 0
        }
      },
      "typeMeta": {
        "kind": "deployment"
      },
      "objectMeta": {
        "name": "app-ddqxa",
        "namespace": "default",
        "creationTimestamp": "2019-07-12T02:34:54Z",
        "annotations": {
          "deployment.inspur.com/role": "rollingupdate",
          "sidecar.istio.io/inject": "true",
          "deployment.kubernetes.io/revision": "3",
          "kubernetes.io/change-cause": "手动触发更新"
        },
        "labels": {
          "app": "app-ddqxa",
          "user_group": "group-cloud-operator",
          "application": "app-qn22mvcn",
          "appinstance": "app-ddqxa",
          "user": "iopdev",
          "version": "rollingupdate",
          "deployment": "app-ddqxa"
        }
      },
      "selector": {
        "app": "app-ddqxa",
        "user_group": "group-cloud-operator",
        "application": "app-qn22mvcn",
        "appinstance": "app-ddqxa",
        "user": "iopdev",
        "version": "rollingupdate",
        "deployment": "app-ddqxa"
      },
      "revisionHistoryLimit": 10,
      "minReadySeconds": 0,
      "strategy": "RollingUpdate",
      "horizontalPodAutoscalerList": {
        "horizontalpodautoscalers": [],
        "listMeta": {
          "totalItems": 0
        },
        "errors": []
      },
      "errors": []
    }
  ],
  "createdTime": "2019-07-12T02:34:54Z",
  "id": 5542,
  "servicePort": null,
  "tag": "",
  "cronJobDetail": null,
  "releaseStrategyType": "RollingUpdate",
  "deletedTime": "0001-01-01T00:00:00Z",
  "containerImage": "container-001#registry.cluster11.com:5000/trident_iopdev/iot-streammgr:0.1.0",
  "serviceSpec": null,
  "updatedTime": "2019-07-12T03:36:53Z",
  "appName": "app-qn22mvcn",
  "replicas": 1,
  "ownerGroupId": "group-cloud-operator",
  "softPackageImage": "",
  "routeSubDomain": "",
  "routeHost": "",
  "ingressSpec": {},
  "isCreateRoute": false,
  "podSpec": {
    "containers": null
  },
  "serviceName": "",
  "routePath": "",
  "autoSwitchTraffic": "1",
  "name": "app-ddqxa",
  "namespace": "default",
  "serviceList": {
    "metadata": {
      "resourceVersion": "265308479",
      "selfLink": "/api/v1/namespaces/default/services"
    },
    "items": [
      {
        "metadata": {
          "uid": "a1e18d6c-a44d-11e9-9d8d-6c92bf743ff6",
          "resourceVersion": "265214692",
          "name": "app-ddqxa-default-svc",
          "namespace": "default",
          "creationTimestamp": "2019-07-12T02:34:54Z",
          "annotations": {
            "cloud.inspur.com/defaultsvc": "true"
          },
          "selfLink": "/api/v1/namespaces/default/services/app-ddqxa-default-svc",
          "labels": {
            "app": "app-ddqxa",
            "user_group": "group-cloud-operator",
            "application": "app-qn22mvcn",
            "appinstance": "app-ddqxa",
            "user": "iopdev"
          }
        },
        "spec": {
          "sessionAffinity": "None",
          "selector": {
            "app": "app-ddqxa",
            "user_group": "group-cloud-operator",
            "application": "app-qn22mvcn",
            "appinstance": "app-ddqxa",
            "user": "iopdev"
          },
          "ports": [
            {
              "protocol": "TCP",
              "port": 11730,
              "name": "http-11730-80-xcgbc",
              "targetPort": 80
            }
          ],
          "type": "ClusterIP",
          "clusterIP": "158.158.44.52"
        },
        "status": {
          "loadBalancer": {}
        }
      }
    ]
  },
  "statefulsetDetail": null
}

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
204.001902 获取集群信息失败 500
201.016902 连接集群失败,无法获取有状态负载信息 500
201.013002 连接集群失败,无法获取悟状态负载信息 500
201.019004 连接集群失败,无法获取服务信息 500

删除实例

根据应用实例ID删除某个实例的信息。

描述

删除实例

  • 删除该应用实例相关的数据库元数据和k8s资源。

URI

DELETE /cks/apps/v1/clusters/{clusterId}/instances/{id}

请求参数

名称 是否必须 描述
id 实力编码
clusterId 集群ID

返回参数

示例

  • Sample Request(请求):
DELETE /cks/apps/v1/clusters/9439c591-b8c9-486d-8793-8d8f8eb9f292/instances/5542
  • Sample Response(响应):
  • json格式

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
201.012907 查询应用实例数据失败 500

获取实例访问地址

获取某个实例的访问地址。

描述

根据实例名称查询该实例的访问地址

URI

GET cks/servicemesh/v1/clusters/{clusterId}/namespaces/{namespace}/applications/{application}/instances/{instance}/accessaddresses

请求参数

名称 位置 类型 是否必须 描述
clusterId path String 集群ID
namespace path String 名称空间
application path String 应用名称
instance path String 应用实例名称

返回参数

名称 位置 类型 是否必须 描述
地址列表 body List<NetAddress> 访问地址列表

示例

  • Sample Request(请求):
GET /cks/servicemesh/v1/clusters/ab38a4a7-8044-4d2b-9847-c92deaf7401e/namespaces/default/applications/app-4zk8k66r/instances/app-4zk8k66r-instance-c6chbx5g/accessaddresses
  • Sample Response(响应):

  • json格式

{
  "data": [
    {
      "netAddress": "app-akevt-default.10.110.25.114.xip.io/",
      "matchMode": "prefix"
    }
  ],
  "requestId": "a9625e2c-c111-41f5-83ab-667b537a8157"
}

返回值

请参考通用请求返回值

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码 说明
201.018002 获取数据失败,请检查k8s集群环境 500 集群连接异常

微服务遍历

描述

  • 获取微服务列表

URI

GET /cks/core/v1/clusters/{clusterId}/services?namespace=

请求参数

名称 是否必须 描述
clusterId 集群ID
namespace 命名空间编码
appName 应用ID

返回参数

名称 位置 类型 是否必须 描述
apiVersion body String APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.
kind body String Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated.
metadata body Object(ListMeta) Standard list metadata
items body Object(VirtualService列表) 应用标签

示例

  • Sample Request(请求):
GET /cks/core/v1/clusters/42804627-fe2e-4411-9101-93fcdee85a7f/services?namespace=
  • Sample Response(响应):

  • json格式

{
  "metadata": {
    "resourceVersion": "265297134",
    "selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/iop-test/virtualservices"
  },
  "apiVersion": "networking.istio.io/v1alpha3",
  "kind": "VirtualServiceList",
  "requestId": "d632930e-5fe9-4716-8ac4-9b6bff95ea3b",
  "items": [
    {
      "metadata": {
        "uid": "6fba53e6-a2c2-11e9-9d8d-6c92bf743ff6",
        "resourceVersion": "263915797",
        "name": "app-w7rbk-default-mesh",
        "namespace": "default",
        "creationTimestamp": "2019-07-10T03:25:59Z",
        "annotations": {
          "cloud.inspur.com/defaultsvc": "true"
        },
        "selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/app-w7rbk-default-mesh",
        "labels": {
          "app": "app-w7rbk",
          "user_group": "group-cloud-operator",
          "application": "app-5552s5lz",
          "appinstance": "app-w7rbk",
          "scope": "mesh",
          "app-w7rbk-default-svc": "service",
          "user": "iopdev"
        }
      },
      "apiVersion": "networking.istio.io/v1alpha3",
      "kind": "VirtualService",
      "spec": {
        "gateways": [
          "mesh"
        ],
        "hosts": [
          "app-w7rbk-default-svc.default.svc.cluster.local"
        ],
        "http": [
          {
            "route": [
              {
                "destination": {
                  "port": {
                    "number": 771
                  },
                  "host": "app-w7rbk-default-svc.default.svc.cluster.local",
                  "subset": "rollingupdate"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
201.018001 命名空间不能为空 400
201.018002 获取数据失败,请确认集群信息 500
201.018003 获取数据失败,数据转换异常

微服务详情

描述

  • 获取微服务详情

URI

GET /cks/core/v1/clusters/{clusterId}/namespaces/{namespace}/services/{name}

请求参数

名称 是否必须 描述
clusterId 集群环境ID
namespace 命名空间
name 微服务名称

返回参数

名称 位置 类型 是否必须 描述
apiVersion body String APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.
kind body String Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated.
metadata body Object(ObjectMeta) Standard metadata
spec body Object(VirtualServiceSpec) Virtual Service

示例

  • Sample Request(请求):
GET /cks/core/v1/clusters/42804627-fe2e-4411-9101-93fcdee85a7f/namespaces/default/services/test-install1574426541847-kibana
  • Sample Response(响应):

  • json格式

{
  "metadata": {
    "uid": "0d1304d8-a470-11e9-9d8d-6c92bf743ff6",
    "resourceVersion": "265315089",
    "name": "app-akevt-default-mesh",
    "namespace": "default",
    "creationTimestamp": "2019-07-12T06:41:17Z",
    "annotations": {
      "cloud.inspur.com/defaultsvc": "true"
    },
    "selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/app-akevt-default-mesh",
    "labels": {
      "app": "app-akevt",
      "user_group": "group-cloud-operator",
      "application": "app-h9wh2m74",
      "appinstance": "app-akevt",
      "scope": "mesh",
      "app-akevt-default-svc": "service",
      "user": "iopdev"
    }
  },
  "apiVersion": "networking.istio.io/v1alpha3",
  "kind": "VirtualService",
  "requestId": "800f55ac-66cc-404c-8a56-de5e8dd00b5c",
  "spec": {
    "gateways": [
      "mesh"
    ],
    "hosts": [
      "app-akevt-default-svc.default.svc.cluster.local"
    ],
    "http": [
      {
        "route": [
          {
            "destination": {
              "port": {
                "number": 19777
              },
              "host": "app-akevt-default-svc.default.svc.cluster.local",
              "subset": "rollingupdate"
            }
          }
        ]
      }
    ]
  }
}

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
201.018009 微服务不存在 404
201.018010 获取VirtualService失败,请确认集群信息 500
201.018005 获取VirtualService失败,数据转换错误 500

路由遍历

描述

  • 获取微服务路由列表

URI

GET /cks/servicemesh/v1/clusters/{clusterId}/virtualservices?namespace={namespace}&scope=gateway

请求参数

名称 是否必须 描述
clusterId 集群ID
scope 范围(固定传入值gateway)
namespace 命名空间编码
appName 应用ID

返回参数

名称 位置 类型 是否必须 描述
apiVersion body String APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.
kind body String Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated.
metadata body Object(ListMeta) Standard list metadata
items body Object(VirtualService列表) 应用标签

示例

  • Sample Request(请求):
GET /cks/servicemesh/v1/clusters/42804627-fe2e-4411-9101-93fcdee85a7f/virtualservices?namespace=&scope=gateway&appName=
  • Sample Response(响应):

  • json格式

{
  "metadata": {
    "resourceVersion": "265242629",
    "selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/iop-test/virtualservices"
  },
  "apiVersion": "networking.istio.io/v1alpha3",
  "kind": "VirtualServiceList",
  "requestId": "e177527b-7c72-40b1-85af-8e599cba841c",
  "items": [
    {
      "metadata": {
        "uid": "6fbb5569-a2c2-11e9-9d8d-6c92bf743ff6",
        "resourceVersion": "263915800",
        "name": "app-w7rbk-default-gateway",
        "namespace": "default",
        "creationTimestamp": "2019-07-10T03:25:59Z",
        "annotations": {
          "cloud.inspur.com/defaultsvc": "true"
        },
        "selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/app-w7rbk-default-gateway",
        "labels": {
          "app": "app-w7rbk",
          "user_group": "group-cloud-operator",
          "application": "app-5552s5lz",
          "appinstance": "app-w7rbk",
          "scope": "gateway",
          "app-w7rbk-default-svc": "service",
          "user": "iopdev"
        }
      },
      "apiVersion": "networking.istio.io/v1alpha3",
      "kind": "VirtualService",
      "spec": {
        "gateways": [
          "default.istio-system.svc.cluster.local"
        ],
        "hosts": [
          "app-w7rbk-default.10.110.25.114.xip.io"
        ],
        "http": [
          {
            "route": [
              {
                "destination": {
                  "port": {
                    "number": 771
                  },
                  "host": "app-w7rbk-default-svc.default.svc.cluster.local",
                  "subset": "rollingupdate"
                }
              }
            ],
            "match": [
              {
                "uri": {
                  "prefix": "/"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
201.018001 命名空间不能为空 400
201.018002 获取数据失败,请确认集群信息 500
201.018003 获取数据失败,数据转换异常

路由详情

描述

  • 获取微服务的路由详情

URI

GET /cks/servicemesh/v1/clusters/{clusterId}/namespaces/{namespace}/virtualservices/{name}

请求参数

名称 位置 类型 是否必须 描述
clusterId path String 集群环境ID
namespace path String 命名空间编码
name path String 服务路由名称

返回参数

名称 位置 类型 是否必须 描述
apiVersion body String APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.
kind body String Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated.
metadata body Object(ObjectMeta) Standard metadata
spec body Object(VirtualServiceSpec) Virtual Service

示例

  • Sample Request(请求):
GET /cks/servicemesh/v1/clusters/42804627-fe2e-4411-9101-93fcdee85a7f/namespaces/default/virtualservices/app-lpqzckxs-instance-p6ffbkcc-default-gateway
  • Sample Response(响应):

  • json格式

{
  "metadata": {
    "uid": "8fa9cd35-a44f-11e9-9d8d-6c92bf743ff6",
    "resourceVersion": "265220797",
    "name": "app-qjcrx-default-gateway",
    "namespace": "default",
    "creationTimestamp": "2019-07-12T02:48:43Z",
    "annotations": {
      "cloud.inspur.com/defaultsvc": "true"
    },
    "selfLink": "/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/app-qjcrx-default-gateway",
    "labels": {
      "app": "app-qjcrx",
      "app-qjcrx-default-svc": "service",
      "user_group": "group-cloud-operator",
      "application": "app-dtqq5rcj",
      "appinstance": "app-qjcrx",
      "scope": "gateway",
      "user": "iopdev"
    }
  },
  "apiVersion": "networking.istio.io/v1alpha3",
  "kind": "VirtualService",
  "requestId": "ebd4dce6-98e5-4d5b-bb9b-71539a6c5976",
  "spec": {
    "gateways": [
      "default.istio-system.svc.cluster.local"
    ],
    "hosts": [
      "app-qjcrx-default.10.110.25.114.xip.io"
    ],
    "http": [
      {
        "route": [
          {
            "destination": {
              "port": {
                "number": 10396
              },
              "host": "app-qjcrx-default-svc.default.svc.cluster.local",
              "subset": "rollingupdate"
            }
          }
        ],
        "match": [
          {
            "uri": {
              "prefix": "/"
            }
          }
        ]
      }
    ]
  }
}

错误码

以下为本接口特有的错误码。

错误代码 错误信息 Http状态码
201.018009 微服务不存在 404
201.018010 获取VirtualService失败,请确认集群信息 500
201.018005 获取VirtualService失败,数据转换错误 500