Merge pull request #131577 from ndbaker1/automated-cherry-pick-of-#131251-origin-release-1.33

Automated cherry pick of #131251: fix(kubelet): acquire imageRecordsLock when removing image
This commit is contained in:
Kubernetes Prow Robot 2025-07-11 18:17:28 -07:00 committed by GitHub
commit 5158ef67a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -521,7 +521,10 @@ func (im *realImageGCManager) freeImage(ctx context.Context, image evictionInfo,
if isRuntimeClassInImageCriAPIEnabled {
imageKey = getImageTuple(image.id, image.runtimeHandlerUsedToPullImage)
}
im.imageRecordsLock.Lock()
delete(im.imageRecords, imageKey)
im.imageRecordsLock.Unlock()
metrics.ImageGarbageCollectedTotal.WithLabelValues(reason).Inc()
return err