您正在查看 Kubernetes 版本的文档: v1.24

Kubernetes v1.24 版本的文档已不再维护。您现在看到的版本来自于一份静态的快照。如需查阅最新文档,请点击 最新版本。

ControllerRevision

ControllerRevision 实现了状态数据的不可变快照。

apiVersion: apps/v1

import "k8s.io/api/apps/v1"

ControllerRevision

ControllerRevision 实现了状态数据的不可变快照。 客户端负责序列化和反序列化对象,包含对象内部状态。 成功创建 ControllerRevision 后,将无法对其进行更新。 API 服务器将无法成功验证所有尝试改变 data 字段的请求。 但是,可以删除 ControllerRevisions。 请注意,由于 DaemonSet 和 StatefulSet 控制器都使用它来进行更新和回滚,所以这个对象是 beta 版。 但是,它可能会在未来版本中更改名称和表示形式,客户不应依赖其稳定性。 它主要供控制器内部使用。


  • apiVersion: apps/v1
  • kind: ControllerRevision
  • revision (int64),必需

    revision 表示 data 表示的状态的修订。

  • data (RawExtension)

    data 是状态的序列化表示。

    RawExtension 用于以外部版本来保存扩展数据。

    要使用它,请生成一个字段,在外部、版本化结构中以 RawExtension 作为其类型,在内部结构中以 Object 作为其类型。

    内部包:

    type MyAPIObject struct {  
    	runtime.TypeMeta `json:",inline"`   
    	MyPlugin runtime.Object `json:"myPlugin"`  
    }       
    type PluginA struct {  
    	AOption string `json:"aOption"`  
    }
    

    外部包:

    type MyAPIObject struct {  
    	runtime.TypeMeta `json:",inline"`  
    	MyPlugin runtime.RawExtension `json:"myPlugin"`    
    }   
    type PluginA struct {  
    	AOption string `json:"aOption"`  
    }
    

    在网络上,JSON 看起来像这样:

    {  
    	"kind":"MyAPIObject",  
    	"apiVersion":"v1",  
    	"myPlugin": {  
    		"kind":"PluginA",  
    		"aOption":"foo",  
    	},  
    }
    

    那么会发生什么? 解码首先使用 json 或 yaml 将序列化数据解组到你的外部 MyAPIObject 中。 这会导致原始 JSON 被存储下来,但不会被解包。 下一步是复制(使用 pkg/conversion)到内部结构中。 runtime 包的 DefaultScheme 安装了转换函数,它将解析存储在 RawExtension 中的 JSON, 将其转换为正确的对象类型,并将其存储在 Object 中。 (TODO:如果对象是未知类型,将创建并存储一个 runtime.Unknown对象。)

ControllerRevisionList

ControllerRevisionList 是一个包含 ControllerRevision 对象列表的资源。


  • apiVersion: apps/v1
  • kind: ControllerRevisionList

操作


get 读取特定的 ControllerRevision

HTTP 请求

GET /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}

参数

  • name路径参数):string,必需

    ControllerRevision 的名称

  • namespace路径参数):string,必需

    namespace

  • pretty查询参数):string

    pretty

响应

200 (ControllerRevision): OK

401: Unauthorized

list 列出或监视 ControllerRevision 类别的对象

HTTP 请求

GET /apis/apps/v1/namespaces/{namespace}/controllerrevisions

参数

  • namespace路径参数):string,必需

    namespace

  • continue查询参数):string

    continue

  • limit (查询参数)): integer

    limit

  • pretty查询参数):string

    pretty

  • watch查询参数): boolean

    watch

响应

200 (ControllerRevisionList): OK

401: Unauthorized

list 列出或监视 ControllerRevision 类别的对象

HTTP 请求

GET /apis/apps/v1/controllerrevisions

参数

  • continue查询参数):string

    continue

  • limit查询参数): integer

    limit

  • pretty查询参数):string

    pretty

  • watch查询参数): boolean

    watch

响应

200 (ControllerRevisionList): OK

401: Unauthorized

create 创建一个 ControllerRevision

HTTP 请求

POST /apis/apps/v1/namespaces/{namespace}/controllerrevisions

参数

  • namespace路径参数):string,必需

    namespace

  • dryRun查询参数):string

    dryRun

  • pretty查询参数):string

    pretty

响应

200 (ControllerRevision): OK

201 (ControllerRevision): Created

202 (ControllerRevision): Accepted

401: Unauthorized

update 替换特定的 ControllerRevision

HTTP 参数

PUT /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}

参数

  • name路径参数):string,必需

    ControllerRevision 的名称

  • namespace路径参数):string,必需

    namespace

  • dryRun查询参数):string

    dryRun

  • pretty查询参数):string

    pretty

响应

200 (ControllerRevision): OK

201 (ControllerRevision): Created

401: Unauthorized

patch 部分更新特定的 ControllerRevision

HTTP 请求

PATCH /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}

参数

  • name路径参数):string,必需

    ControllerRevision 的名称

  • namespace路径参数):string,必需

    namespace

  • dryRun查询参数):string

    dryRun

  • force查询参数): boolean

    force

  • pretty查询参数):string

    pretty

响应

200 (ControllerRevision): OK

201 (ControllerRevision): Created

401: Unauthorized

delete 删除一个 ControllerRevision

HTTP 请求

DELETE /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}

参数

  • name路径参数):string,必需

    ControllerRevision 的名称

  • namespace路径参数):string,必需

    namespace

  • dryRun查询参数):string

    dryRun

  • pretty查询参数):string

    pretty

响应

200 (Status): OK

202 (Status): Accepted

401: Unauthorized

deletecollection 删除 ControllerRevision 集合

HTTP 请求

DELETE /apis/apps/v1/namespaces/{namespace}/controllerrevisions

参数

  • namespace路径参数):string,必需

    namespace

  • continue查询参数):string

    continue

  • dryRun查询参数):string

    dryRun

  • limit查询参数): integer

    limit

  • pretty查询参数):string

    pretty

响应

200 (Status): OK

401: Unauthorized

最后修改 July 16, 2022 at 12:50 PM PST: updated /workload-resources/controller-revision-v1.md (c599dc6637)