diff --git a/pkg/controller/instanceset/pod_role_event_handler.go b/pkg/controller/instanceset/pod_role_event_handler.go index 237e755708c..f9ba68861b2 100644 --- a/pkg/controller/instanceset/pod_role_event_handler.go +++ b/pkg/controller/instanceset/pod_role_event_handler.go @@ -246,7 +246,7 @@ func updatePodRoleLabel(cli client.Client, reqCtx intctrlutil.RequestCtx, roleName = strings.ToLower(roleName) // update pod role label - patch := client.MergeFrom(pod.DeepCopy()) + newPod := pod.DeepCopy() role, ok := roleMap[roleName] switch ok { case true: @@ -258,8 +258,8 @@ func updatePodRoleLabel(cli client.Client, reqCtx intctrlutil.RequestCtx, if pod.Annotations == nil { pod.Annotations = map[string]string{} } - pod.Annotations[constant.LastRoleSnapshotVersionAnnotationKey] = version - return cli.Patch(ctx, pod, patch, inDataContext()) + newPod.Annotations[constant.LastRoleSnapshotVersionAnnotationKey] = version + return cli.Update(ctx, newPod, inDataContext()) } func inDataContext() *multicluster.ClientOption {