• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference
  4. Service (Native Kubernetes APIs)
  5. Replacing the Status of a Specified Service

Replacing the Status of a Specified Service

Function

This API is used to replace the status of a specified Service object under a specified Namespace.

The following fields can be updated:

  • status.loadBalancer

URI

PUT /api/v1/namespaces/{namespace}/services/{name}/status

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

name

Yes

Name of the Service.

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 Response

Example request:

{
    "kind": "Service",
    "apiVersion": "v1",
    "metadata": {
        "name": "service-test88va8",
        "generateName": "service-test",
        "namespace": "default",
        "selfLink": "/api/v1/namespaces/default/services/service-test88va8",
        "uid": "1b2c6fd6-242e-11e7-8fb9-fa163efc8506",
        "resourceVersion": "58010",
        "creationTimestamp": "2017-04-18T11:56:50Z",
        "labels": {
            "service": "test"
        }
    },
    "spec": {
        "ports": [
            {
                "name": "new-port-30"
                "protocol": "TCP",
                "port": 80,
                "targetPort": 80,
                "nodePort": 32429
            }
        ],
        "selector": {
            "key1": "v1"
        },
        "clusterIP": "10.247.214.167",
        "type": "LoadBalancer",
        "sessionAffinity": "None"
    },
    "status": {
        "loadBalancer": {
            "ingress": [
                {
                    "ip": "10.10.10.10",
                    "hostname": "test"
                }
            ]
        }
    }
}

Response

Response parameters:

For the description about response parameters, see Response

Example response:

{
    "kind": "Service",
    "apiVersion": "v1",
    "metadata": {
        "name": "service-test88va8",
        "generateName": "service-test",
        "namespace": "default",
        "selfLink": "/api/v1/namespaces/default/services/service-test88va8/status",
        "uid": "1b2c6fd6-242e-11e7-8fb9-fa163efc8506",
        "resourceVersion": "58012",
        "creationTimestamp": "2017-04-18T11:56:50Z",
        "labels": {
            "service": "test"
        }
    },
    "spec": {
        "ports": [
            {
                "name": "new-port-30"
                "protocol": "TCP",
                "port": 80,
                "targetPort": 80,
                "nodePort": 32429
            }
        ],
        "selector": {
            "key1": "v1"
        },
        "clusterIP": "10.247.214.167",
        "type": "LoadBalancer",
        "sessionAffinity": "None"
    },
    "status": {
        "loadBalancer": {
            "ingress": [
                {
                    "ip": "10.10.10.10",
                    "hostname": "test"
                }
            ]
        }
    }
}

Status Code

Table 2 describes the status code of this API.

Table 2 Status code

Status Code

Description

200

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

For the description about status codes, see Status Codes.