Skip to content

Commit c73418e

Browse files
authored
Merge pull request #36250 from yanrongshi/zh-cn]Sync-1.25-custom-resource-definitions.md
[zh-cn]Sync 1.25 custom-resource-definitions.md
2 parents 17d7bd5 + 869318c commit c73418e

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

content/zh-cn/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ spec:
105105
plural: crontabs
106106
# singular name to be used as an alias on the CLI and for display
107107
singular: crontab
108-
# kind is normally the PascalCased singular type. Your resource manifests use this.
108+
# kind is normally the CamelCased singular type. Your resource manifests use this.
109109
kind: CronTab
110110
# shortNames allow shorter string to match your resource on the CLI
111111
shortNames:
@@ -148,7 +148,7 @@ spec:
148148
plural: crontabs
149149
# 名称的单数形式,作为命令行使用时和显示时的别名
150150
singular: crontab
151-
# kind 通常是单数形式的帕斯卡编码(PascalCased)形式。你的资源清单会使用这一形式。
151+
# kind 通常是单数形式的驼峰命名(CamelCased)形式。你的资源清单会使用这一形式。
152152
kind: CronTab
153153
# shortNames 允许你在命令行使用较短的字符串来匹配资源
154154
shortNames:
@@ -322,15 +322,15 @@ If you later recreate the same CustomResourceDefinition, it will start out empty
322322
<!--
323323
## Specifying a structural schema
324324
325-
CustomResources store structured data in custom fiels (alongside the built-in
325+
CustomResources store structured data in custom fields (alongside the built-in
326326
fields `apiVersion`, `kind` and `metadata`, which the API server validates
327327
implicitly). With [OpenAPI v3.0 validation](#validation) a schema can be
328328
specified, which is validated during creation and updates, compare below for
329329
details and limits of such a schema.
330330
331331
With `apiextensions.k8s.io/v1` the definition of a structural schema is
332332
mandatory for CustomResourceDefinitions. In the beta version of
333-
CustomResourceDefinition, structural schemas were optional.
333+
CustomResourceDefinition, the structural schema was optional.
334334
-->
335335
## 设置结构化的模式 {#specifying-a-structural-schema}
336336

@@ -1137,18 +1137,25 @@ crontab "my-new-cron-object" created
11371137
-->
11381138
## 验证规则
11391139

1140-
{{< feature-state state="alpha" for_k8s_version="v1.23" >}}
1140+
{{< feature-state state="beta" for_k8s_version="v1.25" >}}
11411141

11421142
<!--
1143-
Validation rules are in alpha since 1.23 and validate custom resources when the
1143+
Validation rules are in beta since 1.25 and the
11441144
`CustomResourceValidationExpressions` [feature
1145-
gate](/docs/reference/command-line-tools-reference/feature-gates/) is enabled.
1145+
gate](/docs/reference/command-line-tools-reference/feature-gates/) is enabled by default to validate custom resource
1146+
based on _validation rules_. You can disable this feature by explicitly setting the
1147+
`CustomResourceValidationExpressions` feature gate to `false`,
1148+
for the `[kube-apiserver](https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/)` component.
11461149
This feature is only available if the schema is a
11471150
[structural schema](#specifying-a-structural-schema).
11481151
-->
1149-
验证规则从 1.23 开始处于 Alpha 状态,
1150-
当 `CustomResourceValidationExpressions` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)被启用时,
1151-
验证定制资源。这个功能只有在模式是[结构化的模式](#specifying-a-structural-schema)时才可用。
1152+
验证规则从 1.25 开始处于 Beta 状态,
1153+
默认情况下,`CustomResourceValidationExpressions` [特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
1154+
是被启用的,以便根据**验证规则**来验证定制资源。
1155+
对于 [`kube-apiserver`](docs/reference/command-line-tools-reference/kube-apiserver/) 组件,
1156+
特性门控显式设置为 false 来禁用此特性。
1157+
1158+
这个特性只有在模式是[结构化的模式](#specifying-a-structural-schema)时才可用。
11521159

11531160
<!--
11541161
Validation rules use the [Common Expression Language (CEL)](https://github.com/google/cel-spec)
@@ -1306,7 +1313,7 @@ Validation Rules Examples:
13061313
| `'Available' in self.stateCounts` | Validate that an entry with the 'Available' key exists in a map |
13071314
| `(size(self.list1) == 0) != (size(self.list2) == 0)` | Validate that one of two lists is non-empty, but not both |
13081315
| <code>!('MY_KEY' in self.map1) &#124;&#124; self['MY_KEY'].matches('^[a-zA-Z]*$')</code> | Validate the value of a map for a specific key, if it is in the map |
1309-
| `self.envars.filter(e, e.name = 'MY_ENV').all(e, e.value.matches('^[a-zA-Z]*$')` | Validate the 'value' field of a listMap entry where key field 'name' is 'MY_ENV' |
1316+
| `self.envars.filter(e, e.name == 'MY_ENV').all(e, e.value.matches('^[a-zA-Z]*$')` | Validate the 'value' field of a listMap entry where key field 'name' is 'MY_ENV' |
13101317
| `has(self.expired) && self.created + self.ttl < self.expired` | Validate that 'expired' date is after a 'create' date plus a 'ttl' duration |
13111318
| `self.health.startsWith('ok')` | Validate a 'health' string field has the prefix 'ok' |
13121319
| `self.widgets.exists(w, w.key == 'x' && w.foo < 10)` | Validate that the 'foo' property of a listMap item with a key 'x' is less than 10 |
@@ -1506,6 +1513,7 @@ Accessible property names are escaped according to the following rules when acce
15061513
当在表达式中访问时,可访问的属性名称会根据以下规则进行转义:
15071514

15081515
<!--
1516+
| escape sequence | property name equivalent |
15091517
| ----------------------- | -----------------------|
15101518
| `__underscores__` | `__` |
15111519
| `__dot__` | `.` |
@@ -2438,7 +2446,7 @@ the status replica value in the `/scale` subresource will default to 0.
24382446
副本个数状态值默认为 0。
24392447
24402448
<!--
2441-
- `labelSelectorPath` defines the JSONPath inside of a custom resource that corresponds to `scale.status.selector`.
2449+
- `labelSelectorPath` defines the JSONPath inside of a custom resource that corresponds to `Scale.Status.Selector`.
24422450
24432451
- It is an optional value.
24442452
- It must be set to work with HPA.
@@ -2448,7 +2456,7 @@ the status replica value in the `/scale` subresource will default to 0.
24482456
- The field pointed by this JSON path must be a string field (not a complex selector struct)
24492457
which contains a serialized label selector in string form.
24502458
-->
2451-
- `labelSelectorPath` 指定定制资源内与 `scale.status.selector` 对应的 JSON 路径。
2459+
- `labelSelectorPath` 指定定制资源内与 `Scale.Status.Selector` 对应的 JSON 路径。
24522460
24532461
- 此字段为可选值。
24542462
- 此字段必须设置才能使用 HPA。
@@ -2706,9 +2714,9 @@ kubectl get all
27062714
```
27072715

27082716
<!--
2709-
The output will include the custom resources of kind `CronTab`:
2717+
and it will include the custom resources of kind `CronTab`:
27102718
-->
2711-
输出中会包含类别为 `CronTab` 的定制资源:
2719+
输出中将包含类别为 `CronTab` 的定制资源:
27122720

27132721
```console
27142722
NAME AGE

0 commit comments

Comments
 (0)