mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-06-09 08:55:55 -04:00
Avoid the API call to update pod if nothing is changed
Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
parent
92e51c1901
commit
77056e89e4
1 changed files with 5 additions and 0 deletions
|
|
@ -133,6 +133,11 @@ func PatchPod(cs kubernetes.Interface, old *v1.Pod, new *v1.Pod) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to create merge patch for pod %q/%q: %v", old.Namespace, old.Name, err)
|
||||
}
|
||||
|
||||
if "{}" == string(patchBytes) {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err = cs.CoreV1().Pods(old.Namespace).Patch(context.TODO(), old.Name, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{}, "status")
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue