• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference 2.0
  4. Kubernetes API
  5. StatefulSet
  6. Replacing the Status of a Specified StatefulSet

Replacing the Status of a Specified StatefulSet

Function

This API is used to replace the status of a specified StatefulSet object under a specified Namespace, that is, to modify the parameter values of the status field of the StatefulSet object.

URI

PUT /apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status

PUT /apis/apps/v1beta1/namespaces/{namespace}/statefulsets/{name}/status

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

name

Yes

Name of the StatefulSet.

namespace

Yes

Object name and auth scope, such as for teams and projects.

pretty

No

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

Request

Request parameters:

For the description about request parameters, see Table 2.

Example request:

{
    "apiVersion": "apps/v1beta1",
    "kind": "StatefulSet",
    "metadata": {
        "generateName": "sz",
        "name": "numberlimit",
        "namespace": "default"
    },
    "spec": {
        "replicas": 1,
        "serviceName": "service-number",
        "template": {
            "metadata": {
                "labels": {
                    "app": "mysql"
                }
            },
            "spec": {
                "containers": [
                    {
                        "image": "10.154.52.159:443/test/mongo:latest",
                        "imagePullPolicy": "IfNotPresent",
                        "name": "container01",
                        "ports": [
                            {
                                "containerPort": 80,
                                "protocol": "TCP"
                            }
                        ],
                        "resources": {
                            "limits": {
                                "cpu": "99M"
                            },
                            "requests": {
                                "cpu": "0.3G"
                            }
                        },
                        "terminationMessagePath": "/dev/termination-log"
                    }
                ]
            }
        }
    },
    "status": {
        "replicas": 3
    }
}

Response

Response parameters:

For the description about response parameters, see Table 2.

Example response:

{
    "kind": "StatefulSet",
    "apiVersion": "apps/v1beta1",
    "metadata": {
        "name": "numberlimit",
        "generateName": "sz",
        "namespace": "default",
        "selfLink": "/apis/apps/v1beta1/namespaces/default/statefulsets/numberlimit/status",
        "uid": "841f6be1-2a25-11e7-a2a3-fa163e3a4289",
        "resourceVersion": "1399495",
        "generation": 3,
        "creationTimestamp": "2017-04-26T02:10:27Z",
        "labels": {
            "app": "mysql"
        }
    },
    "spec": {
        "replicas": 1,
        "selector": {
            "matchLabels": {
                "app": "mysql"
            }
        },
        "template": {
            "metadata": {
                "creationTimestamp": null,
                "labels": {
                    "app": "mysql"
                }
            },
            "spec": {
                "containers": [
                    {
                        "name": "container01",
                        "image": "10.154.52.159:443/test/mongo:latest",
                        "ports": [
                            {
                                "containerPort": 80,
                                "protocol": "TCP"
                            }
                        ],
                        "resources": {
                            "limits": {
                                "cpu": "99M"
                            },
                            "requests": {
                                "cpu": "300M"
                            }
                        },
                        "terminationMessagePath": "/dev/termination-log",
                        "imagePullPolicy": "IfNotPresent"
                    }
                ],
                "restartPolicy": "Always",
                "terminationGracePeriodSeconds": 30,
                "dnsPolicy": "ClusterFirst",
                "securityContext": {}
            }
        },
        "serviceName": "service-number"
    },
    "status": {
        "replicas": 3
    }
}

Status Code

Table 2 describes the status code of this API.

Table 2 Status code

Status Code

Description

200

This operation succeeds, and a StatefulSet resource object is returned.

For the description about status codes, see Status Codes.