Skip to content

Commit 05a9c06

Browse files
committed
Don't update checkpoint file for deletion
1 parent 30bca32 commit 05a9c06

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/kubelet/allocation/state/state_checkpoint.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ func (sc *stateCheckpoint) SetPodResourceAllocation(podUID types.UID, alloc map[
142142
func (sc *stateCheckpoint) Delete(podUID types.UID, containerName string) error {
143143
sc.mux.Lock()
144144
defer sc.mux.Unlock()
145-
sc.cache.Delete(podUID, containerName)
146-
return sc.storeState()
145+
// Skip writing the checkpoint for pod deletion, since there is no side effect to
146+
// keeping a deleted pod. Deleted pods will eventually be cleaned up by RemoveOrphanedPods.
147+
// The deletion will be stored the next time a non-delete update is made.
148+
return sc.cache.Delete(podUID, "")
147149
}
148150

149151
func (sc *stateCheckpoint) RemoveOrphanedPods(remainingPods sets.Set[types.UID]) {

0 commit comments

Comments
 (0)