Skip to content

Commit dbdf44c

Browse files
Auto-discover additional fields for cortex filtering (#40)
In [this pull request](cobaltcore-dev/cortex#441) we implemented a cortex filtering pipeline for KVM. This pipeline uses the hypervisor CRD as single source of truth to find out on which hypervisors a vm can be scheduled. To complete this implementation, we extended the hypervisor crd in [this pull request](cobaltcore-dev/openstack-hypervisor-operator#217). The hypervisor crd pull request added additional fields and removed outdated ones, which need to be autodiscovered in the kvm node agent. The following fields are now populated: Support filtering based on hypervisor type and other capabilities: - [x] Export the hypervisor type, architecture, supported devices, supported cpu modes, and supported features Capacity filtering: - [x] Aggregate the allocated and total available capacity and populate the corresponding fields (Bonus) - [x] Add numa cell capacity & allocation information so we can implement numa sensitive initial placement When done: - [x] Test with ssh-forwarded libvirt socket > [!NOTE] > The scope of this PR is to establish a minimum viable scheduling pipeline in cortex, with the least amount of changes possible. Refactorings of the hypervisor crd spec can follow if needed.
1 parent 9241311 commit dbdf44c

29 files changed

+4370
-726
lines changed

charts/kvm-node-agent/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: kvm-node-agent
33
description: A Helm chart for Kubernetes
44
appVersion: 0.1.0
5-
version: 0.1.7
5+
version: 0.1.6
66
type: application

charts/kvm-node-agent/crds/hypervisor-crd.yaml

Lines changed: 127 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ spec:
110110
items:
111111
type: string
112112
type: array
113+
allowedProjects:
114+
default: []
115+
description: |-
116+
AllowedProjects defines which openstack projects are allowed to schedule
117+
instances on this hypervisor. The values of this list should be project
118+
uuids. If left empty, all projects are allowed.
119+
items:
120+
type: string
121+
type: array
113122
createCertManagerCertificate:
114123
default: false
115124
description: |-
@@ -167,6 +176,7 @@ spec:
167176
type: string
168177
required:
169178
- aggregates
179+
- allowedProjects
170180
- createCertManagerCertificate
171181
- customTraits
172182
- evacuateOnReboot
@@ -184,8 +194,17 @@ spec:
184194
items:
185195
type: string
186196
type: array
197+
allocation:
198+
additionalProperties:
199+
anyOf:
200+
- type: integer
201+
- type: string
202+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
203+
x-kubernetes-int-or-string: true
204+
description: Auto-discovered resource allocation of all hosted VMs.
205+
type: object
187206
capabilities:
188-
description: The capabilities of the hypervisors as reported by libvirt.
207+
description: Auto-discovered capabilities as reported by libvirt.
189208
properties:
190209
cpuArch:
191210
default: unknown
@@ -208,6 +227,47 @@ spec:
208227
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
209228
x-kubernetes-int-or-string: true
210229
type: object
230+
capacity:
231+
additionalProperties:
232+
anyOf:
233+
- type: integer
234+
- type: string
235+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
236+
x-kubernetes-int-or-string: true
237+
description: Auto-discovered capacity of the hypervisor.
238+
type: object
239+
cells:
240+
description: Auto-discovered cells on this hypervisor.
241+
items:
242+
description: Cell represents a NUMA cell on the hypervisor.
243+
properties:
244+
allocation:
245+
additionalProperties:
246+
anyOf:
247+
- type: integer
248+
- type: string
249+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
250+
x-kubernetes-int-or-string: true
251+
description: Auto-discovered resource allocation of all hosted
252+
VMs in this cell.
253+
type: object
254+
capacity:
255+
additionalProperties:
256+
anyOf:
257+
- type: integer
258+
- type: string
259+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
260+
x-kubernetes-int-or-string: true
261+
description: Auto-discovered capacity of this cell.
262+
type: object
263+
cellID:
264+
description: Cell ID.
265+
format: int64
266+
type: integer
267+
required:
268+
- cellID
269+
type: object
270+
type: array
211271
conditions:
212272
description: Represents the Hypervisor node conditions.
213273
items:
@@ -265,6 +325,72 @@ spec:
265325
- type
266326
type: object
267327
type: array
328+
domainCapabilities:
329+
description: |-
330+
Auto-discovered domain capabilities relevant to check if a VM
331+
can be scheduled on the hypervisor.
332+
properties:
333+
arch:
334+
default: unknown
335+
description: The available domain cpu architecture.
336+
type: string
337+
hypervisorType:
338+
default: unknown
339+
description: The supported type of virtualization for domains,
340+
such as "ch".
341+
type: string
342+
supportedCpuModes:
343+
default: []
344+
description: |-
345+
Supported cpu modes for domains.
346+
347+
The format of this list is cpu mode, and if specified, a specific
348+
submode. For example, the take the following xml domain cpu definition:
349+
350+
<mode name='host-passthrough' supported='yes'>
351+
<enum name='hostPassthroughMigratable'/>
352+
</mode>
353+
354+
The corresponding entries in this list would be "host-passthrough" and
355+
"host-passthrough/migratable".
356+
items:
357+
type: string
358+
type: array
359+
supportedDevices:
360+
default: []
361+
description: |-
362+
Supported devices for domains.
363+
364+
The format of this list is the device type, and if specified, a specific
365+
model. For example, the take the following xml domain device definition:
366+
367+
<video supported='yes'>
368+
<enum name='modelType'>
369+
<value>nvidia</value>
370+
</enum>
371+
</video>
372+
373+
The corresponding entries in this list would be "video" and "video/nvidia".
374+
items:
375+
type: string
376+
type: array
377+
supportedFeatures:
378+
default: []
379+
description: |-
380+
Supported features for domains, such as "sev" or "sgx".
381+
382+
This is a flat list of supported features, meaning the following xml:
383+
384+
<features>
385+
<sev supported='no'/>
386+
<sgx supported='no'/>
387+
</features>
388+
389+
Would correspond to the entries "sev" and "sgx" in this list.
390+
items:
391+
type: string
392+
type: array
393+
type: object
268394
evicted:
269395
description: Evicted indicates whether the hypervisor is evicted.
270396
(no instances left with active maintenance mode)

0 commit comments

Comments
 (0)