DeviceClass v1beta1
apiVersion: resource.k8s.io/v1beta1
import "k8s.io/api/resource/v1beta1"
DeviceClass
DeviceClass 是一種供應商或管理員提供的資源,其中包含裝置組態和選擇器。它可以在宣告的裝置請求中引用,以套用這些預設設定。叢集範圍。
這是 Alpha 類型,需要啟用 DynamicResourceAllocation 功能閘道。
apiVersion: resource.k8s.io/v1beta1
kind: DeviceClass
metadata (ObjectMeta)
標準物件中繼資料
spec (DeviceClassSpec), 必要
Spec 定義可以分配什麼以及如何設定它。
這是可變的。消費者必須隨時準備好類別變更,無論是因為它們被更新還是被取代。宣告分配是在分配時根據類別中設定的任何內容完成一次。
變更 spec 會自動遞增 metadata.generation 數字。
DeviceClassSpec
DeviceClassSpec 用於 [DeviceClass] 中,以定義可以分配什麼以及如何設定它。
config ([]DeviceClassConfiguration)
Atomic:將在合併期間取代
Config 定義適用於透過此類別宣告的每個裝置的組態參數。某些類別可能可以由多個驅動程式滿足,因此供應商組態的每個執行個體都適用於正好一個驅動程式。
它們會傳遞給驅動程式,但在分配宣告時不會被考慮。
DeviceClassConfiguration 用於 DeviceClass 中。
config.opaque (OpaqueDeviceConfiguration)
Opaque 提供驅動程式特定的組態參數。
OpaqueDeviceConfiguration 包含驅動程式的組態參數,格式由驅動程式供應商定義。
config.opaque.driver (字串), 必要
Driver 用於判斷需要將這些組態參數傳遞給哪個 kubelet 外掛程式。
驅動程式開發人員提供的許可策略可以使用此來決定是否需要驗證它們。
必須是 DNS 子網域,並且應以驅動程式供應商擁有的 DNS 網域結尾。
config.opaque.parameters (RawExtension), 必要
Parameters 可以包含任意資料。驅動程式開發人員有責任處理驗證和版本控制。通常,這包括自我識別和版本 ("kind" + "apiVersion" 用於 Kubernetes 類型),以及不同版本之間的轉換。
若要使用此功能,請在您的外部版本化結構中建立一個以 RawExtension 作為其類型的欄位,並在您的內部結構中建立 Object。您還需要註冊您的各種外掛程式類型。
// 內部套件
type MyAPIObject struct { runtime.TypeMeta
json:",inline"
MyPlugin runtime.Objectjson:"myPlugin"
}type PluginA struct { AOption string
json:"aOption"
}// 外部套件
type MyAPIObject struct { runtime.TypeMeta
json:",inline"
MyPlugin runtime.RawExtensionjson:"myPlugin"
}type PluginA struct { AOption string
json:"aOption"
}// 在網路上,JSON 將看起來像這樣
{ "kind":"MyAPIObject", "apiVersion":"v1", "myPlugin": { "kind":"PluginA", "aOption":"foo", }, }
所以會發生什麼事?Decode 首先使用 json 或 yaml 將序列化資料解組到您的外部 MyAPIObject 中。這會導致原始 JSON 被儲存,但不會解壓縮。下一步是複製 (使用 pkg/conversion) 到內部結構中。runtime 套件的 DefaultScheme 安裝了轉換函數,這些函數將解壓縮儲存在 RawExtension 中的 JSON,將其轉換為正確的物件類型,並將其儲存在 Object 中。(TODO:如果物件是未知類型,則會建立並儲存 runtime.Unknown 物件。)*
selectors ([]DeviceSelector)
Atomic:將在合併期間取代
每個選擇器都必須由透過此類別宣告的裝置滿足。
selectors.cel (CELDeviceSelector)
CEL 包含用於選擇裝置的 CEL 表達式。
CELDeviceSelector 包含用於選擇裝置的 CEL 表達式。
selectors.cel.expression (字串), 必要
Expression 是一個 CEL 表達式,用於評估單個裝置。當正在考慮的裝置滿足所需條件時,它必須評估為 true;當不滿足時,它必須評估為 false。任何其他結果都是錯誤,並導致中止裝置分配。
表達式的輸入是一個名為 "device" 的物件,它攜帶以下屬性
- driver (字串):定義此裝置的驅動程式名稱。
- 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"].modules
device.driver 欄位可用於檢查特定驅動程式,既可以作為高階先決條件 (即,您只想考慮來自此驅動程式的裝置),也可以作為旨在考慮來自不同驅動程式的裝置的多子句表達式的一部分。
每個屬性的值類型由裝置定義定義,撰寫這些表達式的使用者必須查閱其特定驅動程式的文件。每個容量的值類型為 Quantity。
如果未知的前綴詞被用來查詢 device.attributes 或 device.capacity,將會回傳一個空的映射表。任何對未知欄位的引用都會導致評估錯誤並中止分配。
一個穩健的表達式應該在引用屬性之前檢查它們是否存在。
為了方便使用,cel.bind() 函數已被啟用,並且可以用於簡化訪問相同網域的多個屬性的表達式。例如
cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool)
suitableNodes (節點選擇器 NodeSelector)
只有符合此選擇器的節點,才會在排程器嘗試尋找適合 Pod 的節點時被考慮,當該 Pod 使用尚未分配的聲明,且該聲明是透過控制平面控制器分配時。如果聲明未使用控制平面控制器進行分配,則會忽略此設定。
設定此欄位是選填的。如果未設定,則所有節點都是候選節點。
這是一個 alpha 欄位,需要啟用 DRAControlPlaneController 功能閘道。
節點選擇器代表一組節點上一個或多個標籤查詢結果的聯集;也就是說,它代表由節點選擇器術語所代表的選擇器的 OR 運算。
suitableNodes.nodeSelectorTerms ([]NodeSelectorTerm), 必填
Atomic:將在合併期間取代
必填。節點選擇器術語的列表。這些術語之間是 OR 關係。
一個 null 或空的節點選擇器術語不匹配任何物件。它們的需求之間是 AND 關係。TopologySelectorTerm 類型實作了 NodeSelectorTerm 的子集。
suitableNodes.nodeSelectorTerms.matchExpressions ([]NodeSelectorRequirement)
Atomic:將在合併期間取代
依節點標籤的節點選擇器需求列表。
suitableNodes.nodeSelectorTerms.matchFields ([]NodeSelectorRequirement)
Atomic:將在合併期間取代
依節點欄位的節點選擇器需求列表。
DeviceClassList
DeviceClassList 是類別的集合。
apiVersion: resource.k8s.io/v1beta1
種類 (kind): DeviceClassList
metadata (ListMeta)
標準列表元數據
items ([]DeviceClass), 必填
Items 是資源類別的列表。
操作 (Operations)
get
讀取指定的 DeviceClass
HTTP 請求 (HTTP Request)
GET /apis/resource.k8s.io/v1beta1/deviceclasses/{name}
參數 (Parameters)
name (在路徑中 in path): 字串 (string), 必填
DeviceClass 的名稱
pretty (在查詢中 in query): 字串 (string)
回應 (Response)
200 (DeviceClass): OK (成功)
401: Unauthorized (未授權)
list
列出或監看 DeviceClass 種類的物件
HTTP 請求 (HTTP Request)
GET /apis/resource.k8s.io/v1beta1/deviceclasses
參數 (Parameters)
allowWatchBookmarks (在查詢中 in query): 布林值 (boolean)
continue (在查詢中 in query): 字串 (string)
fieldSelector (在查詢中 in query): 字串 (string)
labelSelector (在查詢中 in query): 字串 (string)
limit (在查詢中 in query): 整數 (integer)
pretty (在查詢中 in query): 字串 (string)
resourceVersion (在查詢中 in query): 字串 (string)
resourceVersionMatch (在查詢中 in query): 字串 (string)
sendInitialEvents (在查詢中 in query): 布林值 (boolean)
timeoutSeconds (在查詢中 in query): 整數 (integer)
watch (在查詢中 in query): 布林值 (boolean)
回應 (Response)
200 (DeviceClassList): OK (成功)
401: Unauthorized (未授權)
create
建立 DeviceClass
HTTP 請求 (HTTP Request)
POST /apis/resource.k8s.io/v1beta1/deviceclasses
參數 (Parameters)
body: DeviceClass, 必填
dryRun (在查詢中 in query): 字串 (string)
fieldManager (在查詢中 in query): 字串 (string)
fieldValidation (在查詢中 in query): 字串 (string)
pretty (在查詢中 in query): 字串 (string)
回應 (Response)
200 (DeviceClass): OK (成功)
201 (DeviceClass): Created (已建立)
202 (DeviceClass): Accepted (已接受)
401: Unauthorized (未授權)
update
取代指定的 DeviceClass
HTTP 請求 (HTTP Request)
PUT /apis/resource.k8s.io/v1beta1/deviceclasses/{name}
參數 (Parameters)
name (在路徑中 in path): 字串 (string), 必填
DeviceClass 的名稱
body: DeviceClass, 必填
dryRun (在查詢中 in query): 字串 (string)
fieldManager (在查詢中 in query): 字串 (string)
fieldValidation (在查詢中 in query): 字串 (string)
pretty (在查詢中 in query): 字串 (string)
回應 (Response)
200 (DeviceClass): OK (成功)
201 (DeviceClass): Created (已建立)
401: Unauthorized (未授權)
patch
部分更新指定的 DeviceClass
HTTP 請求 (HTTP Request)
PATCH /apis/resource.k8s.io/v1beta1/deviceclasses/{name}
參數 (Parameters)
name (在路徑中 in path): 字串 (string), 必填
DeviceClass 的名稱
body: Patch, 必填
dryRun (在查詢中 in query): 字串 (string)
fieldManager (在查詢中 in query): 字串 (string)
fieldValidation (在查詢中 in query): 字串 (string)
force (在查詢中 in query): 布林值 (boolean)
pretty (在查詢中 in query): 字串 (string)
回應 (Response)
200 (DeviceClass): OK (成功)
201 (DeviceClass): Created (已建立)
401: Unauthorized (未授權)
delete
刪除 DeviceClass
HTTP 請求 (HTTP Request)
DELETE /apis/resource.k8s.io/v1beta1/deviceclasses/{name}
參數 (Parameters)
name (在路徑中 in path): 字串 (string), 必填
DeviceClass 的名稱
body: DeleteOptions
dryRun (在查詢中 in query): 字串 (string)
gracePeriodSeconds (在查詢中 in query): 整數 (integer)
pretty (在查詢中 in query): 字串 (string)
propagationPolicy (在查詢中 in query): 字串 (string)
回應 (Response)
200 (DeviceClass): OK (成功)
202 (DeviceClass): Accepted (已接受)
401: Unauthorized (未授權)
deletecollection
刪除 DeviceClass 的集合
HTTP 請求 (HTTP Request)
DELETE /apis/resource.k8s.io/v1beta1/deviceclasses
參數 (Parameters)
body: DeleteOptions
continue (在查詢中 in query): 字串 (string)
dryRun (在查詢中 in query): 字串 (string)
fieldSelector (在查詢中 in query): 字串 (string)
gracePeriodSeconds (在查詢中 in query): 整數 (integer)
labelSelector (在查詢中 in query): 字串 (string)
limit (在查詢中 in query): 整數 (integer)
pretty (在查詢中 in query): 字串 (string)
propagationPolicy (在查詢中 in query): 字串 (string)
resourceVersion (在查詢中 in query): 字串 (string)
resourceVersionMatch (在查詢中 in query): 字串 (string)
sendInitialEvents (在查詢中 in query): 布林值 (boolean)
timeoutSeconds (在查詢中 in query): 整數 (integer)
回應 (Response)
200 (Status): OK (成功)
401: Unauthorized (未授權)
此頁面為自動生成。
如果您計劃回報此頁面的問題,請在您的問題描述中提及此頁面為自動生成。修正可能需要在 Kubernetes 專案的其他地方進行。