Reviewed-by: Gergo-Bence Lorincz <a200452876@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com> Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
30 KiB
Updating a Cluster
Function
This API is used to update a cluster. Currently, only the country/city of attached clusters and on-premises clusters, and the number of worker nodes in a multi-cloud cluster can be updated.
URI
PUT /v1/clusters/{clusterid}
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
clusterid |
Yes |
String |
Cluster ID |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
X-Auth-Token |
Yes |
String |
Identity authentication information. 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. |
Content-Type |
Yes |
String |
Message body type (format). Only application/json is supported. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
kind |
Yes |
String |
API type. The value is fixed at Cluster and cannot be changed. |
apiVersion |
Yes |
String |
API version. The value is fixed at v1 and cannot be changed. |
metadata |
No |
ObjectMeta object |
Basic information about the cluster. Metadata is a collection of attributes. |
spec |
No |
UpdateClusterSpec object |
Details about the cluster. UCS creates or updates the cluster based on spec. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
uid |
No |
String |
Cluster ID |
name |
No |
String |
Cluster name |
labels |
No |
Map<String,String> |
Labels |
creationTimestamp |
No |
String |
Creation time. It is the UTC time in the RFC 3339 format. |
updateTimestamp |
No |
String |
Update timestamp |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
country |
No |
String |
Country where the cluster is located |
city |
No |
String |
City where the cluster is located (consistent with the country) |
workerConfig |
No |
WorkerConfig object |
Worker node configuration. This parameter is only available for multi-cloud clusters. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
replicas |
No |
Integer |
The number of nodes |
strategy |
No |
NodeUpgradeStrategy object |
Node update policy |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
type |
No |
String |
Policy type |
rollingUpdate |
No |
Rolling update |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
maxUnavailable |
No |
Object |
Maximum number of nodes that can be unavailable during an update |
maxSurge |
No |
Object |
Maximum number of nodes that can be created over the desired number of nodes |
deletePolicy |
No |
String |
Deletion policy. The options are Random, Oldest, and Newest. |
Response Parameters
Status code: 200
Cluster information updated.
Status code: 400
Parameter |
Type |
Description |
|---|---|---|
- |
String |
- |
Status code: 403
Parameter |
Type |
Description |
|---|---|---|
- |
String |
- |
Status code: 500
Parameter |
Type |
Description |
|---|---|---|
- |
String |
- |
Example Requests
Updating a cluster
{
"kind" : "Cluster",
"apiVersion" : "v1",
"metadata" : {
"annotations" : {
"kubeconfig" : "{\"kind\":\"Config\",\"apiVersion\":\"v1\",\"preferences\":{},\"clusters\":[{\"name\":\"internalCluster\",\"cluster\":{\"server\":\"https://100.94.13.93:5443\",\"insecure-skip-tls-verify\":true}}],\"users\":[{\"name\":\"user\",\"user\":{\"client-certificate-data\":\"\",\"client-key-data\":\"\"}}],\"contexts\":[{\"name\":\"internal\",\"context\":{\"cluster\":\"internalCluster\",\"user\":\"user\"}}],\"current-context\":\"internal\"}"
}
},
"spec" : {
"country" : "AL",
"city" : "AL"
}
}
Example Responses
Status code: 200
The cluster has been updated.
{ }
Status Codes
Status Code |
Description |
|---|---|
200 |
The cluster has been updated. |
400 |
Client request error. The server could not execute the request. |
403 |
The server refused the request. |
500 |
Internal server error. |
Error Codes
See Error Codes.