• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference 2.0
  4. Kubernetes API
  5. ReplicationController
  6. Updating a Specified ReplicationController

Updating a Specified ReplicationController

Function

This API is used to update a ReplicationController object under a specified Namespace.

The following fields can be updated:

  • metadata.selfLink
  • metadata.resourceVersion
  • metadata.generation
  • metadata.creationTimestamp
  • metadata.deletionTimestamp
  • metadata.labels
  • metadata.clusterName
  • metadata.generateName
  • metadata.annotations
  • spec.replicas
  • template.contaions
  • spec.restartPolicy
  • spec.activeDeadlineSeconds

URI

PATCH /api/v1/namespaces/{namespace}/replicationcontrollers/{name}

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

pretty

No

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

namespace

Yes

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

name

Yes

Name of the ReplicationController.

Request

Request parameters:

For the description about the Content-Type message header, see section Patch Request Method Operation Description.

For the description about request parameters, see Table 1.

Example request:

Content-Type: application/strategic-merge-patch+json
 { 
   "spec": { 
         "template": { 
             "spec": { 
                 "containers": [ 
                     { 
                         "name": "hello-world", 
                         "image": "busybox:latest" 
                     }, 
                     { 
                         "name": "hello", 
                         "image": "busybox:latest" 
                     } 
                 ] 
             } 
         } 
     } 
 }

Response

Response parameters:

For the description about response parameters, see Table 1.

Example response:

{ 
   "kind": "ReplicationController", 
   "apiVersion": "v1", 
   "metadata": { 
     "name": "frontend-controller", 
     "namespace": "default", 
     "selfLink": "/api/v1/namespaces/default/replicationcontrollers/frontend-controller", 
     "uid": "cd4594b6-5d0b-11e6-aeb9-286ed488fafe", 
     "resourceVersion": "1658", 
     "generation": 2, 
     "creationTimestamp": "2016-08-08T01:59:55Z", 
     "labels": { 
       "app": "nginx" 
     } 
   }, 
   "spec": { 
     "replicas": 2, 
     "selector": { 
       "app": "nginx" 
     }, 
     "template": { 
       "metadata": { 
         "creationTimestamp": null, 
         "labels": { 
           "app": "nginx" 
         } 
       }, 
       "spec": { 
         "containers": [ 
         { 
             "name": "hello-world", 
             "image": "busybox:latest", 
             "resources": {}, 
             "terminationMessagePath": "/dev/termination-log", 
             "imagePullPolicy": "Always" 
           }, 
           { 
             "name": "hello", 
             "image": "busybox:latest", 
             "resources": {}, 
             "terminationMessagePath": "/dev/termination-log", 
             "imagePullPolicy": "Always" 
           } 
         ], 
         "restartPolicy": "Always", 
         "terminationGracePeriodSeconds": 30, 
         "dnsPolicy": "ClusterFirst", 
         "securityContext": {} 
       } 
     } 
   }, 
   "status": { 
     "replicas": 2, 
     "fullyLabeledReplicas": 2, 
     "observedGeneration": 1 
   } 
 }

Status Code

Table 2 describes the status code of this API.

Table 2 Status code

Status Code

Description

200

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

For the description about status codes, see section Status Codes.