获取集群列表 - ShowClusterList
功能介绍
获取集群信息列表
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项。
URI
GET /v1/clusters
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| category | 否 | String | 获取特定category的集群。 |
| enablestatus | 否 | Boolean | 是否获取集群的资源信息。不填或者填写为true为获取集群资源汇总信息,置为false为不获取集群状态信息;缺省值为true |
| clustergroupid | 否 | String | 容器舰队ID。不填会返回用户所有集群,填了之后会返回属于该容器舰队的集群。 |
| limit | 否 | Integer | 分页获取列表时,页的大小,默认为-1 |
| offset | 否 | Integer | 分页获取列表时,起始偏移量,默认为0 |
| order_by | 否 | String | 分页获取列表时,排序参数,支持 create_at 和 update_at |
| order | 否 | String | 分页获取列表时,排序方向,支持 desc 和 asc |
| managetype | 否 | String | 获取集群列表时,根据集群类型筛选,不传参时默认为 all ,支持 all ,grouped,discrete 三种类型。 |
| clusterids | 否 | String | 集群ID。多个ID以英文逗号分隔。 |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| X-Auth-Token | 否 | String | 身份认证信息,调用接口的认证方式分为Token和AK/SK两种,如果您使用的Token方式,此参数为必填,请填写Token的值 |
响应参数
状态码:200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| items | Array of Cluster objects | 集群成员的列表 |
| total | Integer | 集群总数 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| kind | String | API类型,固定值“Cluster”,该值不可修改。 |
| apiVersion | String | API版本,固定值“v1”,该值不可修改。 |
| metadata | ObjectMeta object | 集群的基本信息,为集合类的元素类型,包含一组由不同名称定义的属性。 |
| spec | ClusterSpec object | spec是集合类的元素类型,您对需要管理的集群对象进行详细描述的主体部分都在spec中给出。UCS通过spec的描述来创建或更新对象。 |
| status | ClusterStatus object | 集合类的元素类型,用于记录对象在系统中的当前状态信息。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| uid | String | 资源ID |
| name | String | 资源名称 |
| generateName | String | 当未提供name时,服务器使用的前缀来生成唯一名称 |
| namespace | String | 命名空间 |
| labels | Map<String,String> | 标签 |
| annotations | Map<String,String> | 注解 |
| creationTimestamp | String | 创建时间 |
| updateTimestamp | String | 更新时间 |
| resourceVersion | String | 资源内部版本 |
| generation | Integer | 资源期望状态的代数 |
| managedFields | Array of ManagedFieldsEntry objects | 记录哪些字段由哪些工作流管理 |
| ownerReferences | Array of OwnerReference objects | 用于定义对象间所有权关系,管理对象的依赖关系和垃圾回收机制,支持控制器对资源的管理 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| manager | String | 管理者的名称 |
| operation | String | 记录导致此条目创建的操作类型,只能是 Apply 或 Update 两种操作类型 |
| apiVersion | String | 该管理者定义字段时所依据的资源 API 版本 |
| time | String | 此管理条目被创建或最后一次更新的时间戳 |
| fieldsType | String | 固定为 "FieldsV1",标记字段结构格式 |
| fieldsV1 | Object | 用于存储实际被管理的字段信息 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| apiVersion | String | 标识引用对象的API版本 |
| kind | String | 引用对象的类型 |
| name | String | 引用对象的名称 |
| uid | String | 引用对象的uid |
| controller | Boolean | 如果为true,表示该引用指向管理该资源的控制器 |
| blockOwnerDeletion | Boolean | 当为true且拥有者有名为"foregroundDeletion"的finalizer 时,会阻止拥有者被删除,直到这个引用被移除 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| syncMode | String | 集群和karmada控制面之间的同步模式 |
| clusterGroupID | String | 容器舰队id |
| manageType | String | 集群类型,取值如下: |
| ruleNamespaces | Array of RuleNamespace objects | 集群包含的RuleNamespace列表 |
| apiEndpoint | String | apiserver地址 |
| secretRef | LocalSecretReference object | 访问集群的secret信息 |
| insecureSkipTLSVerification | Boolean | 是否跳过https校验 |
| proxyURL | String | 代理链接 |
| provider | String | 提供商 |
| type | String | 集群类型: |
| category | String | 集群类别: |
| enableDistMgt | Boolean | CCE Turbo集群是否支持管理边缘基础设施。 |
| region | String | 区域 |
| country | String | 国家 |
| city | String | 城市 |
| projectID | String | 项目id |
| projectName | String | 项目名 |
| zone | String | 地区 |
| taints | Array of Taint objects | 污点 |
| IsDownloadedCert | Boolean | 是否已经下载过证书 |
| policyId | String | 策略管理id |
| operatorNamespace | String | 集群所属domainID |
| connectProxyEndpoints | Array of ConnectEndpoint objects | 连接代理服务器的终端节点服务ID列表,仅非华为云集群返回该字段 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| rules | Array of RuleInfo objects | 权限策略列表 |
| namespaces | Array of strings | 命名空间列表 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| type | String | 取值:当前仅支持 VPCEP |
| name | String | 资源名称,当type是VPCEP时为VPCEP Service的名称 |
| id | String | 资源id,当type是VPCEP时为VPCEP Service的id |
| region | String | 资源所在的region |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| kubernetesVersion | String | kubernetes版本 |
| conditions | Array of ConditionStatus objects | conditions信息 |
| nodeSummary | NodeSummary object | 节点统计信息 |
| resourceSummary | ResourceSummary object | 资源统计信息 |
| endpoints | Array of Endpoint objects | 端点 |
| phase | String | 阶段状态信息 |
| reason | String | 表述上次状况变化的原因 |
| message | String | 上次状态转换的详细信息 |
| arrearFreeze | String | 欠费冻结 |
| policeFreeze | String | 公安冻结 |
| apiEnablements | Array of APIEnablement objects | 开启的资源列表 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| type | String | 状态类型: |
| status | String | 集群状态: |
| observedgeneration | Integer | 状态对象的版本 |
| lastTransitionTime | String | 上次状态更新的时间 |
| reason | String | 状态原因 |
| message | String | 状态信息 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| allocatable | Map<String,Object> | 可分配的资源 |
| allocating | Map<String,Object> | 分配中的资源 |
| allocated | Map<String,Object> | 已分配的资源 |
| capacity | Map<String,Object> | 资源总量 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| groupVersion | String | 资源组版本 |
| resources | Array of APIResource objects | 资源类型、名称 |
状态码:400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| - | String | - |
状态码:403
| 参数 | 参数类型 | 描述 |
|---|---|---|
| - | String | - |
状态码:500
| 参数 | 参数类型 | 描述 |
|---|---|---|
| - | String | - |
请求示例
无
响应示例
状态码:200
获取所有集群信息
{
"items" : [ {
"kind" : "Cluster",
"apiVersion" : "v1",
"metadata" : {
"name" : "test-cluster",
"uid" : "b0d1ecb5-7947-11ee-9467-0255ac1001bf",
"creationTimestamp" : "2023-11-02T06:36:14Z",
"labels" : {
"FeatureGates" : "elbv3,SupportClientCertificateRevocation,xGPU"
}
},
"spec" : {
"syncMode" : "",
"clusterGroupID" : "bffbb35b-7949-11ee-886c-0255ac100037",
"manageType" : "grouped",
"provider" : "huaweicloud",
"type" : "cce",
"category" : "self",
"region" : "cn-north-4",
"country" : "CN",
"city" : "150900",
"projectID" : "b6315dd3d0ff4be5b31a963256794989",
"projectName" : "cn-north-4",
"IsDownloadedCert" : false,
"operatorNamespace" : "2cd7ebd02e4743eba4e6342c09e49344",
"connectProxyEndpoints" : [ {
"type" : "VPCEP",
"name" : "cn-north-4.5fc05258-f125-48f5-8a0a-a724a37f5ff1",
"id" : "5fc05258-f125-48f5-8a0a-a724a37f5ff1",
"region" : "cn-north-4"
} ]
},
"status" : {
"kubernetesVersion" : "v1.25",
"conditions" : [ {
"type" : "Ready",
"status" : "True",
"lastTransitionTime" : "2023-11-27T11:05:09+08:00",
"reason" : "ClusterAvailable"
}, {
"type" : "Cluster",
"status" : "Available",
"lastTransitionTime" : "2023-11-27T11:05:09+08:00",
"reason" : "ClusterAvailable"
}, {
"type" : "Federation",
"status" : "Federalized",
"lastTransitionTime" : "2023-11-14T14:31:58.744215+08:00"
} ],
"endpoints" : [ {
"url" : "https://192.168.1.251:5443",
"type" : "Internal"
} ],
"phase" : "Available",
"arrearFreeze" : "false",
"policeFreeze" : "false"
}
} ],
"total" : 1
} 状态码
| 状态码 | 描述 |
|---|---|
| 200 | 获取所有集群信息 |
| 400 | 客户端请求错误,服务器无法执行请求 |
| 403 | 服务器拒绝执行请求 |
| 500 | 服务器内部错误 |
错误码
请参见错误码。