Skip to content

Commit cc210ba

Browse files
authored
Merge pull request #44042 from windsonsea/framey
[zh] Sync scheduling-framework.md
2 parents efe2fc9 + 5548886 commit cc210ba

File tree

1 file changed

+78
-41
lines changed

1 file changed

+78
-41
lines changed

content/zh-cn/docs/concepts/scheduling-eviction/scheduling-framework.md

Lines changed: 78 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ title: 调度框架
33
content_type: concept
44
weight: 60
55
---
6-
76
<!--
8-
---
97
reviewers:
108
- ahg-g
119
title: Scheduling Framework
1210
content_type: concept
1311
weight: 60
14-
---
1512
-->
1613

1714
<!-- overview -->
@@ -25,7 +22,6 @@ scheduling "core" lightweight and maintainable. Refer to the [design proposal of
2522
scheduling framework][kep] for more technical information on the design of the
2623
framework.
2724
-->
28-
2925
调度框架是面向 Kubernetes 调度器的一种插件架构,
3026
它为现有的调度器添加了一组新的“插件” API。插件会被编译到调度器之中。
3127
这些 API 允许大多数调度功能以插件的形式实现,同时使调度“核心”保持简单且可维护。
@@ -39,7 +35,7 @@ framework.
3935
<!--
4036
# Framework workflow
4137
-->
42-
# 框架工作流程
38+
# 框架工作流程 {#framework-workflow}
4339

4440
<!--
4541
The Scheduling Framework defines a few extension points. Scheduler plugins
@@ -58,7 +54,7 @@ cycle** and the **binding cycle**.
5854
<!--
5955
## Scheduling Cycle & Binding Cycle
6056
-->
61-
## 调度周期和绑定周期
57+
## 调度周期和绑定周期 {#scheduling-cycle-and-binding-cycle}
6258

6359
<!--
6460
The scheduling cycle selects a node for the Pod, and the binding cycle applies
@@ -82,23 +78,27 @@ the queue and retried.
8278
Pod 将返回队列并重试。
8379

8480
<!--
85-
## Extension points
81+
## Interfaces
8682
-->
87-
## 扩展点
83+
## 接口 {#interfaces}
8884

8985
<!--
90-
The following picture shows the scheduling context of a Pod and the extension
91-
points that the scheduling framework exposes. In this picture "Filter" is
92-
equivalent to "Predicate" and "Scoring" is equivalent to "Priority function".
86+
The following picture shows the scheduling context of a Pod and the interfaces
87+
that the scheduling framework exposes.
9388
-->
94-
下图显示了一个 Pod 的调度上下文以及调度框架公开的扩展点。
95-
在此图片中,“过滤器”等同于“断言”,“评分”相当于“优先级函数”。
89+
下图显示了一个 Pod 的调度上下文以及调度框架公开的接口。
9690

9791
<!--
98-
One plugin may register at multiple extension points to perform more complex or
92+
One plugin may implement multiple interfaces to perform more complex or
9993
stateful tasks.
10094
-->
101-
一个插件可以在多个扩展点处注册,以执行更复杂或有状态的任务。
95+
一个插件可能实现多个接口,以执行更为复杂或有状态的任务。
96+
97+
<!--
98+
Some interfaces match the scheduler extension points which can be configured through
99+
[Scheduler Configuration](/docs/reference/scheduling/config/#extension-points).
100+
-->
101+
某些接口与可以通过[调度器配置](/zh-cn/docs/reference/scheduling/config/#extension-points)来设置的调度器扩展点匹配。
102102

103103
<!--
104104
{{< figure src="/images/docs/scheduling-framework-extensions.png" title="scheduling framework extension points" class="diagram-large">}}
@@ -125,7 +125,45 @@ For more details about how internal scheduler queues work, read
125125
只有当所有 PreEnqueue 插件返回 `Success` 时,Pod 才允许进入活动队列。
126126
否则,它将被放置在内部无法调度的 Pod 列表中,并且不会获得 `Unschedulable` 状态。
127127

128-
要了解有关内部调度器队列如何工作的更多详细信息,请阅读 [kube-scheduler 调度队列](https://github.com/kubernetes/community/blob/f03b6d5692bd979f07dd472e7b6836b2dad0fd9b/contributors/devel/sig-scheduling/scheduler_queues.md)
128+
要了解有关内部调度器队列如何工作的更多详细信息,请阅读
129+
[kube-scheduler 调度队列](https://github.com/kubernetes/community/blob/f03b6d5692bd979f07dd472e7b6836b2dad0fd9b/contributors/devel/sig-scheduling/scheduler_queues.md)
130+
131+
### EnqueueExtension
132+
133+
<!--
134+
EnqueueExtension is the interface where the plugin can control
135+
whether to retry scheduling of Pods rejected by this plugin, based on changes in the cluster.
136+
Plugins that implement PreEnqueue, PreFilter, Filter, Reserve or Permit should implement this interface.
137+
-->
138+
EnqueueExtension 作为一个接口,插件可以在此接口之上根据集群中的变化来控制是否重新尝试调度被此插件拒绝的 Pod。
139+
实现 PreEnqueue、PreFilter、Filter、Reserve 或 Permit 的插件应实现此接口。
140+
141+
#### QueueingHint
142+
143+
{{< feature-state for_k8s_version="v1.28" state="beta" >}}
144+
145+
<!--
146+
QueueingHint is a callback function for deciding whether a Pod can be requeued to the active queue or backoff queue.
147+
It's executed every time a certain kind of event or change happens in the cluster.
148+
When the QueueingHint finds that the event might make the Pod schedulable,
149+
the Pod is put into the active queue or the backoff queue
150+
so that the scheduler will retry the scheduling of the Pod.
151+
-->
152+
QueueingHint 作为一个回调函数,用于决定是否将 Pod 重新排队到活跃队列或回退队列。
153+
每当集群中发生某种事件或变化时,此函数就会被执行。
154+
当 QueueingHint 发现事件可能使 Pod 可调度时,Pod 将被放入活跃队列或回退队列,
155+
以便调度器可以重新尝试调度 Pod。
156+
157+
{{< note >}}
158+
<!--
159+
QueueingHint evaluation during scheduling is a beta-level feature and is enabled by default in 1.28.
160+
You can disable it via the
161+
`SchedulerQueueingHints` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/).
162+
-->
163+
在调度过程中对 QueueingHint 求值是一个 Beta 级别的特性,在 1.28 中默认被启用。
164+
你可以通过 `SchedulerQueueingHints`
165+
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)来禁用它。
166+
{{< /note >}}
129167

130168
<!--
131169
### QueueSort {#queue-sort}
@@ -188,20 +226,20 @@ tries to make the pod schedulable by preempting other Pods.
188226

189227
<!--
190228
### PreScore {#pre-score}
191-
-->
229+
-->
192230
### PreScore {#pre-score}
193231

194232
<!--
195233
These plugins are used to perform "pre-scoring" work, which generates a sharable
196234
state for Score plugins to use. If a PreScore plugin returns an error, the
197235
scheduling cycle is aborted.
198-
-->
236+
-->
199237
这些插件用于执行 “前置评分(pre-scoring)” 工作,即生成一个可共享状态供 Score 插件使用。
200238
如果 PreScore 插件返回错误,则调度周期将终止。
201239

202240
<!--
203241
### Score {#scoring}
204-
-->
242+
-->
205243
### Score {#scoring}
206244

207245
<!--
@@ -213,8 +251,8 @@ scores from all plugins according to the configured plugin weights.
213251
-->
214252
这些插件用于对通过过滤阶段的节点进行排序。调度器将为每个节点调用每个评分插件。
215253
将有一个定义明确的整数范围,代表最小和最大分数。
216-
[标准化评分](#normalize-scoring)阶段之后,调度器将根据配置的插件权重
217-
合并所有插件的节点分数
254+
[标准化评分](#normalize-scoring)阶段之后,
255+
调度器将根据配置的插件权重合并所有插件的节点分数
218256

219257
<!--
220258
### NormalizeScore {#normalize-scoring}
@@ -280,13 +318,13 @@ NormalizeScore extension point.
280318
### Reserve {#reserve}
281319

282320
<!--
283-
A plugin that implements the Reserve extension has two methods, namely `Reserve`
321+
A plugin that implements the Reserve interface has two methods, namely `Reserve`
284322
and `Unreserve`, that back two informational scheduling phases called Reserve
285323
and Unreserve, respectively. Plugins which maintain runtime state (aka "stateful
286324
plugins") should use these phases to be notified by the scheduler when resources
287325
on a node are being reserved and unreserved for a given Pod.
288326
-->
289-
实现了 Reserve 扩展的插件,拥有两个方法,即 `Reserve``Unreserve`
327+
实现了 Reserve 接口的插件,拥有两个方法,即 `Reserve``Unreserve`
290328
他们分别支持两个名为 Reserve 和 Unreserve 的信息处理性质的调度阶段。
291329
维护运行时状态的插件(又称 "有状态插件")应该使用这两个阶段,
292330
以便在节点上的资源被保留和未保留给特定的 Pod 时得到调度器的通知。
@@ -360,7 +398,7 @@ _Permit_ 插件在每个 Pod 调度周期的最后调用,用于防止或延迟
360398
If any Permit plugin denies a Pod, it is returned to the scheduling queue.
361399
This will trigger the Unreserve phase in [Reserve plugins](#reserve).
362400
-->
363-
1. **拒绝** \
401+
2. **拒绝** \
364402
如果任何 Permit 插件拒绝 Pod,则该 Pod 将被返回到调度队列。
365403
这将触发 [Reserve 插件](#reserve)中的 Unreserve 阶段。
366404

@@ -372,7 +410,7 @@ _Permit_ 插件在每个 Pod 调度周期的最后调用,用于防止或延迟
372410
and the Pod is returned to the scheduling queue, triggering the
373411
Unreserve phase in [Reserve plugins](#reserve).
374412
-->
375-
1. **等待**(带有超时) \
413+
3. **等待**(带有超时)\
376414
如果一个 Permit 插件返回 “等待” 结果,则 Pod 将保持在一个内部的 “等待中”
377415
的 Pod 列表,同时该 Pod 的绑定周期启动时即直接阻塞直到得到批准。
378416
如果超时发生,**等待** 变成 **拒绝**,并且 Pod
@@ -384,7 +422,7 @@ While any plugin can access the list of "waiting" Pods and approve them
384422
(see [`FrameworkHandle`](https://git.k8s.io/enhancements/keps/sig-scheduling/624-scheduling-framework#frameworkhandle)), we expect only the permit
385423
plugins to approve binding of reserved Pods that are in "waiting" state. Once a Pod
386424
is approved, it is sent to the [PreBind](#pre-bind) phase.
387-
-->
425+
-->
388426
尽管任何插件可以访问 “等待中” 状态的 Pod 列表并批准它们
389427
(查看 [`FrameworkHandle`](https://git.k8s.io/enhancements/keps/sig-scheduling/624-scheduling-framework#frameworkhandle))。
390428
我们期望只有允许插件可以批准处于 “等待中” 状态的预留 Pod 的绑定。
@@ -402,15 +440,14 @@ example, a pre-bind plugin may provision a network volume and mount it on the
402440
target node before allowing the Pod to run there.
403441
-->
404442
这些插件用于执行 Pod 绑定前所需的所有工作。
405-
例如,一个 PreBind 插件可能需要制备网络卷并且在允许 Pod 运行在该节点之前
406-
将其挂载到目标节点上
443+
例如,一个 PreBind 插件可能需要制备网络卷并且在允许 Pod
444+
运行在该节点之前将其挂载到目标节点上
407445

408446
<!--
409447
If any PreBind plugin returns an error, the Pod is [rejected](#reserve) and
410448
returned to the scheduling queue.
411449
-->
412-
如果任何 PreBind 插件返回错误,则 Pod 将被 [拒绝](#reserve) 并且
413-
退回到调度队列中。
450+
如果任何 PreBind 插件返回错误,则 Pod 将被[拒绝](#reserve)并且退回到调度队列中。
414451

415452
<!--
416453
### Bind
@@ -434,11 +471,11 @@ Bind 插件用于将 Pod 绑定到节点上。直到所有的 PreBind 插件都
434471
### PostBind {#post-bind}
435472

436473
<!--
437-
This is an informational extension point. Post-bind plugins are called after a
474+
This is an informational interface. Post-bind plugins are called after a
438475
Pod is successfully bound. This is the end of a binding cycle, and can be used
439476
to clean up associated resources.
440477
-->
441-
这是个信息性的扩展点
478+
这是个信息性的接口
442479
PostBind 插件在 Pod 成功绑定后被调用。这是绑定周期的结尾,可用于清理相关的资源。
443480

444481
<!--
@@ -464,7 +501,7 @@ Plugins that use this extension point usually should also use
464501
<!--
465502
## Plugin API
466503
-->
467-
## 插件 API
504+
## 插件 API {#plugin-api}
468505

469506
<!--
470507
There are two steps to the plugin API. First, plugins must register and get
@@ -495,24 +532,24 @@ type PreFilterPlugin interface {
495532
<!--
496533
## Plugin configuration
497534
-->
498-
## 插件配置
535+
## 插件配置 {#plugin-configuration}
499536

500537
<!--
501538
You can enable or disable plugins in the scheduler configuration. If you are using
502539
Kubernetes v1.18 or later, most scheduling
503540
[plugins](/docs/reference/scheduling/config/#scheduling-plugins) are in use and
504541
enabled by default.
505-
-->
542+
-->
506543
你可以在调度器配置中启用或禁用插件。
507-
如果你在使用 Kubernetes v1.18 或更高版本,大部分调度
508-
[插件](/zh-cn/docs/reference/scheduling/config/#scheduling-plugins)
544+
如果你在使用 Kubernetes v1.18 或更高版本,
545+
大部分调度[插件](/zh-cn/docs/reference/scheduling/config/#scheduling-plugins)
509546
都在使用中且默认启用。
510547

511548
<!--
512549
In addition to default plugins, you can also implement your own scheduling
513550
plugins and get them configured along with default plugins. You can visit
514551
[scheduler-plugins](https://github.com/kubernetes-sigs/scheduler-plugins) for more details.
515-
-->
552+
-->
516553
除了默认的插件,你还可以实现自己的调度插件并且将它们与默认插件一起配置。
517554
你可以访问 [scheduler-plugins](https://github.com/kubernetes-sigs/scheduler-plugins)
518555
了解更多信息。
@@ -521,7 +558,7 @@ plugins and get them configured along with default plugins. You can visit
521558
If you are using Kubernetes v1.18 or later, you can configure a set of plugins as
522559
a scheduler profile and then define multiple profiles to fit various kinds of workload.
523560
Learn more at [multiple profiles](/docs/reference/scheduling/config/#multiple-profiles).
524-
-->
525-
如果你正在使用 Kubernetes v1.18 或更高版本,你可以将一组插件设置为
526-
一个调度器配置文件,然后定义不同的配置文件来满足各类工作负载。
561+
-->
562+
如果你正在使用 Kubernetes v1.18 或更高版本,你可以将一组插件设置为一个调度器配置文件,
563+
然后定义不同的配置文件来满足各类工作负载。
527564
了解更多关于[多配置文件](/zh-cn/docs/reference/scheduling/config/#multiple-profiles)

0 commit comments

Comments
 (0)