Skip to content

Commit 3865227

Browse files
committed
[zh] Sync1.25 /kubernetes-api/workload-resources/controller-revision-v1.md
1 parent a65b1a3 commit 3865227

File tree

1 file changed

+47
-60
lines changed

1 file changed

+47
-60
lines changed

content/zh-cn/docs/reference/kubernetes-api/workload-resources/controller-revision-v1.md

Lines changed: 47 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ControllerRevision 实现了状态数据的不可变快照。
4646
成功创建 ControllerRevision 后,将无法对其进行更新。
4747
API 服务器将无法成功验证所有尝试改变 data 字段的请求。
4848
但是,可以删除 ControllerRevisions。
49-
请注意,由于 DaemonSet 和 StatefulSet 控制器都使用它来进行更新和回滚,所以这个对象是 beta 版。
49+
请注意,由于 DaemonSet 和 StatefulSet 控制器都使用它来进行更新和回滚,所以这个对象是 Beta 版。
5050
但是,它可能会在未来版本中更改名称和表示形式,客户不应依赖其稳定性。
5151
它主要供控制器内部使用。
5252

@@ -94,79 +94,72 @@ API 服务器将无法成功验证所有尝试改变 data 字段的请求。
9494
<a name="RawExtension"></a>
9595
*RawExtension is used to hold extensions in external versions.
9696
-->
97+
9798
<a name="RawExtension"></a>
9899
**RawExtension 用于以外部版本来保存扩展数据。**
99100

100101
<!--
101102
To use this, make a field which has RawExtension as its type in your external, versioned struct, and Object in your internal struct. You also need to register your various plugin types.
102103
-->
104+
103105
要使用它,请生成一个字段,在外部、版本化结构中以 RawExtension 作为其类型,在内部结构中以 Object 作为其类型。
106+
你还需要注册你的各个插件类型。
104107

105108
<!--
106-
// Internal package: type MyAPIObject struct {
107-
runtime.TypeMeta `json:",inline"`
108-
MyPlugin runtime.Object `json:"myPlugin"`
109-
} type PluginA struct {
110-
AOption string `json:"aOption"`
111-
}
109+
// Internal package:
112110
-->
113-
内部包:
114-
115-
```go
116-
type MyAPIObject struct {
117-
runtime.TypeMeta `json:",inline"`
118-
MyPlugin runtime.Object `json:"myPlugin"`
119-
}
120-
type PluginA struct {
121-
AOption string `json:"aOption"`
122-
}
123-
```
124111

125-
<!--
126-
// External package: type MyAPIObject struct {
127-
runtime.TypeMeta `json:",inline"`
128-
MyPlugin runtime.RawExtension `json:"myPlugin"`
129-
} type PluginA struct {
130-
AOption string `json:"aOption"`
112+
// 内部包:
113+
114+
```go
115+
type MyAPIObject struct {
116+
runtime.TypeMeta `json:",inline"`
117+
MyPlugin runtime.Object `json:"myPlugin"`
118+
}
119+
120+
type PluginA struct {
121+
AOption string `json:"aOption"`
131122
}
132-
-->
133-
外部包:
134-
135-
```go
136-
type MyAPIObject struct {
137-
runtime.TypeMeta `json:",inline"`
138-
MyPlugin runtime.RawExtension `json:"myPlugin"`
139-
}
140-
type PluginA struct {
141-
AOption string `json:"aOption"`
142-
}
143-
```
123+
```
144124

145125
<!--
146-
// On the wire, the JSON will look something like this: {
147-
"kind":"MyAPIObject",
148-
"apiVersion":"v1",
149-
"myPlugin": {
150-
"kind":"PluginA",
151-
"aOption":"foo",
152-
},
126+
// External package:
127+
-->
128+
129+
// 外部包:
130+
131+
```go
132+
type MyAPIObject struct {
133+
runtime.TypeMeta `json:",inline"`
134+
MyPlugin runtime.RawExtension `json:"myPlugin"`
135+
}
136+
137+
type PluginA struct {
138+
AOption string `json:"aOption"`
153139
}
140+
```
141+
142+
<!--
143+
// On the wire, the JSON will look something like this:
154144
-->
155-
在网络上,JSON 看起来像这样:
156-
```json
157-
{
158-
"kind":"MyAPIObject",
159-
"apiVersion":"v1",
160-
"myPlugin": {
161-
"kind":"PluginA",
162-
"aOption":"foo",
163-
},
164-
}
165-
```
145+
146+
// 在网络上,JSON 看起来像这样:
147+
148+
```json
149+
{
150+
"kind":"MyAPIObject",
151+
"apiVersion":"v1",
152+
"myPlugin": {
153+
"kind":"PluginA",
154+
"aOption":"foo",
155+
},
156+
}
157+
```
166158

167159
<!--
168160
So what happens? Decode first uses json or yaml to unmarshal the serialized data into your external MyAPIObject. That causes the raw JSON to be stored, but not unpacked. The next step is to copy (using pkg/conversion) into the internal struct. The runtime package's DefaultScheme has conversion functions installed which will unpack the JSON stored in RawExtension, turning it into the correct object type, and storing it in the Object. (TODO: In the case where the object is of an unknown type, a runtime.Unknown object will be created and stored.)*
169161
-->
162+
170163
那么会发生什么?
171164
解码首先使用 json 或 yaml 将序列化数据解组到你的外部 MyAPIObject 中。
172165
这会导致原始 JSON 被存储下来,但不会被解包。
@@ -275,14 +268,12 @@ GET /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}
275268
<!--
276269
#### Response
277270
278-
279271
200 (<a href="{{< ref "../workload-resources/controller-revision-v1#ControllerRevision" >}}">ControllerRevision</a>): OK
280272
281273
401: Unauthorized
282274
-->
283275
#### 响应
284276
285-
286277
200 (<a href="{{< ref "../workload-resources/controller-revision-v1#ControllerRevision" >}}">ControllerRevision</a>): OK
287278
288279
401: Unauthorized
@@ -530,7 +521,6 @@ GET /apis/apps/v1/controllerrevisions
530521
<!--
531522
#### Response
532523
533-
534524
200 (<a href="{{< ref "../workload-resources/controller-revision-v1#ControllerRevisionList" >}}">ControllerRevisionList</a>): OK
535525
536526
401: Unauthorized
@@ -814,7 +804,6 @@ PATCH /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}
814804
815805
<a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty</a>
816806
817-
818807
<!--
819808
#### Response
820809
@@ -910,7 +899,6 @@ DELETE /apis/apps/v1/namespaces/{namespace}/controllerrevisions/{name}
910899
911900
<a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy</a>
912901
913-
914902
<!--
915903
#### Response
916904
@@ -1060,7 +1048,6 @@ DELETE /apis/apps/v1/namespaces/{namespace}/controllerrevisions
10601048
10611049
<a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds</a>
10621050
1063-
10641051
<!--
10651052
#### Response
10661053

0 commit comments

Comments
 (0)