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

替换指定的Secret

功能介绍

该API用于替换指定Namespace下的Secret对象。

其中以下字段支持更新:

  • metadata.name
  • metadata.namespace
  • metadata.selfLink
  • metadata.resourceVersion
  • metadata.uid
  • metadata.labels
  • metadata.clusterName
  • metadata.generateName
  • metadata.annotations
  • metadata.deletionGracePeriodSeconds
  • spec.type
  • “type”的值为“Opaque”时,“data”“key”“value”都可以更新。
  • “type”的值不为“Opaque”时,“data”“value”可以更新。

URI

PUT /api/v1/namespaces/{namespace}/secrets/{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 Secret.

请求消息

请求参数:

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

请求示例:

{ 
   "apiVersion": "v1", 
   "kind": "Secret", 
   "metadata": { 
     "name": "mysecret" 
   }, 
   "type": "Opaque", 
   "data": { 
     "password": "******",
     "username": "*****"
   } 
 }

响应消息

响应参数:

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

响应示例:

{
    "kind": "Secret",
    "apiVersion": "v1",
    "metadata": {
        "name": "mysecret",
        "namespace": "ns-12130306-s",
        "selfLink": "/api/v1/namespaces/ns-12130306-s/secrets/mysecret",
        "uid": "0bbfb314-dfb3-11e7-9c19-fa163e2d897b",
        "resourceVersion": "418375",
        "creationTimestamp": "2017-12-13T03:09:34Z",
        "enable": true
    },
    "data": {
        "password": "******",
        "username": "*****" 
    },
    "type": "Opaque",
    "httpcode": 200,
    "header": {
        "X-Frame-Options": "SAMEORIGIN",
        "Strict-Transport-Security": "max-age=31536000; includeSubdomains;",
        "Server": "Web Server",
        "X-Router-Status": "fresh,upstream return 200",
        "X-Content-Type-Options": "nosniff",
        "Connection": "keep-alive",
        "X-Download-Options": "noopen",
        "Set-Cookie": "******; Expires=Thu, 14-Dec-17 03:09:34 GMT; Domain=192.168.50.250; Path=/; Secure; HttpOnly",
        "Content-Length": "364",
        "X-XSS-Protection": "1; mode=block;",
        "Date": "Wed, 13 Dec 2017 03:09:34 GMT",
        "Content-Type": "application/json"
    }
}

状态码

表2描述API的状态码。

表2 状态码

状态码

描述

200

操作成功,返回更新后的secret资源对象

异常状态码请参见状态码

分享:

    相关文档

    相关产品

close