Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions api/v1alpha1/operatorconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -121,6 +122,12 @@ type OSBuildsConfig struct {
// Example: {"dedicated": "builds", "disktype": "ssd"}
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`

// Tolerations specifies tolerations to be added to build pods
// Enables scheduling on tainted nodes for dedicated/exclusive access
// Example: [{"key": "automotive.sdv.cloud.redhat.com/dedicated", "operator": "Equal", "value": "builds", "effect": "NoSchedule"}]
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
}

// OperatorConfigStatus defines the observed state of OperatorConfig
Expand Down
8 changes: 8 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,48 @@ spec:
Default: 24
format: int32
type: integer
tolerations:
description: |-
Tolerations specifies tolerations to be added to build pods
Enables scheduling on tainted nodes for dedicated/exclusive access
Example: [{"key": "automotive.sdv.cloud.redhat.com/dedicated", "operator": "Equal", "value": "builds", "effect": "NoSchedule"}]
items:
description: |-
The pod this Toleration is attached to tolerates any taint that matches
the triple <key,value,effect> using the matching operator <operator>.
properties:
effect:
description: |-
Effect indicates the taint effect to match. Empty means match all taint effects.
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
type: string
key:
description: |-
Key is the taint key that the toleration applies to. Empty means match all taint keys.
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
type: string
operator:
description: |-
Operator represents a key's relationship to the value.
Valid operators are Exists and Equal. Defaults to Equal.
Exists is equivalent to wildcard for value, so that a pod can
tolerate all taints of a particular category.
type: string
tolerationSeconds:
description: |-
TolerationSeconds represents the period of time the toleration (which must be
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
it is not set, which means tolerate the taint forever (do not evict). Zero and
negative values will be treated as 0 (evict immediately) by the system.
format: int64
type: integer
value:
description: |-
Value is the taint value the toleration matches to.
If the operator is Exists, the value should be empty, otherwise just a regular string.
type: string
type: object
type: array
useMemoryVolumes:
description: UseMemoryVolumes determines whether to use memory-backed
volumes for build operations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,48 @@ spec:
Default: 24
format: int32
type: integer
tolerations:
description: |-
Tolerations specifies tolerations to be added to build pods
Enables scheduling on tainted nodes for dedicated/exclusive access
Example: [{"key": "automotive.sdv.cloud.redhat.com/dedicated", "operator": "Equal", "value": "builds", "effect": "NoSchedule"}]
items:
description: |-
The pod this Toleration is attached to tolerates any taint that matches
the triple <key,value,effect> using the matching operator <operator>.
properties:
effect:
description: |-
Effect indicates the taint effect to match. Empty means match all taint effects.
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
type: string
key:
description: |-
Key is the taint key that the toleration applies to. Empty means match all taint keys.
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
type: string
operator:
description: |-
Operator represents a key's relationship to the value.
Valid operators are Exists and Equal. Defaults to Equal.
Exists is equivalent to wildcard for value, so that a pod can
tolerate all taints of a particular category.
type: string
tolerationSeconds:
description: |-
TolerationSeconds represents the period of time the toleration (which must be
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
it is not set, which means tolerate the taint forever (do not evict). Zero and
negative values will be treated as 0 (evict immediately) by the system.
format: int64
type: integer
value:
description: |-
Value is the taint value the toleration matches to.
If the operator is Exists, the value should be empty, otherwise just a regular string.
type: string
type: object
type: array
useMemoryVolumes:
description: UseMemoryVolumes determines whether to use memory-backed
volumes for build operations
Expand Down
16 changes: 15 additions & 1 deletion config/samples/automotive_v1_operatorconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,18 @@ spec:
# - Target specific node pools: {"node-pool": "compute-intensive"}
# nodeSelector:
# dedicated: "builds"
# disktype: "ssd"
# disktype: "ssd"

# Optional: Tolerations for exclusive access to tainted nodes
# Enables scheduling on nodes tainted for dedicated automotive builds
# First taint nodes: kubectl taint nodes <node> automotive.sdv.cloud.redhat.com/dedicated=builds:NoSchedule
# Then configure tolerations to access those nodes:
# tolerations:
# - key: "automotive.sdv.cloud.redhat.com/dedicated"
# operator: "Equal"
# value: "builds"
# effect: "NoSchedule"
# - key: "node.kubernetes.io/dedicated"
# operator: "Equal"
# value: "automotive"
# effect: "NoExecute"
3 changes: 3 additions & 0 deletions internal/controller/imagebuild/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ func (r *ImageBuildReconciler) createBuildTaskRun(ctx context.Context, imageBuil
if operatorConfig.Spec.OSBuilds != nil && len(operatorConfig.Spec.OSBuilds.NodeSelector) > 0 {
podTemplate.NodeSelector = operatorConfig.Spec.OSBuilds.NodeSelector
}
if operatorConfig.Spec.OSBuilds != nil && len(operatorConfig.Spec.OSBuilds.Tolerations) > 0 {
podTemplate.Tolerations = operatorConfig.Spec.OSBuilds.Tolerations
}
if imageBuild.Spec.RuntimeClassName != "" {
log.Info("Setting RuntimeClassName from ImageBuild spec", "runtimeClassName", imageBuild.Spec.RuntimeClassName)
podTemplate.RuntimeClassName = &imageBuild.Spec.RuntimeClassName
Expand Down
Loading