Skip to main content

AddPreferredNodeSelectorRequirements

Appends the provided v1.NodeSelectorRequirement objects to an existing v1.Affinity object's list of preferred scheduling terms. See: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity-weight for how weights are used during scheduling.

def AddPreferredNodeSelectorRequirements(
base: *v1.Affinity,
weight: int32,
new: ...v1.NodeSelectorRequirement
)

Appends the provided v1.NodeSelectorRequirement objects to an existing v1.Affinity object's list of preferred scheduling terms. This function is used to specify node affinity preferences during pod scheduling, allowing pods to be preferentially scheduled to nodes that satisfy certain criteria.

Parameters

NameTypeDescription
base*v1.AffinityThe base v1.Affinity object to which the preferred node selector requirements will be added. If its NodeAffinity field is nil, it will be initialized.
weightint32The weight associated with the preferred scheduling term. Higher weights indicate a stronger preference for nodes matching the criteria. This value must be between 1 and 100.
new...v1.NodeSelectorRequirementOne or more v1.NodeSelectorRequirement objects that define the criteria for selecting preferred nodes. These requirements specify key-value pairs and operators to match node labels.