DeviceTaintRule v1alpha3
apiVersion: resource.k8s.io/v1alpha3
import "k8s.io/api/resource/v1alpha3"
DeviceTaintRule
DeviceTaintRule 添加一个污点到与选择算符匹配的所有设备上。 这与通过 DRA 驱动直接在 ResourceSlice 中指定污点具有同样的效果。
apiVersion: resource.k8s.io/v1alpha3
kind: DeviceTaintRule
metadata (ObjectMeta)
标准的对象元数据。
spec (DeviceTaintRuleSpec),必需
spec 指定选择算符和一个污点。
自动更改 spec 会让 metadata.generation 数值加一。
DeviceTaintRuleSpec
DeviceTaintRuleSpec 指定选择算符和一个污点。
taint (DeviceTaint),必需
应用到匹配设备的污点。
挂接了此污点的设备会对任何不容忍此污点的申领产生“影响”,并通过此申领影响使用申领的 Pod。
taint.effect (string),必需
对不容忍此污点的申领及使用此申领的 Pod 所产生的影响。 有效值包括
NoSchedule和NoExecute。 节点上常用的PreferNoSchedule在此无效。taint.key (string),必需
应用到某设备的污点键。必须是标签名称。
deviceSelector (DeviceTaintSelector)
deviceSelector 定义污点应用到哪些设备上。 对于要匹配的设备,必须满足所有选择算符条件。 空选择算符匹配所有设备。如果没有选择算符,则不匹配任何设备。
DeviceTaintSelector 定义 DeviceTaintRule 应用到哪些设备。 空选择算符匹配所有设备。如果没有选择算符,则不匹配任何设备。
deviceSelector.device (string)
如果设置了 device,则仅选择具有该名称的设备。 此字段对应
slice.spec.devices[].name。为避免歧义,也可以设置 driver 和 pool,但不是必需的。
deviceSelector.deviceClassName (string)
如果设置了 deviceClassName,则设备必须满足其中定义的选择算符条件才会被选中。 此字段对应
class.metadata.name。
deviceSelector.driver (string)
如果设置了 driver,则仅选择来自该驱动的设备。此字段对应于
slice.spec.driver。deviceSelector.pool (string)
如果设置了 pool,则仅选择属于该资源池的设备。
同时设置 driver 名称可能有助于避免不同驱动使用相同的池名称所带来的歧义,但这不是必需的。 因为从不同驱动中选择池也是有意义的,例如当使用节点本地设备的驱动以节点名称作为 pool 名称时。
deviceSelector.selectors ([]DeviceSelector)
原子性:将在合并期间被替换
selectors 包含与 ResourceClaim 相同的选择条件。目前支持 CEL 表达式。 必须满足所有这些选择算符。
deviceSelector.selectors.cel (CELDeviceSelector)
cel 包含一个用于选择设备的 CEL 表达式。
CELDeviceSelector 包含一个用于选择设备的 CEL 表达式。
deviceSelector.selectors.cel.expression (string),必需
expression 是一个 CEL 表达式,用于评估单个设备。 当被考虑的设备满足所需条件时,表达式的求值结果必须为 true;当不满足时,结果应为 false。 任何其他结果都是错误,会导致设备分配中止。
表达式的输入是一个名为 "device" 的对象,具有以下属性:
- driver (string):定义此设备的驱动的名称。
- attributes (map[string]object):设备的属性,按前缀分组 (例如,device.attributes["dra.example.com"] 评估为一个对象,包含所有以 "dra.example.com" 为前缀的属性。)
- capacity (map[string]object):设备的容量,按前缀分组。
示例:考虑一个驱动为 "dra.example.com" 的设备,它暴露两个名为 "model" 和 "ext.example.com/family" 的属性,并且暴露一个名为 "modules" 的容量。此表达式的输入将具有以下字段:
device.driver device.attributes["dra.example.com"].model device.attributes["ext.example.com"].family device.capacity["dra.example.com"].modulesdevice.driver字段可用于检查特定驱动,既可以作为高层次的前提条件(即你只想考虑来自此驱动的设备), 也可以作为考虑来自不同驱动的设备的多子句表达式的一部分。attribute 中每个元素的值类型由设备定义,编写这些表达式的用户必须查阅其特定驱动的文档。 capacity 中元素的值类型为 Quantity。
如果在
device.attributes或device.capacity中使用未知前缀进行查找, 将返回一个空映射。对未知字段的任何引用将导致评估错误和分配中止。一个健壮的表达式应在引用属性之前检查其是否存在。
为了方便使用,
cel.bind()函数被启用,此函数可用于简化访问同一域的多个属性的表达式。例如:cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool)此表达式的长度必须小于或等于 10 Ki。其求值的计算成本也会根据预估的逻辑步骤数进行限制。
DeviceTaintRuleList
DeviceTaintRuleList 是 DeviceTaintRules 的集合。
apiVersion: resource.k8s.io/v1alpha3
kind: DeviceTaintRuleList
metadata (ListMeta)
标准的列表元数据。
items ([]DeviceTaintRule),必需
items 是 DeviceTaintRules 的列表。
操作
get 读取指定的 DeviceTaintRule
HTTP 请求
GET /apis/resource.k8s.io/v1alpha3/devicetaintrules/{name}
参数
name (路径参数): string,必需
DeviceTaintRule 的名称。
pretty (查询参数): string
响应
200 (DeviceTaintRule): OK
401: Unauthorized
list 列举或监视类别为 DeviceTaintRule 的对象
HTTP 请求
GET /apis/resource.k8s.io/v1alpha3/devicetaintrules
参数
allowWatchBookmarks (查询参数): boolean
continue (查询参数): string
fieldSelector (查询参数): string
labelSelector (查询参数): string
limit (查询参数): integer
pretty (查询参数): string
resourceVersion (查询参数): string
resourceVersionMatch (查询参数): string
sendInitialEvents (查询参数): boolean
timeoutSeconds (查询参数): integer
watch (查询参数): boolean
响应
200 (DeviceTaintRuleList): OK
401: Unauthorized
create 创建 DeviceTaintRule
HTTP 请求
POST /apis/resource.k8s.io/v1alpha3/devicetaintrules
参数
body: DeviceTaintRule,必需
dryRun (查询参数): string
fieldManager (查询参数): string
fieldValidation (查询参数): string
pretty (查询参数): string
响应
200 (DeviceTaintRule): OK
201 (DeviceTaintRule): Created
202 (DeviceTaintRule): Accepted
401: Unauthorized
update 替换指定的 DeviceTaintRule
HTTP 请求
PUT /apis/resource.k8s.io/v1alpha3/devicetaintrules/{name}
参数
name (路径参数): string,必需
DeviceTaintRule 的名称。
body: DeviceTaintRule,必需
dryRun (查询参数): string
fieldManager (查询参数): string
fieldValidation (查询参数): string
pretty (查询参数): string
响应
200 (DeviceTaintRule): OK
201 (DeviceTaintRule): Created
401: Unauthorized
patch 部分更新指定的 DeviceTaintRule
HTTP 请求
PATCH /apis/resource.k8s.io/v1alpha3/devicetaintrules/{name}
参数
name (路径参数): string,必需
DeviceTaintRule 的名称。
body: Patch,必需
dryRun (查询参数): string
fieldManager (查询参数): string
fieldValidation (查询参数): string
force (查询参数): boolean
pretty (查询参数): string
响应
200 (DeviceTaintRule): OK
201 (DeviceTaintRule): Created
401: Unauthorized
delete 删除 DeviceTaintRule
HTTP 请求
DELETE /apis/resource.k8s.io/v1alpha3/devicetaintrules/{name}
参数
name (路径参数): string,必需
DeviceTaintRule 的名称。
body: DeleteOptions
dryRun (查询参数): string
gracePeriodSeconds (查询参数): integer
ignoreStoreReadErrorWithClusterBreakingPotential (查询参数): boolean
pretty (查询参数): string
propagationPolicy (查询参数): string
响应
200 (DeviceTaintRule): OK
202 (DeviceTaintRule): Accepted
401: Unauthorized
deletecollection 删除 DeviceTaintRule 的集合
HTTP 请求
DELETE /apis/resource.k8s.io/v1alpha3/devicetaintrules
参数
body: DeleteOptions
continue (查询参数): string
dryRun (查询参数): string
fieldSelector (查询参数): string
gracePeriodSeconds (查询参数): integer
ignoreStoreReadErrorWithClusterBreakingPotential (查询参数): boolean
labelSelector (查询参数): string
limit (查询参数): integer
pretty (查询参数): string
propagationPolicy (查询参数): string
resourceVersion (查询参数): string
resourceVersionMatch (查询参数): string
sendInitialEvents (查询参数): boolean
timeoutSeconds (查询参数): integer
响应
200 (Status): OK
401: Unauthorized