Skip to content

Commit

Permalink
fix: use update instand of patch to set pod's role
Browse files Browse the repository at this point in the history
  • Loading branch information
xuriwuyun committed Jan 23, 2025
1 parent 851f1b8 commit 7eec25c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/controller/instanceset/pod_role_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 {
Expand Down

0 comments on commit 7eec25c

Please sign in to comment.