更新StatefulSet。
The following fields can be updated:
- metadata.labels
- metadata.annotations
- spec.replicas
- spec.template
- spec.restartPolicy
- spec.revisionHistoryLimit
- spec.progressDeadlineSeconds The other fields cannot be updated.
名称 | 类型 | IN | 必选 | 描述 |
---|---|---|---|---|
X-Auth-Token
|
string | header | 是 |
用户Token。 通过调用 IAM 服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
Content-Type
|
string | header | 是 |
目前支持三种类型的PATCH请求方法的操作,参考《使用JSON合并patch更新Deployment》。
|
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. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch). |
force
|
boolean | query | 否 |
Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. |
pretty
|
string | query | 否 |
If 'true', then the output is pretty printed. |
更新StatefulSet中的labels值为"app": "statefulset-test2"。
OK
"apiVersion": "apps/v1",
"kind": "StatefulSet",
"metadata": {
"creationTimestamp": "2018-09-04T07:13:00Z",
"generation": 2,
"labels": {
"app": "statefulset-test2"
},
"name": "statefulset-test",
"namespace": "namespace-test",
"resourceVersion": "5231369",
"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,
"currentRevision": "statefulset-test-f986b645b",
"observedGeneration": 2,
"replicas": 2,
"updateRevision": "statefulset-test-7748d5459",
"updatedReplicas": 2
}
}