Skip to content

Commit d3e2a6a

Browse files
committed
[zh-cn]sync topology-spread-constraints.md
Signed-off-by: xin.li <[email protected]>
1 parent a188498 commit d3e2a6a

File tree

3 files changed

+63
-39
lines changed

3 files changed

+63
-39
lines changed

content/zh-cn/docs/concepts/scheduling-eviction/topology-spread-constraints.md

Lines changed: 47 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ spec:
127127
topologyKey: <string>
128128
whenUnsatisfiable: <string>
129129
labelSelector: <object>
130-
matchLabelKeys: <list> # 可选;自从 v1.27 开始成为 Beta
131-
nodeAffinityPolicy: [Honor|Ignore] # 可选;自从 v1.26 开始成为 Beta
132-
nodeTaintsPolicy: [Honor|Ignore] # 可选;自从 v1.26 开始成为 Beta
130+
matchLabelKeys: <list> # 可选; v1.27 开始成为 Beta
131+
nodeAffinityPolicy: [Honor|Ignore] # 可选; v1.26 开始成为 Beta
132+
nodeTaintsPolicy: [Honor|Ignore] # 可选; v1.26 开始成为 Beta
133133
### 其他 Pod 字段置于此处
134134
```
135135

@@ -248,32 +248,48 @@ your cluster. Those fields are:
248248
有关详细信息,请参考[标签选择算符](/zh-cn/docs/concepts/overview/working-with-objects/labels/#label-selectors)
249249

250250
<!--
251-
- **matchLabelKeys** is a list of pod label keys to select the pods over which
252-
spreading will be calculated. The keys are used to lookup values from the pod labels,
253-
those key-value labels are ANDed with `labelSelector` to select the group of existing
254-
pods over which spreading will be calculated for the incoming pod. The same key is
255-
forbidden to exist in both `matchLabelKeys` and `labelSelector`. `matchLabelKeys` cannot
256-
be set when `labelSelector` isn't set. Keys that don't exist in the pod labels will be
257-
ignored. A null or empty list means only match against the `labelSelector`.
251+
- **matchLabelKeys** is a list of pod label keys to select the group of pods over which
252+
the spreading skew will be calculated. At a pod creation,
253+
the kube-apiserver uses those keys to lookup values from the incoming pod labels,
254+
and those key-value labels will be merged with any existing `labelSelector`.
255+
The same key is forbidden to exist in both `matchLabelKeys` and `labelSelector`.
256+
`matchLabelKeys` cannot be set when `labelSelector` isn't set.
257+
Keys that don't exist in the pod labels will be ignored.
258+
A null or empty list means only match against the `labelSelector`.
259+
-->
260+
- - **matchLabelKeys** 是一个 Pod 标签键的列表,用于选择计算分布偏差的 Pod 组。在创建 Pod 时,
261+
kube-apiserver 使用这些键从传入的 Pod 标签中查找值,并将这些键值标签与现有的 `labelSelector` 合并。
262+
相同的键不允许同时出现在 `matchLabelKeys``labelSelector` 中。
263+
`labelSelector` 未设置时,不能设置 `matchLabelKeys`
264+
如果键在 Pod 标签中不存在,则会被忽略。
265+
一个空或 `null` 的列表意味着仅与 `labelSelector` 匹配。
266+
267+
{{< caution >}}
268+
<!--
269+
It's not recommended to use `matchLabelKeys` with labels that might be updated directly on pods.
270+
Even if you edit the pod's label that is specified at `matchLabelKeys` **directly**,
271+
(that is, you edit the Pod and not a Deployment),
272+
kube-apiserver doesn't reflect the label update onto the merged `labelSelector`.
273+
-->
274+
不建议将 `matchLabelKeys` 与可能直接在 Pod 上更新的标签一起使用。
275+
即使你**直接**编辑了位于 `matchLabelKeys` 中指定的 Pod 标签,
276+
(也就是说,你编辑的是 Pod 而不是 Deployment),
277+
kube-apiserver 不会将标签更新反映到合并的 `labelSelector` 上。
278+
{{< /caution >}}
258279

280+
281+
<!--
259282
With `matchLabelKeys`, you don't need to update the `pod.spec` between different revisions.
260283
The controller/operator just needs to set different values to the same label key for different
261-
revisions. The scheduler will assume the values automatically based on `matchLabelKeys`. For
262-
example, if you are configuring a Deployment, you can use the label keyed with
284+
revisions. For example, if you are configuring a Deployment, you can use the label keyed with
263285
[pod-template-hash](/docs/concepts/workloads/controllers/deployment/#pod-template-hash-label), which
264286
is added automatically by the Deployment controller, to distinguish between different revisions
265287
in a single Deployment.
266288
-->
267-
- **matchLabelKeys** 是一个 Pod 标签键的列表,用于选择需要计算分布方式的 Pod 集合。
268-
这些键用于从 Pod 标签中查找值,这些键值标签与 `labelSelector` 进行逻辑与运算,以选择一组已有的 Pod,
269-
通过这些 Pod 计算新来 Pod 的分布方式。`matchLabelKeys``labelSelector` 中禁止存在相同的键。
270-
未设置 `labelSelector` 时无法设置 `matchLabelKeys`。Pod 标签中不存在的键将被忽略。
271-
null 或空列表意味着仅与 `labelSelector` 匹配。
272-
273289
借助 `matchLabelKeys`,你无需在变更 Pod 修订版本时更新 `pod.spec`
274290
控制器或 Operator 只需要将不同修订版的标签键设为不同的值。
275-
调度器将根据 `matchLabelKeys` 自动确定取值。例如,如果你正在配置一个 Deployment,
276-
则你可以使用由 Deployment 控制器自动添加的、以
291+
例如,如果你正在配置一个 Deployment,则可以使用由 Deployment
292+
控制器自动添加的、以
277293
[pod-template-hash](/zh-cn/docs/concepts/workloads/controllers/deployment/#pod-template-hash-label)
278294
为键的标签来区分同一个 Deployment 的不同修订版。
279295

@@ -297,6 +313,17 @@ your cluster. Those fields are:
297313
`matchLabelKeys` 字段是 1.27 中默认启用的一个 Beta 级别字段。
298314
你可以通过禁用 `MatchLabelKeysInPodTopologySpread`
299315
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)来禁用此字段。
316+
317+
<!--
318+
Before v1.34, `matchLabelKeys` was handled implicitly.
319+
Since v1.34, key-value labels corresponding to `matchLabelKeys` are explicitly merged into `labelSelector`.
320+
You can disable it and revert to the previous behavior by disabling the `MatchLabelKeysInPodTopologySpreadSelectorMerge`
321+
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) of kube-apiserver.
322+
-->
323+
在 v1.34 之前,`matchLabelKeys` 是隐式处理的。
324+
从 v1.34 开始,与 `matchLabelKeys` 对应的键值标签会被明确地合并到 `labelSelector` 中。
325+
你可以通过禁用 kube-apiserver 的 `MatchLabelKeysInPodTopologySpreadSelectorMerge`
326+
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)来禁用此行为并恢复到之前的行为。
300327
{{< /note >}}
301328

302329
<!--

content/zh-cn/docs/reference/access-authn-authz/node.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,9 @@ Read operations:
5555
{{< feature-state feature_gate_name="AuthorizeNodeWithSelectors" >}}
5656

5757
<!--
58-
When the `AuthorizeNodeWithSelectors` feature is enabled
59-
(along with the pre-requisite `AuthorizeWithSelectors` feature),
60-
kubelets are only allowed to read their own Node objects,
61-
and are only allowed to read pods bound to their node.
62-
-->
63-
当启用 `AuthorizeNodeWithSelectors` 特性
64-
(以及作为先决条件的 `AuthorizeWithSelectors` 特性)时,
65-
kubelet 只允许读取它们自己的 Node 对象,
66-
并且只允许读取绑定到其节点的 Pod。
58+
Kubelets are limited to reading their own Node objects, and only reading pods bound to their node.
59+
-->
60+
kubelet 仅限于读取自己的节点对象,以及与节点绑定的 Pod。
6761

6862
<!--
6963
Write operations:

content/zh-cn/docs/reference/command-line-tools-reference/feature-gates/KubeletPodResourcesDynamicResources.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ _build:
88
stages:
99
- stage: alpha
1010
defaultValue: false
11-
fromVersion: "1.27"
11+
fromVersion: "1.27"
12+
toVersion: "1.33"
13+
- stage: beta
14+
defaultValue: true
15+
fromVersion: "1.34"
1216
---
1317

1418
<!--
15-
Extend the kubelet's pod resources gRPC endpoint to
16-
to include resources allocated in `ResourceClaims` via `DynamicResourceAllocation` API.
17-
See [resource allocation reporting](/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#monitoring-device-plugin-resources) for more details.
18-
with information about the allocatable resources, enabling clients to properly
19-
track the free compute resources on a node.
19+
Extend the kubelet's
20+
[pod resources monitoring gRPC API](/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins.md)
21+
endpoints List and Get to include resources allocated in ResourceClaims
22+
via [Dynamic Resource Allocation](/docs/concepts/scheduling-eviction/dynamic-resource-allocation/).
2023
-->
21-
扩展 kubelet 的 Pod 资源 gRPC 端点以包括通过
22-
`DynamicResourceAllocation` API 在 `ResourceClaims` 中分配的资源。
23-
详情参见[资源分配报告](/zh-cn/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#monitoring-device-plugin-resources)
24-
包含有关可分配资源的信息,使客户端能够正确跟踪节点上的可用计算资源
24+
扩展 kubelet 的 [Pod 资源监控 gRPC API](/zh-cn/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/)
25+
端点 List 和 Get,
26+
以包括通过[资源分配报告](/zh-cn/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/#monitoring-device-plugin-resources)
27+
ResourceClaim 中分配的资源

0 commit comments

Comments
 (0)