Skip to content

Commit 5331be5

Browse files
authored
Merge pull request #55579 from my-git9/npp-1541
[zh-cn]sync device-class-v1
2 parents ca585d7 + 2de629b commit 5331be5

1 file changed

Lines changed: 59 additions & 42 deletions

File tree

content/zh-cn/docs/reference/kubernetes-api/extend-resources/device-class-v1.md

Lines changed: 59 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,10 @@ auto_generated: true
2828

2929
<!--
3030
DeviceClass is a vendor- or admin-provided resource that contains device configuration and selectors. It can be referenced in the device requests of a claim to apply these presets. Cluster scoped.
31-
32-
This is an alpha type and requires enabling the DynamicResourceAllocation feature gate.
3331
-->
3432
DeviceClass 是由供应商或管理员提供的资源,包含设备配置和选择算符。
3533
它可以在申领的设备请求中被引用,以应用预设值。作用域为集群范围。
3634

37-
这是一个 Alpha 阶段的资源类别,需要启用 DynamicResourceAllocation 特性门控。
38-
3935
<hr>
4036

4137
- **apiVersion**: resource.k8s.io/v1
@@ -174,7 +170,7 @@ DeviceClassSpec 在 DeviceClass 中用于定义可被分配的资源以及如何
174170
runtime.TypeMeta `json:",inline"`
175171
MyPlugin runtime.Object `json:"myPlugin"`
176172
}
177-
173+
178174
type PluginA struct {
179175
AOption string `json:"aOption"`
180176
}
@@ -196,7 +192,7 @@ DeviceClassSpec 在 DeviceClass 中用于定义可被分配的资源以及如何
196192
AOption string `json:"aOption"`
197193
}
198194
```
199-
195+
200196
<!--
201197
// On the wire, the JSON will look something like this:
202198
-->
@@ -229,7 +225,7 @@ DeviceClassSpec 在 DeviceClass 中用于定义可被分配的资源以及如何
229225
230226
ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.
231227
232-
This is an alpha field.
228+
This is an beta field.
233229
-->
234230
- **extendedResourceName** (string)
235231

@@ -238,7 +234,7 @@ DeviceClassSpec 在 DeviceClass 中用于定义可被分配的资源以及如何
238234
在一个集群中,它应当是唯一的。如果两个设备类具有相同的名称,则后创建的设备类将用于满足 Pod 的扩展资源请求。
239235
如果两个类被同时创建,则选择名称按字母排序后位于前面的类。
240236

241-
这是 Alpha 字段。
237+
这是 Beta 字段。
242238

243239
<!--
244240
- **selectors** ([]DeviceSelector)
@@ -308,7 +304,7 @@ DeviceClassSpec 在 DeviceClass 中用于定义可被分配的资源以及如何
308304
- capacity (map[string]object):设备的容量,按前缀分组。
309305
- allowMultipleAllocations (bool):设备的 allowMultipleAllocations 属性
310306
(在 v1.34+ 中随 DRAConsumableCapacity 特性启用)。
311-
307+
312308
示例:考虑一个驱动为 "dra.example.com" 的设备,它暴露两个名为
313309
"model" 和 "ext.example.com/family" 的属性,
314310
并且暴露一个名为 "modules" 的容量。此表达式的输入将具有以下字段:
@@ -319,37 +315,49 @@ DeviceClassSpec 在 DeviceClass 中用于定义可被分配的资源以及如何
319315
device.attributes["ext.example.com"].family
320316
device.capacity["dra.example.com"].modules
321317
```
322-
318+
323319
<!--
324320
The device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.
325-
321+
326322
The value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.
327323
-->
328324
329325
`device.driver` 字段可用于检查特定驱动,既可以作为高层次的前提条件(即你只想考虑来自此驱动的设备),
330326
也可以作为考虑来自不同驱动的设备的多子句表达式的一部分。
331-
327+
332328
`attribute` 中每个元素的值类型由设备定义,编写这些表达式的用户必须查阅其特定驱动的文档。
333329
`capacity` 中元素的值类型为 Quantity。
334330
335331
<!--
336332
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.
337-
333+
338334
A robust expression should check for the existence of attributes before referencing them.
339335
340336
For ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:
341337
-->
342338
343339
如果在 `device.attributes` 或 `device.capacity` 中使用未知前缀进行查找,
344340
将返回一个空映射。对未知字段的任何引用将导致评估错误和分配中止。
345-
341+
346342
一个健壮的表达式应在引用属性之前检查其是否存在。
347343
348344
为了方便使用,`cel.bind()` 函数被启用,此函数可用于简化访问同一域的多个属性的表达式。例如:
349345
350346
```
351347
cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool)
352348
```
349+
350+
<!--
351+
When the DRAListTypeAttributes feature gate is enabled, the includes() helper is available and it can work for both scalar and list-type attributes. It was introduced to support smooth migration from scalar attributes to list-type attributes while keeping CEL expressions simple. For example:
352+
353+
device.attributes["dra.example.com"].models.includes("some-model")
354+
-->
355+
356+
启用 DRAListTypeAttributes 特性门控后,`includes()` 辅助函数即可使用,
357+
并且适用于标量属性和列表类型属性。引入此特性是为了支持从标量属性到列表类型属性的平滑迁移,
358+
同时保持 CEL 表达式的简洁性。例如:
359+
360+
`device.attributes["dra.example.com"].models.includes("some-model")`
353361
354362
<!--
355363
The length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.
@@ -389,17 +397,16 @@ DeviceClassList 是类的集合。
389397
390398
<!--
391399
## Operations {#Operations}
400+
-->
401+
## 操作 {#Operations}
392402
393403
<hr>
394404
405+
<!--
395406
### `get` read the specified DeviceClass
396407
397408
#### HTTP Request
398409
-->
399-
## 操作 {#Operations}
400-
401-
<hr>
402-
403410
### `get` 读取指定的 DeviceClass
404411
405412
#### HTTP 请求
@@ -440,17 +447,16 @@ GET /apis/resource.k8s.io/v1/deviceclasses/{name}
440447
### `list` list or watch objects of kind DeviceClass
441448
442449
#### HTTP Request
443-
444-
GET /apis/resource.k8s.io/v1/deviceclasses
445-
446-
#### Parameters
447450
-->
448451
### `list` 列举或监视 DeviceClass 类别的对象
449452
450453
#### HTTP 请求
451454
452455
GET /apis/resource.k8s.io/v1/deviceclasses
453456
457+
<!--
458+
#### Parameters
459+
-->
454460
#### 参数
455461
456462
<!--
@@ -490,6 +496,10 @@ GET /apis/resource.k8s.io/v1/deviceclasses
490496
491497
<a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents</a>
492498
499+
- **shardSelector** (*in query*): string
500+
501+
<a href="{{< ref "../common-parameters/common-parameters#shardSelector" >}}">shardSelector</a>
502+
493503
- **timeoutSeconds** (*in query*): integer
494504
495505
<a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds</a>
@@ -533,6 +543,10 @@ GET /apis/resource.k8s.io/v1/deviceclasses
533543
- **sendInitialEvents** (**查询参数**): boolean
534544
535545
<a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents</a>
546+
547+
- **shardSelector** (**查询参数**): string
548+
549+
<a href="{{< ref "../common-parameters/common-parameters#shardSelector" >}}">shardSelector</a>
536550
537551
- **timeoutSeconds** (**查询参数**): integer
538552
@@ -555,17 +569,16 @@ GET /apis/resource.k8s.io/v1/deviceclasses
555569
### `create` create a DeviceClass
556570
557571
#### HTTP Request
558-
559-
POST /apis/resource.k8s.io/v1/deviceclasses
560-
561-
#### Parameters
562572
-->
563573
### `create` 创建 DeviceClass
564574
565575
#### HTTP 请求
566576
567577
POST /apis/resource.k8s.io/v1/deviceclasses
568578
579+
<!--
580+
#### Parameters
581+
-->
569582
#### 参数
570583
571584
<!--
@@ -622,17 +635,16 @@ POST /apis/resource.k8s.io/v1/deviceclasses
622635
### `update` replace the specified DeviceClass
623636
624637
#### HTTP Request
625-
626-
PUT /apis/resource.k8s.io/v1/deviceclasses/{name}
627-
628-
#### Parameters
629638
-->
630639
### `update` 替换指定的 DeviceClass
631640
632641
#### HTTP 请求
633642
634643
PUT /apis/resource.k8s.io/v1/deviceclasses/{name}
635644
645+
<!--
646+
#### Parameters
647+
-->
636648
#### 参数
637649
638650
<!--
@@ -695,17 +707,16 @@ PUT /apis/resource.k8s.io/v1/deviceclasses/{name}
695707
### `patch` partially update the specified DeviceClass
696708
697709
#### HTTP Request
698-
699-
PATCH /apis/resource.k8s.io/v1/deviceclasses/{name}
700-
701-
#### Parameters
702710
-->
703711
### `patch` 部分更新指定的 DeviceClass
704712
705713
#### HTTP 请求
706714
707715
PATCH /apis/resource.k8s.io/v1/deviceclasses/{name}
708716
717+
<!--
718+
#### Parameters
719+
-->
709720
#### 参数
710721
711722
<!--
@@ -776,17 +787,16 @@ PATCH /apis/resource.k8s.io/v1/deviceclasses/{name}
776787
### `delete` delete a DeviceClass
777788
778789
#### HTTP Request
779-
780-
DELETE /apis/resource.k8s.io/v1/deviceclasses/{name}
781-
782-
#### Parameters
783790
-->
784791
### `delete` 删除 DeviceClass
785792
786793
#### HTTP 请求
787794
788795
DELETE /apis/resource.k8s.io/v1/deviceclasses/{name}
789796
797+
<!--
798+
#### Parameters
799+
-->
790800
#### 参数
791801
792802
<!--
@@ -857,17 +867,16 @@ DELETE /apis/resource.k8s.io/v1/deviceclasses/{name}
857867
### `deletecollection` delete collection of DeviceClass
858868
859869
#### HTTP Request
860-
861-
DELETE /apis/resource.k8s.io/v1/deviceclasses
862-
863-
#### Parameters
864870
-->
865871
### `deletecollection` 删除 DeviceClass 的集合
866872
867873
#### HTTP 请求
868874
869875
DELETE /apis/resource.k8s.io/v1/deviceclasses
870876
877+
<!--
878+
#### Parameters
879+
-->
871880
#### 参数
872881
873882
<!--
@@ -920,6 +929,10 @@ DELETE /apis/resource.k8s.io/v1/deviceclasses
920929
- **sendInitialEvents** (*in query*): boolean
921930
922931
<a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents</a>
932+
933+
- **shardSelector** (*in query*): string
934+
935+
<a href="{{< ref "../common-parameters/common-parameters#shardSelector" >}}">shardSelector</a>
923936
924937
- **timeoutSeconds** (*in query*): integer
925938
@@ -974,6 +987,10 @@ DELETE /apis/resource.k8s.io/v1/deviceclasses
974987
- **sendInitialEvents** (**查询参数**): boolean
975988
976989
<a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents</a>
990+
991+
- **shardSelector** (**查询参数**): string
992+
993+
<a href="{{< ref "../common-parameters/common-parameters#shardSelector" >}}">shardSelector</a>
977994
978995
- **timeoutSeconds** (**查询参数**): integer
979996

0 commit comments

Comments
 (0)