Skip to content

Commit f0da19d

Browse files
committed
[zh] sync deprecation-guide.md
1 parent ae9e828 commit f0da19d

File tree

2 files changed

+80
-32
lines changed

2 files changed

+80
-32
lines changed

content/zh-cn/docs/reference/access-authn-authz/validating-admission-policy.md

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -580,11 +580,12 @@ Examples on escaping:
580580
<!--
581581
Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1].
582582
Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:
583-
- 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and
584-
non-intersecting elements in `Y` are appended, retaining their partial order.
585-
- 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values
586-
are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with
587-
non-intersecting keys are appended, retaining their partial order.
583+
584+
- 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and
585+
non-intersecting elements in `Y` are appended, retaining their partial order.
586+
- 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values
587+
are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with
588+
non-intersecting keys are appended, retaining their partial order.
588589
-->
589590
列表类型为 "set" 或 "map" 的数组上的等价关系比较会忽略元素顺序,即 [1, 2] == [2, 1]
590591
使用 x-kubernetes-list-type 连接数组时使用列表类型的语义:
@@ -654,7 +655,7 @@ Here is an example illustrating a few different uses for match conditions:
654655
-->
655656
以下示例说明了匹配条件的几个不同用法:
656657

657-
{{< codenew file="access/validating-admission-policy-match-conditions.yaml" >}}
658+
{{% codenew file="access/validating-admission-policy-match-conditions.yaml" %}}
658659

659660
<!--
660661
Match conditions have access to the same CEL variables as validation expressions.
@@ -664,8 +665,8 @@ the request is determined as follows:
664665
665666
1. If **any** match condition evaluated to `false` (regardless of other errors), the API server skips the policy.
666667
2. Otherwise:
667-
- for [`failurePolicy: Fail`](#failure-policy), reject the request (without evaluating the policy).
668-
- for [`failurePolicy: Ignore`](#failure-policy), proceed with the request but skip the policy.
668+
- for [`failurePolicy: Fail`](#failure-policy), reject the request (without evaluating the policy).
669+
- for [`failurePolicy: Ignore`](#failure-policy), proceed with the request but skip the policy.
669670
-->
670671
这些匹配条件可以访问与验证表达式相同的 CEL 变量。
671672

@@ -690,13 +691,14 @@ For example, here is an admission policy with an audit annotation:
690691

691692
例如,以下是带有审计注解的准入策略:
692693

693-
{{< codenew file="access/validating-admission-policy-audit-annotation.yaml" >}}
694+
{{% codenew file="access/validating-admission-policy-audit-annotation.yaml" %}}
694695

695696
<!--
696697
When an API request is validated with this admission policy, the resulting audit event will look like:
697698
-->
698699
当使用此准入策略验证 API 请求时,生成的审计事件将如下所示:
699700

701+
<!--
700702
```
701703
# the audit event recorded
702704
{
@@ -711,6 +713,21 @@ When an API request is validated with this admission policy, the resulting audit
711713
...
712714
}
713715
```
716+
-->
717+
```
718+
# 记录的审计事件
719+
{
720+
"kind": "Event",
721+
"apiVersion": "audit.k8s.io/v1",
722+
"annotations": {
723+
"demo-policy.example.com/high-replica-count": "Deployment spec.replicas set to 128"
724+
# 其他注解
725+
...
726+
}
727+
# 其他字段
728+
...
729+
}
730+
```
714731

715732
<!--
716733
In this example the annotation will only be included if the `spec.replicas` of the Deployment is more than
@@ -748,7 +765,7 @@ we can have the following validation:
748765

749766
例如,为了在策略引用参数时更好地告知用户拒绝原因,我们可以有以下验证:
750767

751-
{{< codenew file="access/deployment-replicas-policy.yaml" >}}
768+
{{% codenew file="access/deployment-replicas-policy.yaml" %}}
752769

753770
<!--
754771
After creating a params object that limits the replicas to 3 and setting up the binding,
@@ -801,6 +818,9 @@ For example, given the following policy definition:
801818

802819
例如,给定以下策略定义:
803820

821+
<!--
822+
# should be "object.spec.replicas > 1"
823+
-->
804824
```yaml
805825
apiVersion: admissionregistration.k8s.io/v1alpha1
806826
kind: ValidatingAdmissionPolicy
@@ -842,6 +862,9 @@ For example, the following policy definition
842862
如果在 `spec.matchConstraints` 中匹配了多个资源,则所有匹配的资源都将进行检查。
843863
例如,以下策略定义:
844864

865+
<!--
866+
# should be "object.spec.replicas > 1"
867+
-->
845868
```yaml
846869
apiVersion: admissionregistration.k8s.io/v1alpha1
847870
kind: ValidatingAdmissionPolicy
@@ -892,7 +915,7 @@ Type Checking has the following limitation:
892915
类型检查具有以下限制:
893916

894917
- 没有通配符匹配。
895-
如果 `spec.matchConstraints.resourceRules` 中的任何一个 `apiGroups``、apiVersions`
918+
如果 `spec.matchConstraints.resourceRules` 中的任何一个 `apiGroups`、`apiVersions`
896919
或 `resources` 包含 "\*",则不会检查与 "\*" 匹配的类型。
897920
- 匹配的类型数量最多为 10 种。这是为了防止手动指定过多类型的策略消耗过多计算资源。
898921
按升序处理组、版本,然后是资源,忽略第 11 个及其之后的组合。

content/zh-cn/docs/reference/using-api/deprecation-guide.md

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ FlowSchema 和 PriorityLevelConfiguration。
110110
* 迁移清单和 API 客户端使用 **flowcontrol.apiserver.k8s.io/v1beta3** API 版本,
111111
此 API 从 v1.26 版本开始可用;
112112
* 所有的已保存的对象都可以通过新的 API 来访问;
113-
* 没有需要额外注意的变更
113+
* 没有需要额外注意的变更
114114

115115
#### HorizontalPodAutoscaler {#horizontalpodautoscaler-v126}
116116

@@ -125,7 +125,7 @@ HorizontalPodAutoscaler。
125125

126126
* 迁移清单和 API 客户端使用 **autoscaling/v2** API 版本,
127127
此 API 从 v1.23 版本开始可用;
128-
* 所有的已保存的对象都可以通过新的 API 来访问
128+
* 所有的已保存的对象都可以通过新的 API 来访问
129129

130130
### v1.25
131131

@@ -786,7 +786,7 @@ to locate use of deprecated APIs.
786786
-->
787787
### 定位何处使用了已弃用的 API
788788

789-
使用 [client warnings, metrics, and audit information available in 1.19+](/blog/2020/09/03/warnings/#deprecation-warnings)
789+
使用 [1.19 及更高版本中可用的客户端警告、指标和审计信息](/zh-cn/blog/2020/09/03/warnings/#deprecation-warnings)
790790
来定位在何处使用了已弃用的 API。
791791

792792
<!--
@@ -801,25 +801,50 @@ to locate use of deprecated APIs.
801801
* 更新自定义的集成组件和控制器,调用未被弃用的 API
802802
* 更改 YAML 文件引用未被弃用的 API
803803

804-
<!--
805-
You can use the `kubectl-convert` command (`kubectl convert` prior to v1.20)
806-
to automatically convert an existing object:
807-
-->
808-
你可以用 `kubectl-convert` 命令(在 v1.20 之前是 `kubectl convert`
809-
来自动转换现有对象:
804+
<!--
805+
You can use the `kubectl convert` command to automatically convert an existing object:
806+
-->
807+
你可以用 `kubectl-convert` 命令自动转换现有对象:
810808

811-
`kubectl-convert -f <file> --output-version <group>/<version>`.
809+
```shell
810+
kubectl convert -f <file> --output-version <group>/<version>
811+
```
812812

813-
<!--
814-
For example, to convert an older Deployment to `apps/v1`, you can run:
815-
-->
816-
例如,要将较老的 Deployment 版本转换为 `apps/v1` 版本,你可以运行:
813+
<!--
814+
For example, to convert an older Deployment to `apps/v1`, you can run:
815+
-->
816+
例如,要将较老的 Deployment 版本转换为 `apps/v1` 版本,你可以运行:
817817

818-
`kubectl-convert -f ./my-deployment.yaml --output-version apps/v1`
818+
```shell
819+
kubectl convert -f ./my-deployment.yaml --output-version apps/v1
820+
```
819821

820-
<!--
821-
Note that this may use non-ideal default values. To learn more about a specific
822-
resource, check the Kubernetes [API reference](/docs/reference/kubernetes-api/).
823-
-->
824-
需要注意的是这种操作使用的默认值可能并不理想。
825-
要进一步了解某个特定资源,可查阅 Kubernetes [API 参考](/zh-cn/docs/reference/kubernetes-api/)
822+
<!--
823+
This conversion may use non-ideal default values. To learn more about a specific
824+
resource, check the Kubernetes [API reference](/docs/reference/kubernetes-api/).
825+
-->
826+
这个转换可能使用了非理想的默认值。要了解更多关于特定资源的信息,
827+
请查阅 Kubernetes [API 参考文档](/zh-cn/docs/reference/kubernetes-api/)
828+
829+
{{< note >}}
830+
<!--
831+
The `kubectl convert` tool is not installed by default, although
832+
in fact it once was part of `kubectl` itself. For more details, you can read the
833+
[deprecation and removal issue](https://github.com/kubernetes/kubectl/issues/725)
834+
for the built-in subcommand.
835+
-->
836+
尽管实际上 `kubectl convert` 工具曾经是 `kubectl` 自身的一部分,但此工具不是默认安装的。
837+
如果想了解更多详情,可以阅读内置子命令的[弃用和移除问题](https://github.com/kubernetes/kubectl/issues/725)
838+
839+
<!--
840+
To learn how to set up `kubectl convert` on your computer, visit the page that is right for your
841+
operating system:
842+
[Linux](/docs/tasks/tools/install-kubectl-linux/#install-kubectl-convert-plugin),
843+
[macOS](/docs/tasks/tools/install-kubectl-macos/#install-kubectl-convert-plugin), or
844+
[Windows](/docs/tasks/tools/install-kubectl-windows/#install-kubectl-convert-plugin).
845+
-->
846+
要了解如何在你的计算机上设置 `kubectl convert`,查阅适合你操作系统的页面:
847+
[Linux](/zh-cn/docs/tasks/tools/install-kubectl-linux/#install-kubectl-convert-plugin)
848+
[macOS](/zh-cn/docs/tasks/tools/install-kubectl-macos/#install-kubectl-convert-plugin)
849+
[Windows](/zh-cn/docs/tasks/tools/install-kubectl-windows/#install-kubectl-convert-plugin)
850+
{{< /note >}}

0 commit comments

Comments
 (0)