1package v1alpha3
2
3import "cue.dev/x/k8s.io/apimachinery/pkg/apis/meta/v1"
4
5// The device this taint is attached to has the "effect" on any claim which does
6// not tolerate the taint and, through the claim, to pods using the claim.
7#DeviceTaint: {
8 // The effect of the taint on claims that do not tolerate the taint and through
9 // such claims on the pods using them.
10 //
11 // Valid effects are None, NoSchedule and NoExecute. PreferNoSchedule as used
12 // for nodes is not valid here. More effects may get added in the future.
13 // Consumers must treat unknown effects like None.
14 "effect"!: string
15
16 // The taint key to be applied to a device. Must be a label name.
17 "key"!: string
18
19 // TimeAdded represents the time at which the taint was added or (only in a
20 // DeviceTaintRule) the effect was modified. Added automatically during create
21 // or update if not set.
22 //
23 // In addition, in a DeviceTaintRule a value provided during an update gets
24 // replaced with the current time if the provided value is the same as the old
25 // one and the new effect is different. Changing the key and/or value while
26 // keeping the effect unchanged is possible and does not update the time stamp
27 // because the eviction which uses it is either already started (NoExecute) or
28 // not started yet (NoEffect, NoSchedule).
29 "timeAdded"?: v1.#Time
30
31 // The taint value corresponding to the taint key. Must be a label value.
32 "value"?: string
33}
34
35// DeviceTaintRule adds one taint to all devices which match the selector. This
36// has the same effect as if the taint was specified directly in the
37// ResourceSlice by the DRA driver.
38#DeviceTaintRule: {
39 // APIVersion defines the versioned schema of this representation of an object.
40 // Servers should convert recognized schemas to the latest internal value, and
41 // may reject unrecognized values. More info:
42 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
43 "apiVersion": "resource.k8s.io/v1alpha3"
44
45 // Kind is a string value representing the REST resource this object represents.
46 // Servers may infer this from the endpoint the client submits requests to.
47 // Cannot be updated. In CamelCase. More info:
48 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
49 "kind": "DeviceTaintRule"
50
51 // Standard object metadata
52 "metadata"?: v1.#ObjectMeta
53
54 // Spec specifies the selector and one taint.
55 //
56 // Changing the spec automatically increments the metadata.generation number.
57 "spec"!: #DeviceTaintRuleSpec
58
59 // Status provides information about what was requested in the spec.
60 "status"?: #DeviceTaintRuleStatus
61}
62
63// DeviceTaintRuleList is a collection of DeviceTaintRules.
64#DeviceTaintRuleList: {
65 // APIVersion defines the versioned schema of this representation of an object.
66 // Servers should convert recognized schemas to the latest internal value, and
67 // may reject unrecognized values. More info:
68 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
69 "apiVersion": "resource.k8s.io/v1alpha3"
70
71 // Items is the list of DeviceTaintRules.
72 "items"!: [...#DeviceTaintRule]
73
74 // Kind is a string value representing the REST resource this object represents.
75 // Servers may infer this from the endpoint the client submits requests to.
76 // Cannot be updated. In CamelCase. More info:
77 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
78 "kind": "DeviceTaintRuleList"
79
80 // Standard list metadata
81 "metadata"?: v1.#ListMeta
82}
83
84// DeviceTaintRuleSpec specifies the selector and one taint.
85#DeviceTaintRuleSpec: {
86 // DeviceSelector defines which device(s) the taint is applied to. All selector
87 // criteria must be satisfied for a device to match. The empty selector matches
88 // all devices. Without a selector, no devices are matches.
89 "deviceSelector"?: #DeviceTaintSelector
90
91 // The taint that gets applied to matching devices.
92 "taint"!: #DeviceTaint
93}
94
95// DeviceTaintRuleStatus provides information about an on-going pod eviction.
96#DeviceTaintRuleStatus: {
97 // Conditions provide information about the state of the DeviceTaintRule and the
98 // cluster at some point in time, in a machine-readable and human-readable
99 // format.
100 //
101 // The following condition is currently defined as part of this API, more may
102 // get added: - Type: EvictionInProgress - Status: True if there are currently
103 // pods which need to be evicted, False otherwise
104 // (includes the effects which don't cause eviction).
105 // - Reason: not specified, may change - Message: includes information about
106 // number of pending pods and already evicted pods
107 // in a human-readable format, updated periodically, may change
108 //
109 // For `effect: None`, the condition above gets set once for each change to the
110 // spec, with the message containing information about what would happen if the
111 // effect was `NoExecute`. This feedback can be used to decide whether changing
112 // the effect to `NoExecute` will work as intended. It only gets set once to
113 // avoid having to constantly update the status.
114 //
115 // Must have 8 or fewer entries.
116 "conditions"?: [...v1.#Condition]
117}
118
119// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. The
120// empty selector matches all devices. Without a selector, no devices are
121// matched.
122#DeviceTaintSelector: {
123 // If device is set, only devices with that name are selected. This field
124 // corresponds to slice.spec.devices[].name.
125 //
126 // Setting also driver and pool may be required to avoid ambiguity, but is not required.
127 "device"?: string
128
129 // If driver is set, only devices from that driver are selected. This fields
130 // corresponds to slice.spec.driver.
131 "driver"?: string
132
133 // If pool is set, only devices in that pool are selected.
134 //
135 // Also setting the driver name may be useful to avoid ambiguity when different
136 // drivers use the same pool name, but this is not required because selecting
137 // pools from different drivers may also be useful, for example when drivers
138 // with node-local devices use the node name as their pool name.
139 "pool"?: string
140}
141
142// PoolStatus contains status information for a single resource pool.
143#PoolStatus: {
144 // AllocatedDevices is the number of devices currently allocated to claims. A
145 // value of 0 means no devices are allocated. May be unset when validationError
146 // is set.
147 "allocatedDevices"?: int32 & int
148
149 // AvailableDevices is the number of devices available for allocation. This
150 // equals TotalDevices - AllocatedDevices - UnavailableDevices. A value of 0
151 // means no devices are currently available. May be unset when validationError
152 // is set.
153 "availableDevices"?: int32 & int
154
155 // Driver is the DRA driver name for this pool. Must be a DNS subdomain (e.g., "gpu.example.com").
156 "driver"!: string
157
158 // Generation is the pool generation observed across all ResourceSlices in this
159 // pool. Only the latest generation is reported. During a generation rollout,
160 // if not all slices at the latest generation have been published, the pool is
161 // included with a validationError and device counts unset.
162 "generation"!: int64 & int
163
164 // NodeName is the node this pool is associated with. When omitted, the pool is
165 // not associated with a specific node. Must be a valid DNS subdomain name
166 // (RFC1123).
167 "nodeName"?: string
168
169 // PoolName is the name of the pool. Must be a valid resource pool name (DNS
170 // subdomains separated by "/").
171 "poolName"!: string
172
173 // ResourceSliceCount is the number of ResourceSlices that make up this pool.
174 // May be unset when validationError is set.
175 "resourceSliceCount"?: int32 & int
176
177 // TotalDevices is the total number of devices in the pool across all slices. A
178 // value of 0 means the pool has no devices. May be unset when validationError
179 // is set.
180 "totalDevices"?: int32 & int
181
182 // UnavailableDevices is the number of devices that are not available due to
183 // taints or other conditions, but are not allocated. A value of 0 means all
184 // unallocated devices are available. May be unset when validationError is set.
185 "unavailableDevices"?: int32 & int
186
187 // ValidationError is set when the pool's data could not be fully validated
188 // (e.g., incomplete slice publication). When set, device count fields and
189 // ResourceSliceCount may be unset.
190 "validationError"?: string
191}
192
193// ResourcePoolStatusRequest triggers a one-time calculation of resource pool
194// status based on the provided filters. Once status is set, the request is
195// considered complete and will not be reprocessed. Users should delete and
196// recreate requests to get updated information.
197#ResourcePoolStatusRequest: {
198 // APIVersion defines the versioned schema of this representation of an object.
199 // Servers should convert recognized schemas to the latest internal value, and
200 // may reject unrecognized values. More info:
201 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
202 "apiVersion": "resource.k8s.io/v1alpha3"
203
204 // Kind is a string value representing the REST resource this object represents.
205 // Servers may infer this from the endpoint the client submits requests to.
206 // Cannot be updated. In CamelCase. More info:
207 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
208 "kind": "ResourcePoolStatusRequest"
209
210 // Standard object metadata
211 "metadata"!: v1.#ObjectMeta
212
213 // Spec defines the filters for which pools to include in the status. The spec
214 // is immutable once created.
215 "spec"!: #ResourcePoolStatusRequestSpec
216
217 // Status is populated by the controller with the calculated pool status. When
218 // status is non-nil, the request is considered complete and the entire object
219 // becomes immutable.
220 "status"?: #ResourcePoolStatusRequestStatus
221}
222
223// ResourcePoolStatusRequestList is a collection of ResourcePoolStatusRequests.
224#ResourcePoolStatusRequestList: {
225 // APIVersion defines the versioned schema of this representation of an object.
226 // Servers should convert recognized schemas to the latest internal value, and
227 // may reject unrecognized values. More info:
228 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
229 "apiVersion": "resource.k8s.io/v1alpha3"
230
231 // Items is the list of ResourcePoolStatusRequests.
232 "items"!: [...#ResourcePoolStatusRequest]
233
234 // Kind is a string value representing the REST resource this object represents.
235 // Servers may infer this from the endpoint the client submits requests to.
236 // Cannot be updated. In CamelCase. More info:
237 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
238 "kind": "ResourcePoolStatusRequestList"
239
240 // Standard list metadata
241 "metadata"?: v1.#ListMeta
242}
243
244// ResourcePoolStatusRequestSpec defines the filters for the pool status request.
245#ResourcePoolStatusRequestSpec: {
246 // Driver specifies the DRA driver name to filter pools. Only pools from
247 // ResourceSlices with this driver will be included. Must be a DNS subdomain
248 // (e.g., "gpu.example.com").
249 "driver"!: string
250
251 // Limit optionally specifies the maximum number of pools to return in the
252 // status. If more pools match the filter criteria, the response will be
253 // truncated (i.e., len(status.pools) < status.poolCount).
254 //
255 // Default: 100 Minimum: 1 Maximum: 1000
256 "limit"?: int32 & int
257
258 // PoolName optionally filters to a specific pool name. If not specified, all
259 // pools from the specified driver are included. When specified, must be a
260 // non-empty valid resource pool name (DNS subdomains separated by "/").
261 "poolName"?: string
262}
263
264// ResourcePoolStatusRequestStatus contains the calculated pool status information.
265#ResourcePoolStatusRequestStatus: {
266 // Conditions provide information about the state of the request. A condition
267 // with type=Complete or type=Failed will always be set when the status is
268 // populated.
269 //
270 // Known condition types: - "Complete": True when the request has been processed
271 // successfully - "Failed": True when the request could not be processed
272 "conditions"?: [...v1.#Condition]
273
274 // PoolCount is the total number of pools that matched the filter criteria,
275 // regardless of truncation. This helps users understand how many pools exist
276 // even when the response is truncated. A value of 0 means no pools matched the
277 // filter criteria.
278 "poolCount"!: int32 & int
279
280 // Pools contains the first `spec.limit` matching pools, sorted by driver then
281 // pool name. If `len(pools) < poolCount`, the list was truncated. When
282 // omitted, no pools matched the request filters.
283 "pools"?: [...#PoolStatus]
284}