[zh] sync deprecation-guide.md
parent
ae9e8282f0
commit
f0da19dfa2
|
@ -580,11 +580,12 @@ Examples on escaping:
|
|||
<!--
|
||||
Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1].
|
||||
Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:
|
||||
- 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and
|
||||
non-intersecting elements in `Y` are appended, retaining their partial order.
|
||||
- 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values
|
||||
are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with
|
||||
non-intersecting keys are appended, retaining their partial order.
|
||||
|
||||
- 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and
|
||||
non-intersecting elements in `Y` are appended, retaining their partial order.
|
||||
- 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values
|
||||
are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with
|
||||
non-intersecting keys are appended, retaining their partial order.
|
||||
-->
|
||||
列表类型为 "set" 或 "map" 的数组上的等价关系比较会忽略元素顺序,即 [1, 2] == [2, 1]。
|
||||
使用 x-kubernetes-list-type 连接数组时使用列表类型的语义:
|
||||
|
@ -654,7 +655,7 @@ Here is an example illustrating a few different uses for match conditions:
|
|||
-->
|
||||
以下示例说明了匹配条件的几个不同用法:
|
||||
|
||||
{{< codenew file="access/validating-admission-policy-match-conditions.yaml" >}}
|
||||
{{% codenew file="access/validating-admission-policy-match-conditions.yaml" %}}
|
||||
|
||||
<!--
|
||||
Match conditions have access to the same CEL variables as validation expressions.
|
||||
|
@ -664,8 +665,8 @@ the request is determined as follows:
|
|||
|
||||
1. If **any** match condition evaluated to `false` (regardless of other errors), the API server skips the policy.
|
||||
2. Otherwise:
|
||||
- for [`failurePolicy: Fail`](#failure-policy), reject the request (without evaluating the policy).
|
||||
- for [`failurePolicy: Ignore`](#failure-policy), proceed with the request but skip the policy.
|
||||
- for [`failurePolicy: Fail`](#failure-policy), reject the request (without evaluating the policy).
|
||||
- for [`failurePolicy: Ignore`](#failure-policy), proceed with the request but skip the policy.
|
||||
-->
|
||||
这些匹配条件可以访问与验证表达式相同的 CEL 变量。
|
||||
|
||||
|
@ -690,13 +691,14 @@ For example, here is an admission policy with an audit annotation:
|
|||
|
||||
例如,以下是带有审计注解的准入策略:
|
||||
|
||||
{{< codenew file="access/validating-admission-policy-audit-annotation.yaml" >}}
|
||||
{{% codenew file="access/validating-admission-policy-audit-annotation.yaml" %}}
|
||||
|
||||
<!--
|
||||
When an API request is validated with this admission policy, the resulting audit event will look like:
|
||||
-->
|
||||
当使用此准入策略验证 API 请求时,生成的审计事件将如下所示:
|
||||
|
||||
<!--
|
||||
```
|
||||
# the audit event recorded
|
||||
{
|
||||
|
@ -711,6 +713,21 @@ When an API request is validated with this admission policy, the resulting audit
|
|||
...
|
||||
}
|
||||
```
|
||||
-->
|
||||
```
|
||||
# 记录的审计事件
|
||||
{
|
||||
"kind": "Event",
|
||||
"apiVersion": "audit.k8s.io/v1",
|
||||
"annotations": {
|
||||
"demo-policy.example.com/high-replica-count": "Deployment spec.replicas set to 128"
|
||||
# 其他注解
|
||||
...
|
||||
}
|
||||
# 其他字段
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
<!--
|
||||
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:
|
|||
|
||||
例如,为了在策略引用参数时更好地告知用户拒绝原因,我们可以有以下验证:
|
||||
|
||||
{{< codenew file="access/deployment-replicas-policy.yaml" >}}
|
||||
{{% codenew file="access/deployment-replicas-policy.yaml" %}}
|
||||
|
||||
<!--
|
||||
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:
|
|||
|
||||
例如,给定以下策略定义:
|
||||
|
||||
<!--
|
||||
# should be "object.spec.replicas > 1"
|
||||
-->
|
||||
```yaml
|
||||
apiVersion: admissionregistration.k8s.io/v1alpha1
|
||||
kind: ValidatingAdmissionPolicy
|
||||
|
@ -842,6 +862,9 @@ For example, the following policy definition
|
|||
如果在 `spec.matchConstraints` 中匹配了多个资源,则所有匹配的资源都将进行检查。
|
||||
例如,以下策略定义:
|
||||
|
||||
<!--
|
||||
# should be "object.spec.replicas > 1"
|
||||
-->
|
||||
```yaml
|
||||
apiVersion: admissionregistration.k8s.io/v1alpha1
|
||||
kind: ValidatingAdmissionPolicy
|
||||
|
@ -892,7 +915,7 @@ Type Checking has the following limitation:
|
|||
类型检查具有以下限制:
|
||||
|
||||
- 没有通配符匹配。
|
||||
如果 `spec.matchConstraints.resourceRules` 中的任何一个 `apiGroups``、apiVersions`
|
||||
如果 `spec.matchConstraints.resourceRules` 中的任何一个 `apiGroups`、`apiVersions`
|
||||
或 `resources` 包含 "\*",则不会检查与 "\*" 匹配的类型。
|
||||
- 匹配的类型数量最多为 10 种。这是为了防止手动指定过多类型的策略消耗过多计算资源。
|
||||
按升序处理组、版本,然后是资源,忽略第 11 个及其之后的组合。
|
||||
|
|
|
@ -110,7 +110,7 @@ FlowSchema 和 PriorityLevelConfiguration。
|
|||
* 迁移清单和 API 客户端使用 **flowcontrol.apiserver.k8s.io/v1beta3** API 版本,
|
||||
此 API 从 v1.26 版本开始可用;
|
||||
* 所有的已保存的对象都可以通过新的 API 来访问;
|
||||
* 没有需要额外注意的变更
|
||||
* 没有需要额外注意的变更。
|
||||
|
||||
#### HorizontalPodAutoscaler {#horizontalpodautoscaler-v126}
|
||||
|
||||
|
@ -125,7 +125,7 @@ HorizontalPodAutoscaler。
|
|||
|
||||
* 迁移清单和 API 客户端使用 **autoscaling/v2** API 版本,
|
||||
此 API 从 v1.23 版本开始可用;
|
||||
* 所有的已保存的对象都可以通过新的 API 来访问;
|
||||
* 所有的已保存的对象都可以通过新的 API 来访问。
|
||||
|
||||
### v1.25
|
||||
|
||||
|
@ -786,7 +786,7 @@ to locate use of deprecated APIs.
|
|||
-->
|
||||
### 定位何处使用了已弃用的 API
|
||||
|
||||
使用 [client warnings, metrics, and audit information available in 1.19+](/blog/2020/09/03/warnings/#deprecation-warnings)
|
||||
使用 [1.19 及更高版本中可用的客户端警告、指标和审计信息](/zh-cn/blog/2020/09/03/warnings/#deprecation-warnings)
|
||||
来定位在何处使用了已弃用的 API。
|
||||
|
||||
<!--
|
||||
|
@ -801,25 +801,50 @@ to locate use of deprecated APIs.
|
|||
* 更新自定义的集成组件和控制器,调用未被弃用的 API
|
||||
* 更改 YAML 文件引用未被弃用的 API
|
||||
|
||||
<!--
|
||||
You can use the `kubectl-convert` command (`kubectl convert` prior to v1.20)
|
||||
to automatically convert an existing object:
|
||||
-->
|
||||
你可以用 `kubectl-convert` 命令(在 v1.20 之前是 `kubectl convert`)
|
||||
来自动转换现有对象:
|
||||
<!--
|
||||
You can use the `kubectl convert` command to automatically convert an existing object:
|
||||
-->
|
||||
你可以用 `kubectl-convert` 命令自动转换现有对象:
|
||||
|
||||
`kubectl-convert -f <file> --output-version <group>/<version>`.
|
||||
```shell
|
||||
kubectl convert -f <file> --output-version <group>/<version>
|
||||
```
|
||||
|
||||
<!--
|
||||
For example, to convert an older Deployment to `apps/v1`, you can run:
|
||||
-->
|
||||
例如,要将较老的 Deployment 版本转换为 `apps/v1` 版本,你可以运行:
|
||||
<!--
|
||||
For example, to convert an older Deployment to `apps/v1`, you can run:
|
||||
-->
|
||||
例如,要将较老的 Deployment 版本转换为 `apps/v1` 版本,你可以运行:
|
||||
|
||||
`kubectl-convert -f ./my-deployment.yaml --output-version apps/v1`
|
||||
```shell
|
||||
kubectl convert -f ./my-deployment.yaml --output-version apps/v1
|
||||
```
|
||||
|
||||
<!--
|
||||
Note that this may use non-ideal default values. To learn more about a specific
|
||||
resource, check the Kubernetes [API reference](/docs/reference/kubernetes-api/).
|
||||
-->
|
||||
需要注意的是这种操作使用的默认值可能并不理想。
|
||||
要进一步了解某个特定资源,可查阅 Kubernetes [API 参考](/zh-cn/docs/reference/kubernetes-api/)。
|
||||
<!--
|
||||
This conversion may use non-ideal default values. To learn more about a specific
|
||||
resource, check the Kubernetes [API reference](/docs/reference/kubernetes-api/).
|
||||
-->
|
||||
这个转换可能使用了非理想的默认值。要了解更多关于特定资源的信息,
|
||||
请查阅 Kubernetes [API 参考文档](/zh-cn/docs/reference/kubernetes-api/)。
|
||||
|
||||
{{< note >}}
|
||||
<!--
|
||||
The `kubectl convert` tool is not installed by default, although
|
||||
in fact it once was part of `kubectl` itself. For more details, you can read the
|
||||
[deprecation and removal issue](https://github.com/kubernetes/kubectl/issues/725)
|
||||
for the built-in subcommand.
|
||||
-->
|
||||
尽管实际上 `kubectl convert` 工具曾经是 `kubectl` 自身的一部分,但此工具不是默认安装的。
|
||||
如果想了解更多详情,可以阅读内置子命令的[弃用和移除问题](https://github.com/kubernetes/kubectl/issues/725)。
|
||||
|
||||
<!--
|
||||
To learn how to set up `kubectl convert` on your computer, visit the page that is right for your
|
||||
operating system:
|
||||
[Linux](/docs/tasks/tools/install-kubectl-linux/#install-kubectl-convert-plugin),
|
||||
[macOS](/docs/tasks/tools/install-kubectl-macos/#install-kubectl-convert-plugin), or
|
||||
[Windows](/docs/tasks/tools/install-kubectl-windows/#install-kubectl-convert-plugin).
|
||||
-->
|
||||
要了解如何在你的计算机上设置 `kubectl convert`,查阅适合你操作系统的页面:
|
||||
[Linux](/zh-cn/docs/tasks/tools/install-kubectl-linux/#install-kubectl-convert-plugin)、
|
||||
[macOS](/zh-cn/docs/tasks/tools/install-kubectl-macos/#install-kubectl-convert-plugin) 或
|
||||
[Windows](/zh-cn/docs/tasks/tools/install-kubectl-windows/#install-kubectl-convert-plugin)。
|
||||
{{< /note >}}
|
||||
|
|
Loading…
Reference in New Issue