Skip to content

Commit 55c1afb

Browse files
committed
[zh] sync custom-resource-definition-v1.md
[zh] sync custom-resource-definition-v1.md and mutating-webhook-configuration-v1.md
1 parent 177ca2d commit 55c1afb

File tree

3 files changed

+106
-81
lines changed

3 files changed

+106
-81
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
title: "扩展资源"
33
weight: 7
4-
auto_generated: true
54
---
6-
7-
8-
5+
<!--
6+
title: "Extend Resources"
7+
weight: 7
8+
auto_generated: true
9+
-->

content/zh-cn/docs/reference/kubernetes-api/extend-resources/custom-resource-definition-v1.md

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ CustomResourceDefinition 表示应在 API 服务器上公开的资源。其名
3333

3434
<hr>
3535

36-
- **apiVersion**: apiextensions.k8s.io/v1
36+
- **apiVersion**apiextensions.k8s.io/v1
3737

38-
- **kind**: CustomResourceDefinition
38+
- **kind**CustomResourceDefinition
3939

4040
- **metadata** (<a href="{{< ref "../common-definitions/object-meta#ObjectMeta" >}}">ObjectMeta</a>)
4141
<!--
@@ -416,7 +416,7 @@ CustomResourceDefinitionSpec 描述了用户希望资源的呈现方式。
416416
417417
- **conversion.strategy** (string), required
418418
419-
strategy specifies how custom resources are converted between versions. Allowed values are: - `None`: The converter only change the apiVersion and would not touch any other field in the custom resource. - `Webhook`: API Server will call to an external webhook to do the conversion. Additional information
419+
strategy specifies how custom resources are converted between versions. Allowed values are: - `"None"`: The converter only change the apiVersion and would not touch any other field in the custom resource. - `"Webhook"`: API Server will call to an external webhook to do the conversion. Additional information
420420
is needed for this option. This requires spec.preserveUnknownFields to be false, and spec.conversion.webhook to be set.
421421
-->
422422

@@ -426,17 +426,17 @@ CustomResourceDefinitionSpec 描述了用户希望资源的呈现方式。
426426

427427
strategy 指定如何在版本之间转换自定义资源。允许的值为:
428428

429-
- `None`:转换器仅更改 apiVersion 并且不会触及自定义资源中的任何其他字段。
430-
- `Webhook`:API 服务器将调用外部 Webhook 进行转换。此选项需要其他信息。这要求
431-
spec.preserveUnknownFields 为 false,并且设置 spec.conversion.webhook。
429+
- `"None"`:转换器仅更改 apiVersion 并且不会触及自定义资源中的任何其他字段。
430+
- `"Webhook"`:API 服务器将调用外部 Webhook 进行转换。此选项需要其他信息。这要求
431+
spec.preserveUnknownFields 为 false,并且设置 spec.conversion.webhook。
432432

433433
- **conversion.webhook** (WebhookConversion)
434434

435435
<!--
436-
webhook describes how to call the conversion webhook. Required when `strategy` is set to `Webhook`.
436+
webhook describes how to call the conversion webhook. Required when `strategy` is set to `"Webhook"`.
437437
-->
438438

439-
webhook 描述了如何调用转换 Webhook。当 `strategy` 设置为 `Webhook` 时有效。
439+
webhook 描述了如何调用转换 Webhook。当 `strategy` 设置为 `"Webhook"` 时有效。
440440

441441
<a name="WebhookConversion"></a>
442442
<!--
@@ -922,7 +922,7 @@ JSONSchemaProps 是JSON 模式(JSON-Schema),遵循其规范草案第 4 版
922922
The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object and from any x-kubernetes-embedded-resource annotated objects. No other metadata properties are accessible.
923923
-->
924924

925-
`apiVersion`, `kind`, `metadata.name``metadata.generateName` 总是可以从对象的根和任何带
925+
`apiVersion``kind``metadata.name``metadata.generateName` 总是可以从对象的根和任何带
926926
x-kubernetes-embedded-resource 注解的对象访问。其他元数据属性都无法访问。
927927

928928
<!--
@@ -993,7 +993,23 @@ JSONSchemaProps 是JSON 模式(JSON-Schema),遵循其规范草案第 4 版
993993
message 表示验证失败时显示的消息。如果规则包含换行符,则需要该消息。消息不能包含换行符。
994994
如果未设置,则消息为 "failed rule: {Rule}",如:"must be a URL with the host matching spec.host"
995995

996+
- **x-kubernetes-validations.messageExpression** (string)
997+
998+
<!--
999+
MessageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a rule, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the rule; the only difference is the return type. Example: "x must be less than max ("+string(self.max)+")"
1000+
-->
1001+
messageExpression 声明一个 CEL 表达式,其计算结果是此规则失败时返回的验证失败消息。
1002+
由于 messageExpression 用作失败消息,因此它的值必须是一个字符串。
1003+
如果在规则中同时存在 message 和 messageExpression,则在验证失败时使用 messageExpression。
1004+
如果是 messageExpression 出现运行时错误,则会记录运行时错误,并生成验证失败消息,
1005+
就好像未设置 messageExpression 字段一样。如果 messageExpression 求值为空字符串、
1006+
只包含空格的字符串或包含换行符的字符串,则验证失败消息也将像未设置 messageExpression 字段一样生成,
1007+
并记录 messageExpression 生成空字符串/只包含空格的字符串/包含换行符的字符串的事实。
1008+
messageExpression 可以访问的变量与规则相同;唯一的区别是返回类型。
1009+
例如:"x must be less than max ("+string(self.max)+")"。
1010+
9961011
## CustomResourceDefinitionStatus {#CustomResourceDefinitionStatus}
1012+
9971013
<!--
9981014
CustomResourceDefinitionStatus indicates the state of the CustomResourceDefinition
9991015
-->
@@ -1030,7 +1046,7 @@ CustomResourceDefinitionStatus 表示 CustomResourceDefinition 的状态。
10301046
plural is the plural name of the resource to serve. The custom resources are served under `/apis/\<group>/\<version>/.../\<plural>`. Must match the name of the CustomResourceDefinition (in the form `\<names.plural>.\<group>`). Must be all lowercase.
10311047
-->
10321048

1033-
- **acceptedNames.plural** (string), required
1049+
- **acceptedNames.plural** (string),必需
10341050

10351051
plural 是所提供的资源的复数名称,自定义资源在 `/apis/<group>/<version>/.../<plural>` 下提供。
10361052
必须与 CustomResourceDefinition 的名称匹配(格式为 `<names.plural>.<group>`)。必须全部小写。
@@ -1162,7 +1178,7 @@ CustomResourceDefinitionList 是 CustomResourceDefinition 对象的列表。
11621178

11631179
- **items** ([]<a href="{{< ref "../extend-resources/custom-resource-definition-v1#CustomResourceDefinition" >}}">CustomResourceDefinition</a>),必需
11641180

1165-
items 列出单个 CustomResourceDefinition 对象
1181+
items 列出单个 CustomResourceDefinition 对象
11661182

11671183
- **apiVersion** (string)
11681184

@@ -1179,8 +1195,9 @@ CustomResourceDefinitionList 是 CustomResourceDefinition 对象的列表。
11791195
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
11801196
-->
11811197

1182-
kind 是一个字符串值,表示该对象所表示的 REST 资源。服务器可以从客户端提交请求的端点推断出 REST 资源。不能被更新。驼峰命名。
1183-
更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
1198+
kind 是一个字符串值,表示该对象所表示的 REST 资源。服务器可以从客户端提交请求的端点推断出 REST 资源。
1199+
不能被更新。驼峰命名。更多信息:
1200+
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
11841201

11851202
- **metadata** (<a href="{{< ref "../common-definitions/list-meta#ListMeta" >}}">ListMeta</a>)
11861203

@@ -1216,7 +1233,7 @@ GET /apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}
12161233

12171234
- **name****路径参数**):string,必需
12181235

1219-
CustomResourceDefinition 的名称
1236+
CustomResourceDefinition 的名称
12201237

12211238
- **pretty** <!--(*in query*):-->**查询参数**):string
12221239

@@ -1253,7 +1270,7 @@ GET /apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}/status
12531270

12541271
- **name****路径参数**):string,必需
12551272

1256-
CustomResourceDefinition 的名称
1273+
CustomResourceDefinition 的名称
12571274

12581275
- **pretty** <!--(*in query*):-->**查询参数**):string
12591276

@@ -1316,6 +1333,10 @@ GET /apis/apiextensions.k8s.io/v1/customresourcedefinitions
13161333

13171334
<a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch</a>
13181335

1336+
- **sendInitialEvents** <!--(*in query*):-->**查询参数**): boolean
1337+
1338+
<a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents</a>
1339+
13191340
- **timeoutSeconds** <!--(*in query*):-->**查询参数**):integer
13201341

13211342
<a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds</a>
@@ -1406,7 +1427,7 @@ PUT /apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}
14061427

14071428
- **name****路径参数**):string,必需
14081429

1409-
CustomResourceDefinition 的名称
1430+
CustomResourceDefinition 的名称
14101431

14111432
- **body**: <a href="{{< ref "../extend-resources/custom-resource-definition-v1#CustomResourceDefinition" >}}">CustomResourceDefinition</a>,必需
14121433

@@ -1461,7 +1482,7 @@ PUT /apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}/status
14611482

14621483
- **name****路径参数**):string,必需
14631484

1464-
CustomResourceDefinition 的名称
1485+
CustomResourceDefinition 的名称
14651486

14661487
- **body**: <a href="{{< ref "../extend-resources/custom-resource-definition-v1#CustomResourceDefinition" >}}">CustomResourceDefinition</a>,必需
14671488

@@ -1516,7 +1537,7 @@ PATCH /apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}
15161537

15171538
- **name****路径参数**):string,必需
15181539

1519-
CustomResourceDefinition 的名称
1540+
CustomResourceDefinition 的名称
15201541

15211542
- **body**: <a href="{{< ref "../common-definitions/patch#Patch" >}}">Patch</a>,必需
15221543

@@ -1575,7 +1596,7 @@ PATCH /apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}/status
15751596

15761597
- **name****路径参数**):string,必需
15771598

1578-
CustomResourceDefinition 的名称
1599+
CustomResourceDefinition 的名称
15791600

15801601
- **body**: <a href="{{< ref "../common-definitions/patch#Patch" >}}">Patch</a>,必需
15811602

@@ -1632,7 +1653,7 @@ DELETE /apis/apiextensions.k8s.io/v1/customresourcedefinitions/{name}
16321653

16331654
- **name****路径参数**):string,必需
16341655

1635-
CustomResourceDefinition 的名称
1656+
CustomResourceDefinition 的名称
16361657

16371658
- **body**: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions</a>
16381659

@@ -1721,6 +1742,10 @@ DELETE /apis/apiextensions.k8s.io/v1/customresourcedefinitions
17211742

17221743
<a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch</a>
17231744

1745+
- **sendInitialEvents** <!--(*in query*):-->**查询参数**): boolean
1746+
1747+
<a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents</a>
1748+
17241749
- **timeoutSeconds** <!--(*in query*):-->**查询参数**):integer
17251750

17261751
<a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds</a>
@@ -1733,4 +1758,3 @@ DELETE /apis/apiextensions.k8s.io/v1/customresourcedefinitions
17331758
200 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status</a>): OK
17341759

17351760
401: Unauthorized
1736-

0 commit comments

Comments
 (0)