华为云计算 云知识 替换StatefulSetreplaceAppsV1NamespacedStatefulSet
替换StatefulSetreplaceAppsV1NamespacedStatefulSet

 

接口说明

替换StatefulSet。

The following fields can be updated:

  • metadata.labels
  • metadata.annotations
  • spec.template
  • spec.replicas
  • spec.revisionHistoryLimit
  • spec.progressDeadlineSeconds The other fields cannot be updated.
URL
PUT  https://cci.cn-north-4.myhuaweicloud.com/apis/apps/v1/namespaces/{namespace}/statefulsets/{name} 
请求参数
名称 类型 IN 必选 描述
X-Auth-Token
 
string header

用户Token。

通过调用 IAM 服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

Content-Type
 
string header

消息体的类型(格式),默认取值为“application/json”

name
 
string path

name of the StatefulSet

namespace
 
string path

object name and auth scope, such as for teams and projects

dryRun
 
string query

When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed

fieldManager
 
string query

fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint.

pretty
 
string query

If 'true', then the output is pretty printed.

(接口较庞大,Body参数和返回参数请参考《接口说明》。)
请求示例
示例 1

将StatefulSet中的replicas值修改为2。

 
{ "apiVersion": "apps/v1", "kind": "StatefulSet", "metadata": { "name": "statefulset-test" }, "spec": { "replicas": 2, "selector": { "matchLabels": { "app": "statefulset-test" } }, "serviceName": "statefulset-test", "template": { "metadata": { "labels": { "app": "statefulset-test" } }, "spec": { "containers": [ { "image": "*.*.*.*:20202/cci/redis:V1", "name": "container-0", "resources": { "limits": { "cpu": "500m", "memory": "1024Mi" }, "requests": { "cpu": "500m", "memory": "1024Mi" } } } ], "imagePullSecrets": [ { "name": "imagepull-secret" } ] } } } }
返回示例
返回码:200

OK

示例 1
 
{
"apiVersion": "apps/v1",
"kind": "StatefulSet",
"metadata": {
"creationTimestamp": "2018-09-04T07:13:00Z",
"generation": 2,
"labels": {
"app": "statefulset-test"
},
"name": "statefulset-test",
"namespace": "namespace-test",
"resourceVersion": "5223616",
"selfLink": "/apis/apps/v1/namespaces/namespace-test/statefulsets/statefulset-test",
"uid": "f4a35f35-b011-11e8-b6ef-f898ef6c78b4"
},
"spec": {
"podManagementPolicy": "OrderedReady",
"replicas": 2,
"revisionHistoryLimit": 10,
"selector": {
"matchLabels": {
"app": "statefulset-test"
}
},
"serviceName": "",
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app": "statefulset-test"
}
},
"spec": {
"containers": [
{
"image": "redis",
"imagePullPolicy": "IfNotPresent",
"name": "container-0",
"resources": {
"limits": {
"cpu": "500m",
"memory": "1Gi"
},
"requests": {
"cpu": "500m",
"memory": "1Gi"
}
},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File"
}
],
"dnsPolicy": "ClusterFirst",
"imagePullSecrets": [
{
"name": "imagepull-secret"
}
],
"restartPolicy": "Always",
"schedulerName": "default-scheduler",
"securityContext": {}
}
},
"updateStrategy": {
"type": "OnDelete"
}
},
"status": {
"collisionCount": 0,
"currentReplicas": 3,
"currentRevision": "statefulset-test-f986b645b",
"observedGeneration": 1,
"readyReplicas": 1,
"replicas": 3,
"updateRevision": "statefulset-test-f986b645b"
}
}
错误码
请参考 错误码说明

 

上一篇:华为云12.12会员节优惠活动 下一篇:心通达OA精灵APP快速手册