SIGN IN SIGN UP

kubelet/dra: derive claim names from claim info cache

unprepareResourcesForPod derived the claim names to unprepare from
pod.Status.ResourceClaimStatuses via resourceclaim.Name(). That status
field is owned by the resourceclaim controller, not the kubelet, and can
be missing by the time the pod is torn down, for example when another
controller overwrites the pod status with a full PUT that does not
preserve it. When that happens resourceclaim.Name() returns
ErrClaimNotFound, unprepareResourcesForPod treats it as fatal, and
SyncTerminatingPod retries forever, keeping the pod in Terminating
state (kubernetes #139772).

The claim info cache is the authoritative record of what was actually
prepared for a pod: PrepareResources stores a reference to every prepared
claim keyed by claim name and pod UID and checkpoints it, so it survives
kubelet restarts.

Derive the claim names from the cache by pod UID instead. Fall back to
the pod-derived names only when nothing is cached.

Add a regression test covering a pod that references its claim via a
template with an empty Status.ResourceClaimStatuses.
E
Ed Bartosh committed
4106aed9c81d38793fc1c26a1dcdec942081b9a4
Parent: 7ee6abc