From 6b5783c4537bd2367e1fd7345e085b0617c4ae5f Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Thu, 12 May 2022 11:54:20 -0400 Subject: [PATCH] Don't PATCH Ready annotation if it's already marked ready --- pkg/pod/entrypoint.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/pod/entrypoint.go b/pkg/pod/entrypoint.go index d1aaa30a06d..02c35a3ad3a 100644 --- a/pkg/pod/entrypoint.go +++ b/pkg/pod/entrypoint.go @@ -213,6 +213,11 @@ func init() { // UpdateReady updates the Pod's annotations to signal the first step to start // by projecting the ready annotation via the Downward API. func UpdateReady(ctx context.Context, kubeclient kubernetes.Interface, pod corev1.Pod) error { + // Don't PATCH if the annotation is already Ready. + if pod.Annotations[readyAnnotation] == readyAnnotationValue { + return nil + } + // PATCH the Pod's annotations to replace the ready annotation with the // "READY" value, to signal the first step to start. _, err := kubeclient.CoreV1().Pods(pod.Namespace).Patch(ctx, pod.Name, types.JSONPatchType, replaceReadyPatchBytes, metav1.PatchOptions{})