Skip to content

Commit a90e0b1

Browse files
bayazeeopenshift-merge-bot[bot]
authored andcommitted
Propagate tolerations through MIC/MBSC to build pods
Build pods created through the ModuleImagesConfig (MIC) and ModuleBuildSignConfig (MBSC) flow do not inherit tolerations from the parent Module, preventing scheduling on tainted nodes. Changes: - Add Tolerations field to ModuleImagesConfigSpec - Add Tolerations field to ModuleBuildSignConfigSpec - Update MIC.CreateOrPatch() to accept tolerations parameter - Update Module controller to pass tolerations to MIC - Update MBSC.CreateOrPatch() to copy tolerations from MIC - Update createMLD() to set tolerations from MBSC spec - Add unit tests for toleration propagation Signed-off-by: Mehdi Bayazee <[email protected]>
1 parent 63e8e7e commit a90e0b1

23 files changed

+418
-21
lines changed

api/v1beta1/modulebuildsignconfig_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ type ModuleBuildSignConfigSpec struct {
6060
// be pushed to a defined repository
6161
// +optional
6262
PushBuiltImage bool `json:"pushBuiltImage"`
63+
64+
// Tolerations specifies the tolerations for build/sign pods.
65+
// +optional
66+
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
6367
}
6468

6569
// BuildSignImageState contains the status of the image that was requested to be built/signed

api/v1beta1/moduleimagesconfig_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ type ModuleImagesConfigSpec struct {
8282
// and potential rebuild of all module images. Propagated from Module.spec.imageRebuildTriggerGeneration.
8383
// +optional
8484
ImageRebuildTriggerGeneration *int `json:"imageRebuildTriggerGeneration,omitempty"`
85+
86+
// Tolerations specifies the tolerations for build/sign pods.
87+
// +optional
88+
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
8589
}
8690

8791
type ModuleImageState struct {

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle-hub/manifests/kmm.sigs.x-k8s.io_modulebuildsignconfigs.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,46 @@ spec:
259259
Boolean flag that determines whether images built must also
260260
be pushed to a defined repository
261261
type: boolean
262+
tolerations:
263+
description: Tolerations specifies the tolerations for build/sign
264+
pods.
265+
items:
266+
description: |-
267+
The pod this Toleration is attached to tolerates any taint that matches
268+
the triple <key,value,effect> using the matching operator <operator>.
269+
properties:
270+
effect:
271+
description: |-
272+
Effect indicates the taint effect to match. Empty means match all taint effects.
273+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
274+
type: string
275+
key:
276+
description: |-
277+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
278+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
279+
type: string
280+
operator:
281+
description: |-
282+
Operator represents a key's relationship to the value.
283+
Valid operators are Exists and Equal. Defaults to Equal.
284+
Exists is equivalent to wildcard for value, so that a pod can
285+
tolerate all taints of a particular category.
286+
type: string
287+
tolerationSeconds:
288+
description: |-
289+
TolerationSeconds represents the period of time the toleration (which must be
290+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
291+
it is not set, which means tolerate the taint forever (do not evict). Zero and
292+
negative values will be treated as 0 (evict immediately) by the system.
293+
format: int64
294+
type: integer
295+
value:
296+
description: |-
297+
Value is the taint value the toleration matches to.
298+
If the operator is Exists, the value should be empty, otherwise just a regular string.
299+
type: string
300+
type: object
301+
type: array
262302
required:
263303
- images
264304
type: object

bundle-hub/manifests/kmm.sigs.x-k8s.io_moduleimagesconfigs.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,46 @@ spec:
263263
Boolean flag that determines whether images built must also
264264
be pushed to a defined repository
265265
type: boolean
266+
tolerations:
267+
description: Tolerations specifies the tolerations for build/sign
268+
pods.
269+
items:
270+
description: |-
271+
The pod this Toleration is attached to tolerates any taint that matches
272+
the triple <key,value,effect> using the matching operator <operator>.
273+
properties:
274+
effect:
275+
description: |-
276+
Effect indicates the taint effect to match. Empty means match all taint effects.
277+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
278+
type: string
279+
key:
280+
description: |-
281+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
282+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
283+
type: string
284+
operator:
285+
description: |-
286+
Operator represents a key's relationship to the value.
287+
Valid operators are Exists and Equal. Defaults to Equal.
288+
Exists is equivalent to wildcard for value, so that a pod can
289+
tolerate all taints of a particular category.
290+
type: string
291+
tolerationSeconds:
292+
description: |-
293+
TolerationSeconds represents the period of time the toleration (which must be
294+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
295+
it is not set, which means tolerate the taint forever (do not evict). Zero and
296+
negative values will be treated as 0 (evict immediately) by the system.
297+
format: int64
298+
type: integer
299+
value:
300+
description: |-
301+
Value is the taint value the toleration matches to.
302+
If the operator is Exists, the value should be empty, otherwise just a regular string.
303+
type: string
304+
type: object
305+
type: array
266306
type: object
267307
status:
268308
description: |-

bundle/manifests/kmm.sigs.x-k8s.io_modulebuildsignconfigs.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,46 @@ spec:
259259
Boolean flag that determines whether images built must also
260260
be pushed to a defined repository
261261
type: boolean
262+
tolerations:
263+
description: Tolerations specifies the tolerations for build/sign
264+
pods.
265+
items:
266+
description: |-
267+
The pod this Toleration is attached to tolerates any taint that matches
268+
the triple <key,value,effect> using the matching operator <operator>.
269+
properties:
270+
effect:
271+
description: |-
272+
Effect indicates the taint effect to match. Empty means match all taint effects.
273+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
274+
type: string
275+
key:
276+
description: |-
277+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
278+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
279+
type: string
280+
operator:
281+
description: |-
282+
Operator represents a key's relationship to the value.
283+
Valid operators are Exists and Equal. Defaults to Equal.
284+
Exists is equivalent to wildcard for value, so that a pod can
285+
tolerate all taints of a particular category.
286+
type: string
287+
tolerationSeconds:
288+
description: |-
289+
TolerationSeconds represents the period of time the toleration (which must be
290+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
291+
it is not set, which means tolerate the taint forever (do not evict). Zero and
292+
negative values will be treated as 0 (evict immediately) by the system.
293+
format: int64
294+
type: integer
295+
value:
296+
description: |-
297+
Value is the taint value the toleration matches to.
298+
If the operator is Exists, the value should be empty, otherwise just a regular string.
299+
type: string
300+
type: object
301+
type: array
262302
required:
263303
- images
264304
type: object

bundle/manifests/kmm.sigs.x-k8s.io_moduleimagesconfigs.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,46 @@ spec:
263263
Boolean flag that determines whether images built must also
264264
be pushed to a defined repository
265265
type: boolean
266+
tolerations:
267+
description: Tolerations specifies the tolerations for build/sign
268+
pods.
269+
items:
270+
description: |-
271+
The pod this Toleration is attached to tolerates any taint that matches
272+
the triple <key,value,effect> using the matching operator <operator>.
273+
properties:
274+
effect:
275+
description: |-
276+
Effect indicates the taint effect to match. Empty means match all taint effects.
277+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
278+
type: string
279+
key:
280+
description: |-
281+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
282+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
283+
type: string
284+
operator:
285+
description: |-
286+
Operator represents a key's relationship to the value.
287+
Valid operators are Exists and Equal. Defaults to Equal.
288+
Exists is equivalent to wildcard for value, so that a pod can
289+
tolerate all taints of a particular category.
290+
type: string
291+
tolerationSeconds:
292+
description: |-
293+
TolerationSeconds represents the period of time the toleration (which must be
294+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
295+
it is not set, which means tolerate the taint forever (do not evict). Zero and
296+
negative values will be treated as 0 (evict immediately) by the system.
297+
format: int64
298+
type: integer
299+
value:
300+
description: |-
301+
Value is the taint value the toleration matches to.
302+
If the operator is Exists, the value should be empty, otherwise just a regular string.
303+
type: string
304+
type: object
305+
type: array
266306
type: object
267307
status:
268308
description: |-

config/crd-hub/bases/kmm.sigs.x-k8s.io_modulebuildsignconfigs.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,46 @@ spec:
255255
Boolean flag that determines whether images built must also
256256
be pushed to a defined repository
257257
type: boolean
258+
tolerations:
259+
description: Tolerations specifies the tolerations for build/sign
260+
pods.
261+
items:
262+
description: |-
263+
The pod this Toleration is attached to tolerates any taint that matches
264+
the triple <key,value,effect> using the matching operator <operator>.
265+
properties:
266+
effect:
267+
description: |-
268+
Effect indicates the taint effect to match. Empty means match all taint effects.
269+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
270+
type: string
271+
key:
272+
description: |-
273+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
274+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
275+
type: string
276+
operator:
277+
description: |-
278+
Operator represents a key's relationship to the value.
279+
Valid operators are Exists and Equal. Defaults to Equal.
280+
Exists is equivalent to wildcard for value, so that a pod can
281+
tolerate all taints of a particular category.
282+
type: string
283+
tolerationSeconds:
284+
description: |-
285+
TolerationSeconds represents the period of time the toleration (which must be
286+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
287+
it is not set, which means tolerate the taint forever (do not evict). Zero and
288+
negative values will be treated as 0 (evict immediately) by the system.
289+
format: int64
290+
type: integer
291+
value:
292+
description: |-
293+
Value is the taint value the toleration matches to.
294+
If the operator is Exists, the value should be empty, otherwise just a regular string.
295+
type: string
296+
type: object
297+
type: array
258298
required:
259299
- images
260300
type: object

config/crd-hub/bases/kmm.sigs.x-k8s.io_moduleimagesconfigs.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,46 @@ spec:
259259
Boolean flag that determines whether images built must also
260260
be pushed to a defined repository
261261
type: boolean
262+
tolerations:
263+
description: Tolerations specifies the tolerations for build/sign
264+
pods.
265+
items:
266+
description: |-
267+
The pod this Toleration is attached to tolerates any taint that matches
268+
the triple <key,value,effect> using the matching operator <operator>.
269+
properties:
270+
effect:
271+
description: |-
272+
Effect indicates the taint effect to match. Empty means match all taint effects.
273+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
274+
type: string
275+
key:
276+
description: |-
277+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
278+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
279+
type: string
280+
operator:
281+
description: |-
282+
Operator represents a key's relationship to the value.
283+
Valid operators are Exists and Equal. Defaults to Equal.
284+
Exists is equivalent to wildcard for value, so that a pod can
285+
tolerate all taints of a particular category.
286+
type: string
287+
tolerationSeconds:
288+
description: |-
289+
TolerationSeconds represents the period of time the toleration (which must be
290+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
291+
it is not set, which means tolerate the taint forever (do not evict). Zero and
292+
negative values will be treated as 0 (evict immediately) by the system.
293+
format: int64
294+
type: integer
295+
value:
296+
description: |-
297+
Value is the taint value the toleration matches to.
298+
If the operator is Exists, the value should be empty, otherwise just a regular string.
299+
type: string
300+
type: object
301+
type: array
262302
type: object
263303
status:
264304
description: |-

0 commit comments

Comments
 (0)