Reconciliation loop
Modules
Each time a new Module is created, we need to find to which nodes it applies.
-
A first filtering is performed using the
.spec.selectorfield, then we go through the module’s kernel mappings to find a container image that matches the node’s kernel. -
We end up with a certain number of (kernel, image) pairs; for each of these pairs, there should be a
DaemonSet. -
We first look for a
DaemonSetthat would already be targeting the same kernel and DriverContainer image (that data is stored in theDaemonSet’s labels). -
If there is already such a
DaemonSet, we patch it, if needed. -
If there is not already a matching
DaemonSet, we create it and set theModuleas owner. -
When a
Moduleis deleted, we have nothing to do: because we set it as owner of allDaemonSets, Kubernetes garbage collection will take care of deleting them. -
We watch
Module, ownedDaemonSetand build objects as well as nodes to make sure that we are not missing any change in the cluster.

DRA
A separate DRA reconciler watches Module resources that have .spec.dra set.
-
When a
Modulehas.spec.draconfigured, the DRA reconciler creates a DRA driverDaemonSettargeting nodes where the kernel module is loaded. -
It also creates and manages cluster-scoped
DeviceClassresources as declared in.spec.dra.deviceClasses. DeviceClasses are tracked via labels (kmm.node.kubernetes.io/module.nameandkmm.node.kubernetes.io/module.namespace) since they are cluster-scoped while Modules are namespaced. -
When
spec.drais removed or theModuleis deleted, the reconciler deletes all associated DRADaemonSetandDeviceClassresources. -
During ordered upgrades, a new DRA
DaemonSetis created for the new module version. Once the old-versionDaemonSetis no longer scheduled on any node, it is garbage-collected.