Skip to content

Commit 0fe0d2d

Browse files
committed
[zh-cn] sync custom-resource-definition-v1.md
Signed-off-by: xin.li <[email protected]>
1 parent 555a445 commit 0fe0d2d

File tree

1 file changed

+149
-2
lines changed

1 file changed

+149
-2
lines changed

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

Lines changed: 149 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ CustomResourceDefinitionSpec 描述了用户希望资源的呈现方式。
112112

113113
- **names.categories** ([]string)
114114

115+
<!--
116+
*Atomic: will be replaced during a merge*
117+
-->
118+
119+
**原子:将在合并期间被替换**
120+
115121
<!--
116122
categories is a list of grouped resources this custom resource belongs to (e.g. 'all'). This is published in API discovery documents, and used by clients to support invocations like `kubectl get all`.
117123
-->
@@ -129,6 +135,12 @@ CustomResourceDefinitionSpec 描述了用户希望资源的呈现方式。
129135

130136
- **names.shortNames** ([]string)
131137

138+
<!--
139+
*Atomic: will be replaced during a merge*
140+
-->
141+
142+
**原子:将在合并期间被替换**
143+
132144
<!--
133145
shortNames are short names for the resource, exposed in API discovery documents, and used by clients to support invocations like `kubectl get \<shortname>`. It must be all lowercase.
134146
-->
@@ -156,11 +168,15 @@ CustomResourceDefinitionSpec 描述了用户希望资源的呈现方式。
156168
<!--
157169
- **versions** ([]CustomResourceDefinitionVersion), required
158170
171+
*Atomic: will be replaced during a merge*
172+
159173
versions is the list of all API versions of the defined custom resource. Version names are used to compute the order in which served versions are listed in API discovery. If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing major version, then minor version. An example sorted list of versions: v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10.
160174
-->
161175

162176
- **versions** ([]CustomResourceDefinitionVersion),必需
163177

178+
**原子:将在合并期间被替换**
179+
164180
versions 是自定义资源的所有 API 版本的列表。版本名称用于计算服务版本在 API 发现中列出的顺序。
165181
如果版本字符串与 Kubernetes 的版本号形式类似,则它将被排序在非 Kubernetes 形式版本字符串之前。
166182
Kubernetes 的版本号字符串按字典顺序排列。Kubernetes 版本号以 “v” 字符开头,
@@ -205,6 +221,12 @@ CustomResourceDefinitionSpec 描述了用户希望资源的呈现方式。
205221

206222
- **versions.additionalPrinterColumns** ([]CustomResourceColumnDefinition)
207223

224+
<!--
225+
*Atomic: will be replaced during a merge*
226+
-->
227+
228+
**原子:将在合并期间被替换**
229+
208230
<!--
209231
additionalPrinterColumns specifies additional columns returned in Table output. See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for details. If no columns are specified, a single column displaying the age of the custom resource is used.
210232
-->
@@ -316,6 +338,40 @@ CustomResourceDefinitionSpec 描述了用户希望资源的呈现方式。
316338

317339
openAPIV3Schema 是用于验证和精简的 OpenAPI v3 模式。
318340

341+
- **versions.selectableFields** ([]SelectableField)
342+
343+
<!--
344+
*Atomic: will be replaced during a merge*
345+
-->
346+
347+
**原子:将在合并期间被替换**
348+
349+
<!--
350+
selectableFields specifies paths to fields that may be used as field selectors. A maximum of 8 selectable fields are allowed. See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors
351+
-->
352+
353+
selectableFields 指定可用作字段选择器的字段路径,最多允许 8 个可选字段。
354+
请参阅:https://kubernetes.io/zh-cn/docs/concepts/overview/working-with-objects/field-selectors
355+
356+
<a name="SelectableField"></a>
357+
358+
<!--
359+
*SelectableField specifies the JSON path of a field that may be used with field selectors.*
360+
-->
361+
362+
**SelectableField 指定可与字段选择器一起使用的字段的 JSON 路径。**
363+
364+
- **versions.selectableFields.jsonPath** (string), required
365+
366+
<!--
367+
jsonPath is a simple JSON path which is evaluated against each custom resource to produce a field selector value. Only JSON paths without the array notation are allowed. Must point to a field of type string, boolean or integer. Types with enum values and strings with formats are allowed. If jsonPath refers to absent field in a resource, the jsonPath evaluates to an empty string. Must not point to metdata fields. Required.
368+
-->
369+
370+
jsonPath 是一个简单的 JSON 路径,它会根据每个自定义资源进行求值以生成字段选择器值。
371+
只允许使用不带数组符号的 JSON 路径。必须指向字符串、布尔值或整数类型的字段。
372+
允许使用枚举值类型和带格式的字符串。如果 jsonPath 引用资源中不存在的字段,则 jsonPath
373+
的求值结果为空字符串。不得指向元数据字段。必需。
374+
319375
- **versions.subresources** (CustomResourceSubresources)
320376

321377
<!--
@@ -443,13 +499,17 @@ CustomResourceDefinitionSpec 描述了用户希望资源的呈现方式。
443499
<!--
444500
*WebhookConversion describes how to call a conversion webhook*
445501
502+
*Atomic: will be replaced during a merge*
503+
446504
- **conversion.webhook.conversionReviewVersions** ([]string), required
447505
448506
conversionReviewVersions is an ordered list of preferred `ConversionReview` versions the Webhook expects. The API server will use the first version in the list which it supports. If none of the versions specified in this list are supported by API server, conversion will fail for the custom resource. If a persisted Webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail.
449507
-->
450508

451509
**WebhookConversion 描述了如何调用转换 Webhook**
452510

511+
**原子:将在合并期间被替换**
512+
453513
- **conversion.webhook.conversionReviewVersions** ([]string),必需
454514

455515
conversionReviewVersions 是 Webhook 期望的 `ConversionReview` 版本的有序列表。
@@ -616,8 +676,20 @@ JSONSchemaProps 是JSON 模式(JSON-Schema),遵循其规范草案第 4 版
616676

617677
- **allOf** ([]<a href="{{< ref "../extend-resources/custom-resource-definition-v1#JSONSchemaProps" >}}">JSONSchemaProps</a>)
618678

679+
<!--
680+
*Atomic: will be replaced during a merge*
681+
-->
682+
683+
**原子:将在合并期间被替换**
684+
619685
- **anyOf** ([]<a href="{{< ref "../extend-resources/custom-resource-definition-v1#JSONSchemaProps" >}}">JSONSchemaProps</a>)
620686

687+
<!--
688+
*Atomic: will be replaced during a merge*
689+
-->
690+
691+
**原子:将在合并期间被替换**
692+
621693
- **default** (JSON)
622694

623695
<!--
@@ -646,6 +718,12 @@ JSONSchemaProps 是JSON 模式(JSON-Schema),遵循其规范草案第 4 版
646718

647719
- **enum** ([]JSON)
648720

721+
<!--
722+
*Atomic: will be replaced during a merge*
723+
-->
724+
725+
**原子:将在合并期间被替换**
726+
649727
<a name="JSON"></a>
650728
<!--
651729
*JSON represents any valid JSON value. These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil.*
@@ -746,6 +824,12 @@ JSONSchemaProps 是JSON 模式(JSON-Schema),遵循其规范草案第 4 版
746824

747825
- **oneOf** ([]<a href="{{< ref "../extend-resources/custom-resource-definition-v1#JSONSchemaProps" >}}">JSONSchemaProps</a>)
748826

827+
<!--
828+
*Atomic: will be replaced during a merge*
829+
-->
830+
831+
**原子:将在合并期间被替换**
832+
749833
- **pattern** (string)
750834

751835
- **patternProperties** (map[string]<a href="{{< ref "../extend-resources/custom-resource-definition-v1#JSONSchemaProps" >}}">JSONSchemaProps</a>)
@@ -754,6 +838,12 @@ JSONSchemaProps 是JSON 模式(JSON-Schema),遵循其规范草案第 4 版
754838

755839
- **required** ([]string)
756840

841+
<!--
842+
*Atomic: will be replaced during a merge*
843+
-->
844+
845+
**原子:将在合并期间被替换**
846+
757847
- **title** (string)
758848

759849
- **type** (string)
@@ -793,6 +883,12 @@ JSONSchemaProps 是JSON 模式(JSON-Schema),遵循其规范草案第 4 版
793883

794884
- **x-kubernetes-list-map-keys** ([]string)
795885

886+
<!--
887+
*Atomic: will be replaced during a merge*
888+
-->
889+
890+
**原子:将在合并期间被替换**
891+
796892
<!--
797893
x-kubernetes-list-map-keys annotates an array with the x-kubernetes-list-type `map` by specifying the keys used as the index of the map.
798894
@@ -877,15 +973,14 @@ JSONSchemaProps 是JSON 模式(JSON-Schema),遵循其规范草案第 4 版
877973
878974
*Map: unique values on key rule will be kept during a merge*
879975
880-
x-kubernetes-validations describes a list of validation rules written in the CEL expression language. This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled.
976+
x-kubernetes-validations describes a list of validation rules written in the CEL expression language.
881977
-->
882978

883979
**补丁策略:基于键 `rule` 合并**
884980

885981
**Map:合并时将保留 rule 键的唯一值**
886982

887983
x-kubernetes-validations 描述了用 CEL 表达式语言编写的验证规则列表。此字段是 Alpha 级别。
888-
使用此字段需要启用 `CustomResourceValidationExpressions` 特性门控。
889984

890985
<a name="ValidationRule"></a>
891986
<!--
@@ -991,6 +1086,25 @@ JSONSchemaProps 是JSON 模式(JSON-Schema),遵循其规范草案第 4 版
9911086
- 'map':`X + Y` 执行合并,保留 `X` 中所有键的数组位置,但当 `X``Y` 的键集相交时,会被 `Y` 中的值覆盖。
9921087
添加 `Y` 中具有不相交键的元素,保持其局顺序。
9931088

1089+
<!--
1090+
If `rule` makes use of the `oldSelf` variable it is implicitly a `transition rule`.
1091+
1092+
By default, the `oldSelf` variable is the same type as `self`. When `optionalOldSelf` is true, the `oldSelf` variable is a CEL optional
1093+
variable whose value() is the same type as `self`.
1094+
See the documentation for the `optionalOldSelf` field for details.
1095+
1096+
Transition rules by default are applied only on UPDATE requests and are skipped if an old value could not be found. You can opt a transition rule into unconditional evaluation by setting `optionalOldSelf` to true.
1097+
-->
1098+
1099+
如果 `rule` 使用 `oldSelf` 变量,则隐式地将其视为一个 `转换规则(transition rule)`
1100+
1101+
默认情况下,`oldSelf` 变量与 `self` 类型相同。当 `optionalOldSelf``true` 时,`oldSelf`
1102+
变量是 CEL 可选变量,其 `value()``self` 类型相同。
1103+
有关详细信息,请参阅 `optionalOldSelf` 字段的文档。
1104+
1105+
默认情况下,转换规则仅适用于 UPDATE 请求,如果找不到旧值,则会跳过转换规则。
1106+
你可以通过将 `optionalOldSelf` 设置为 `true` 来使转换规则进行无条件求值。
1107+
9941108
- **x-kubernetes-validations.fieldPath** (string)
9951109

9961110
<!--
@@ -1049,6 +1163,27 @@ JSONSchemaProps 是JSON 模式(JSON-Schema),遵循其规范草案第 4 版
10491163
messageExpression 可以访问的变量与规则相同;唯一的区别是返回类型。
10501164
例如:"x must be less than max ("+string(self.max)+")"。
10511165

1166+
- **x-kubernetes-validations.optionalOldSelf** (boolean)
1167+
1168+
<!--
1169+
optionalOldSelf is used to opt a transition rule into evaluation even when the object is first created, or if the old object is missing the value.
1170+
1171+
When enabled `oldSelf` will be a CEL optional whose value will be `None` if there is no old value, or when the object is initially created.
1172+
1173+
You may check for presence of oldSelf using `oldSelf.hasValue()` and unwrap it after checking using `oldSelf.value()`. Check the CEL documentation for Optional types for more information: https://pkg.go.dev/github.com/google/cel-go/cel#OptionalTypes
1174+
1175+
May not be set unless `oldSelf` is used in `rule`.
1176+
-->
1177+
1178+
即使在对象首次创建时,或者旧对象无值时,也可以使用 `optionalOldSelf` 来使用转换规则求值。
1179+
1180+
当启用了 `optionalOldSelf` 时,`oldSelf` 将是 CEL 可选项,如果没有旧值或最初创建对象时,其值将为 `None`
1181+
1182+
你可以使用 `oldSelf.hasValue()` 检查 oldSelf 是否存在,并在检查后使用 `oldSelf.value()` 将其解包。
1183+
更多的信息可查看 CEL 文档中的 Optional 类型:https://pkg.go.dev/github.com/google/cel-go/cel#OptionalTypes
1184+
1185+
除非在 `rule` 中使用了 `oldSelf`,否则不可以设置。
1186+
10521187
- **x-kubernetes-validations.reason** (string)
10531188

10541189
<!--
@@ -1113,9 +1248,13 @@ CustomResourceDefinitionStatus 表示 CustomResourceDefinition 的状态。
11131248
- **acceptedNames.categories** ([]string)
11141249

11151250
<!--
1251+
*Atomic: will be replaced during a merge*
1252+
11161253
categories is a list of grouped resources this custom resource belongs to (e.g. 'all'). This is published in API discovery documents, and used by clients to support invocations like `kubectl get all`.
11171254
-->
11181255

1256+
**原子:将在合并期间被替换**
1257+
11191258
categories 是此自定义资源所属的分组资源列表(例如 'all')。
11201259
它在 API 发现文档中发布,并被客户端用于支持像 `kubectl get all` 这样的调用。
11211260

@@ -1130,9 +1269,13 @@ CustomResourceDefinitionStatus 表示 CustomResourceDefinition 的状态。
11301269
- **acceptedNames.shortNames** ([]string)
11311270

11321271
<!--
1272+
*Atomic: will be replaced during a merge*
1273+
11331274
shortNames are short names for the resource, exposed in API discovery documents, and used by clients to support invocations like `kubectl get \<shortname>`. It must be all lowercase.
11341275
-->
11351276

1277+
**原子:将在合并期间被替换**
1278+
11361279
shortNames 是资源的短名称,在 API 发现文档中公开,并支持客户端调用,如 `kubectl get <shortname>`。必须全部小写。
11371280

11381281
- **acceptedNames.singular** (string)
@@ -1214,9 +1357,13 @@ CustomResourceDefinitionStatus 表示 CustomResourceDefinition 的状态。
12141357
- **storedVersions** ([]string)
12151358

12161359
<!--
1360+
*Atomic: will be replaced during a merge*
1361+
12171362
storedVersions lists all versions of CustomResources that were ever persisted. Tracking these versions allows a migration path for stored versions in etcd. The field is mutable so a migration controller can finish a migration to another version (ensuring no old objects are left in storage), and then remove the rest of the versions from this list. Versions may not be removed from `spec.versions` while they exist in this list.
12181363
-->
12191364

1365+
**原子:将在合并期间被替换**
1366+
12201367
storedVersions 列出了曾经被持久化的所有 CustomResources 版本。跟踪这些版本可以为 etcd 中的存储版本提供迁移路径。
12211368
该字段是可变的,因此迁移控制器可以完成到另一个版本的迁移(确保存储中没有遗留旧对象),然后从该列表中删除其余版本。
12221369
当版本在此列表中时,则不能从 `spec.versions` 中删除。

0 commit comments

Comments
 (0)