更新时间:2022-04-18 GMT+08:00
分享

更新指定的ReplicationController

功能介绍

该API用于更新指定Namespace下的ReplicationController对象。

其中以下字段支持更新:

  • metadata.name
  • metadata.namespace
  • metadata.selfLink
  • metadata.resourceVersion
  • metadata.uid
  • metadata.labels
  • metadata.clusterName
  • metadata.generateName
  • metadata.annotations
  • spec.replicas
  • template.containers
  • spec.restartPolicy
  • spec.activeDeadlineSeconds
  • metadata.deletionGracePeriodSeconds

URI

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

表1 描述该API的参数。

表1 参数描述

参数

是否必选

描述

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.

请求消息

响应参数:

“Content-Type”的详细描述请参见 PATCH请求方法操作说明

请求参数的详细描述请参见表1

请求示例:

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

响应消息

响应参数:

响应参数的详细描述请参见表1

响应示例:

{ 
   "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 
   } 
 }

状态码

表2描述API的状态码。

表2 状态码

状态码

描述

200

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

异常状态码请参见状态码

分享:

    相关文档

    相关产品

close