@@ -115,6 +115,39 @@ spec:
115115The worker Pod will first try to unload the in-tree `mod_b` before loading `mod_a` from the kmod image.
116116When the worker Pod is terminated and `mod_a` is unloaded, `mod_b` will not be loaded again.
117117
118+ # ## Forcing module image rebuilds
119+
120+ When KMM builds a kmod image in-cluster, it first checks if the target image already exists in the registry.
121+ If it does, the build is skipped.
122+ However, in some situations the images may no longer exist in the registry even though KMM believes they do.
123+ This can happen when using an image registry with ephemeral storage : registry contents are lost on restart, node drain,
124+ or rollout, but KMM still believes the images exist and attempts to use them, causing failures on the nodes.
125+
126+ To force KMM to re-verify image existence and rebuild images if necessary, set or change the
127+ `.spec.imageRebuildTriggerGeneration` field in the `Module` resource :
128+
129+ ` ` ` yaml
130+ apiVersion: kmm.sigs.x-k8s.io/v1beta1
131+ kind: Module
132+ metadata:
133+ name: my-kmod
134+ spec:
135+ imageRebuildTriggerGeneration: 1 # Change this value, or set it if it is not set, to trigger a rebuild
136+ moduleLoader:
137+ # ...
138+ ` ` `
139+
140+ When KMM detects that the value of `.spec.imageRebuildTriggerGeneration` differs from the value stored in
141+ `.status.imageRebuildTriggerGeneration`, it will :
142+
143+ 1. re-verify image existence for all kernel mappings;
144+ 2. trigger builds for images that need to be rebuilt.
145+
146+ After the rebuild process completes, KMM updates `.status.imageRebuildTriggerGeneration` to match the spec value.
147+
148+ !!! note
149+ This field is optional. If not set, KMM behaves as before and only builds images that do not exist in the registry.
150+
118151# ## Supporting Modules without OOT kmods
119152In some cases, there is a need to configure the KMM Module to avoid loading an out-of-tree kernel module and
120153instead use the in-tree one, running only the device plugin.
@@ -239,6 +272,10 @@ spec:
239272 imageRepoSecret : # Optional. Used to pull kmod and device plugin images
240273 name : secret-name
241274
275+ # Optional. Change this value to force KMM to re-verify and potentially rebuild all module images.
276+ # See "Forcing module image rebuilds" section for details.
277+ imageRebuildTriggerGeneration : 1
278+
242279 selector :
243280 node-role.kubernetes.io/worker : " "
244281` ` `
0 commit comments