Skip to content

Commit 22e8730

Browse files
authored
Merge pull request #52979 from my-git9/npe-16729
[zh-cn]sync device-taint-rule-v1alpha3 node-selector-requirement
2 parents de8c33a + df58a54 commit 22e8730

File tree

2 files changed

+68
-38
lines changed

2 files changed

+68
-38
lines changed

content/zh-cn/docs/reference/kubernetes-api/common-definitions/node-selector-requirement.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,20 @@ A node selector requirement is a selector that contains values, a key, and an op
4646
- **operator** (string),必需
4747

4848
代表主键与值集之间的关系。合法的 operator 值包括 `In``NotIn``Exists``DoesNotExist``Gt``Lt`
49-
49+
50+
<!--
51+
Possible enum values:
52+
-->
53+
54+
可能的枚举值:
55+
56+
- `"DoesNotExist"`
57+
- `"Exists"`
58+
- `"Gt"`
59+
- `"In"`
60+
- `"Lt"`
61+
- `"NotIn"`
62+
5063
<!--
5164
- **values** ([]string)
5265
@@ -62,4 +75,3 @@ A node selector requirement is a selector that contains values, a key, and an op
6275
如果 operator 为 `Exists``DoesNotExist`,则 values 数组只能为空。
6376
如果 operator 为 `Gt``Lt`,则 values 数组只能包含一个元素,并且该元素会被解释为整数。
6477
在执行策略性合并补丁操作时,此数组会被整体替换。
65-

content/zh-cn/docs/reference/kubernetes-api/workload-resources/device-taint-rule-v1alpha3.md

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ DeviceTaintRule 添加一个污点到与选择算符匹配的所有设备上。
5555

5656
- **spec** (<a href="{{< ref "../workload-resources/device-taint-rule-v1alpha3#DeviceTaintRuleSpec" >}}">DeviceTaintRuleSpec</a>),必需
5757

58-
spec 指定选择算符和一个污点。
58+
`spec` 指定选择算符和一个污点。
5959

60-
自动更改 spec 会让 metadata.generation 数值加一。
60+
自动更改 `spec` 会让 `metadata.generation` 数值加一。
6161

6262
## DeviceTaintRuleSpec {#DeviceTaintRuleSpec}
6363

@@ -87,10 +87,6 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
8787
- **taint.effect** (string), required
8888
8989
The effect of the taint on claims that do not tolerate the taint and through such claims on the pods using them. Valid effects are NoSchedule and NoExecute. PreferNoSchedule as used for nodes is not valid here.
90-
91-
- **taint.key** (string), required
92-
93-
The taint key to be applied to a device. Must be a label name.
9490
-->
9591

9692
- **taint.effect** (string),必需
@@ -99,6 +95,25 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
9995
有效值包括 `NoSchedule``NoExecute`
10096
节点上常用的 `PreferNoSchedule` 在此无效。
10197

98+
<!--
99+
Possible enum values:
100+
- `"NoExecute"` Evict any already-running pods that do not tolerate the device taint.
101+
- `"NoSchedule"` Do not allow new pods to schedule which use a tainted device unless they tolerate the taint, but allow all pods submitted to Kubelet without going through the scheduler to start, and allow all already-running pods to continue running.
102+
-->
103+
104+
可能的枚举值:
105+
106+
- `"NoExecute"` 驱逐所有已经运行且不容忍设备污点的 Pod。
107+
- `"NoSchedule"` 不允许调度新的、使用存在污点设备的 Pod,除非它们能容忍该污点,
108+
但允许所有直接提交给 kubelet 而不通过调度器的 Pod 启动,
109+
并允许所有已经在运行的 Pod 继续运行。
110+
111+
<!--
112+
- **taint.key** (string), required
113+
114+
The taint key to be applied to a device. Must be a label name.
115+
-->
116+
102117
- **taint.key** (string),必需
103118

104119
应用到某设备的污点键。必须是标签名称。
@@ -118,11 +133,11 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
118133

119134
- **taint.timeAdded** (Time)
120135

121-
timeAdded 表示添加污点的时间。如果未设置,意味着在创建或更新期间自动添加。
136+
`timeAdded` 表示添加污点的时间。如果未设置,意味着在创建或更新期间自动添加。
122137

123138
<a name="Time"></a>
124-
**Time 是 `time.Time` 的包装器,它支持对 YAML 和 JSON 的正确编组。
125-
time 包的许多工厂方法提供了包装器。**
139+
**`Time``time.Time` 的包装器,它支持对 YAML 和 JSON 的正确编组。
140+
`time` 包的许多工厂方法提供了包装器。**
126141

127142
- **taint.value** (string)
128143

@@ -131,19 +146,19 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
131146
<!--
132147
- **deviceSelector** (DeviceTaintSelector)
133148
134-
DeviceSelector defines which device(s) the taint is applied to. All selector criteria must be satisfied for a device to match. The empty selector matches all devices. Without a selector, no devices are matches.
149+
DeviceSelector defines which device(s) the taint is applied to. All selector criteria must be satified for a device to match. The empty selector matches all devices. Without a selector, no devices are matches.
135150
136151
<a name="DeviceTaintSelector"></a>
137152
*DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. The empty selector matches all devices. Without a selector, no devices are matched.*
138153
-->
139154
- **deviceSelector** (DeviceTaintSelector)
140155

141-
deviceSelector 定义污点应用到哪些设备上。
156+
`deviceSelector` 定义污点应用到哪些设备上。
142157
对于要匹配的设备,必须满足所有选择算符条件。
143158
空选择算符匹配所有设备。如果没有选择算符,则不匹配任何设备。
144159

145160
<a name="DeviceTaintSelector"></a>
146-
**DeviceTaintSelector 定义 DeviceTaintRule 应用到哪些设备。
161+
**`DeviceTaintSelector` 定义 `DeviceTaintRule` 应用到哪些设备。
147162
空选择算符匹配所有设备。如果没有选择算符,则不匹配任何设备。**
148163

149164
<!--
@@ -160,14 +175,14 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
160175

161176
- **deviceSelector.device** (string)
162177

163-
如果设置了 device,则仅选择具有该名称的设备。
178+
如果设置了 `device`,则仅选择具有该名称的设备。
164179
此字段对应 `slice.spec.devices[].name`
165180

166-
为避免歧义,也可以设置 driver 和 pool,但不是必需的。
181+
为避免歧义,也可以设置 `driver``pool`,但不是必需的。
167182

168183
- **deviceSelector.deviceClassName** (string)
169184

170-
如果设置了 deviceClassName,则设备必须满足其中定义的选择算符条件才会被选中。
185+
如果设置了 `deviceClassName`,则设备必须满足其中定义的选择算符条件才会被选中。
171186
此字段对应 `class.metadata.name`
172187

173188
<!--
@@ -184,14 +199,14 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
184199

185200
- **deviceSelector.driver** (string)
186201

187-
如果设置了 driver,则仅选择来自该驱动的设备。此字段对应于 `slice.spec.driver`
202+
如果设置了 `driver`,则仅选择来自该驱动的设备。此字段对应于 `slice.spec.driver`
188203

189204
- **deviceSelector.pool** (string)
190205

191-
如果设置了 pool,则仅选择属于该资源池的设备。
206+
如果设置了 `pool`,则仅选择属于该资源池的设备。
192207

193-
同时设置 driver 名称可能有助于避免不同驱动使用相同的池名称所带来的歧义,但这不是必需的。
194-
因为从不同驱动中选择池也是有意义的,例如当使用节点本地设备的驱动以节点名称作为 pool 名称时。
208+
同时设置 `driver` 名称可能有助于避免不同驱动使用相同的池名称所带来的歧义,但这不是必需的。
209+
因为从不同驱动中选择池也是有意义的,例如当使用节点本地设备的驱动以节点名称作为 `pool` 名称时。
195210

196211
<!--
197212
- **deviceSelector.selectors** ([]DeviceSelector)
@@ -208,11 +223,11 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
208223

209224
**原子性:将在合并期间被替换**
210225

211-
selectors 包含与 ResourceClaim 相同的选择条件。目前支持 CEL 表达式
212-
必须满足所有这些选择算符。
226+
`selectors` 包含与 ResourceClaim 相同的选择条件。
227+
目前支持 CEL 表达式。必须满足所有这些选择算符。
213228

214229
<a name="DeviceSelector"></a>
215-
**DeviceSelector 必须有且仅有一个字段被设置。**
230+
**`DeviceSelector` 必须有且仅有一个字段被设置。**
216231

217232
<!--
218233
- **deviceSelector.selectors.cel** (CELDeviceSelector)
@@ -225,10 +240,10 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
225240

226241
- **deviceSelector.selectors.cel** (CELDeviceSelector)
227242

228-
cel 包含一个用于选择设备的 CEL 表达式。
243+
`cel` 包含一个用于选择设备的 CEL 表达式。
229244

230245
<a name="CELDeviceSelector"></a>
231-
**CELDeviceSelector 包含一个用于选择设备的 CEL 表达式。**
246+
**`CELDeviceSelector` 包含一个用于选择设备的 CEL 表达式。**
232247

233248
<!--
234249
- **deviceSelector.selectors.cel.expression** (string), required
@@ -238,9 +253,9 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
238253

239254
- **deviceSelector.selectors.cel.expression** (string),必需
240255

241-
expression 是一个 CEL 表达式,用于评估单个设备。
242-
当被考虑的设备满足所需条件时,表达式的求值结果必须为 true;当不满足时,结果应为 false。
243-
任何其他结果都是错误,会导致设备分配中止。
256+
`expression` 是一个 CEL 表达式,用于评估单个设备。
257+
当被考虑的设备满足所需条件时,表达式的求值结果必须为 `true`;当不满足时,
258+
结果应为 `false`任何其他结果都是错误,会导致设备分配中止。
244259

245260
<!--
246261
The expression's input is an object named "device", which carries the following properties:
@@ -253,17 +268,19 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
253268

254269
表达式的输入是一个名为 "device" 的对象,具有以下属性:
255270

256-
- driver (string):定义此设备的驱动的名称。
257-
- attributes (map[string]object):设备的属性,按前缀分组
258-
(例如,device.attributes["dra.example.com"] 评估为一个对象,包含所有以 "dra.example.com" 为前缀的属性。)
259-
- capacity (map[string]object):设备的容量,按前缀分组。
271+
- `driver` (string):定义此设备的驱动的名称。
272+
- `attributes` (map[string]object):设备的属性,按前缀分组
273+
(例如,`device.attributes["dra.example.com"]` 评估为一个对象,包含所有以
274+
"dra.example.com" 为前缀的属性。)
275+
- `capacity` (map[string]object):设备的容量,按前缀分组。
260276

261277
<!--
262278
Example: Consider a device with driver="dra.example.com", which exposes two attributes named "model" and "ext.example.com/family" and which exposes one capacity named "modules". This input to this expression would have the following fields:
263279
-->
264280

265281
示例:考虑一个驱动为 "dra.example.com" 的设备,它暴露两个名为 "model" 和
266-
"ext.example.com/family" 的属性,并且暴露一个名为 "modules" 的容量。此表达式的输入将具有以下字段:
282+
"ext.example.com/family" 的属性,并且暴露一个名为 "modules" 的容量。
283+
此表达式的输入将具有以下字段:
267284

268285
```
269286
device.driver
@@ -281,8 +298,8 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
281298
`device.driver` 字段可用于检查特定驱动,既可以作为高层次的前提条件(即你只想考虑来自此驱动的设备),
282299
也可以作为考虑来自不同驱动的设备的多子句表达式的一部分。
283300
284-
attribute 中每个元素的值类型由设备定义,编写这些表达式的用户必须查阅其特定驱动的文档。
285-
capacity 中元素的值类型为 Quantity。
301+
`attribute` 中每个元素的值类型由设备定义,编写这些表达式的用户必须查阅其特定驱动的文档。
302+
`capacity` 中元素的值类型为 Quantity。
286303
287304
<!--
288305
If an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.
@@ -297,7 +314,8 @@ DeviceTaintRuleSpec 指定选择算符和一个污点。
297314
298315
一个健壮的表达式应在引用属性之前检查其是否存在。
299316
300-
为了方便使用,`cel.bind()` 函数被启用,此函数可用于简化访问同一域的多个属性的表达式。例如:
317+
为了方便使用,`cel.bind()` 函数被启用,此函数可用于简化访问同一域的多个属性的表达式。
318+
例如:
301319
302320
```
303321
cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool)
@@ -337,7 +355,7 @@ DeviceTaintRuleList 是 DeviceTaintRules 的集合。
337355
338356
- **items** ([]<a href="{{< ref "../workload-resources/device-taint-rule-v1alpha3#DeviceTaintRule" >}}">DeviceTaintRule</a>),必需
339357
340-
items 是 DeviceTaintRules 的列表。
358+
`items` 是 DeviceTaintRules 的列表。
341359
342360
<!--
343361
## Operations {#Operations}

0 commit comments

Comments
 (0)