Skip to content

Commit b37978f

Browse files
authored
Merge pull request kubernetes#133334 from macsko/fix_potential_race_in_patchpodstatus_api_call_implementation
Fix potential race in PodStatusPatchCall implementation
2 parents ea81dd6 + 9eda478 commit b37978f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/scheduler/framework/api_calls/pod_status_patch.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,12 @@ func (psuc *PodStatusPatchCall) Sync(obj metav1.Object) (metav1.Object, error) {
127127
// because otherwise it's irrelevant and might race.
128128
psuc.podStatus = pod.Status.DeepCopy()
129129
}
130+
newCondition := psuc.newCondition.DeepCopy()
130131
psuc.lock.Unlock()
131132

132133
podCopy := pod.DeepCopy()
133134
// Sync passed pod's status with the call's condition and nominatingInfo.
134-
synced := syncStatus(&podCopy.Status, psuc.newCondition, psuc.nominatingInfo)
135+
synced := syncStatus(&podCopy.Status, newCondition, psuc.nominatingInfo)
135136
if !synced {
136137
return pod, nil
137138
}

0 commit comments

Comments
 (0)