Skip to main content

AddTolerationsForExtendedResources

Adds tolerations to a PodSpec for extended resources requested by its containers. It identifies extended resources configured to require tolerations and applies a 'NoSchedule' toleration for each such resource to the PodSpec.

def AddTolerationsForExtendedResources(
podSpec: *v1.PodSpec
) - > *v1.PodSpec

Adds tolerations to a Kubernetes PodSpec for extended resources requested by its containers. This function ensures that pods requesting specific extended resources can be scheduled on nodes that are tainted with those resources, preventing scheduling failures.

Parameters

NameTypeDescription
podSpec*v1.PodSpecThe Kubernetes PodSpec to which tolerations will be added. If nil, a new PodSpec will be initialized.

Returns

TypeDescription
*v1.PodSpecThe modified PodSpec with added tolerations. If the input podSpec was nil, a new empty PodSpec is returned with tolerations added.