cue.dev/x/k8s.io@v0.8.0

api/resource/v1alpha3/schema.cue raw

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