Skip to content

Commit

Permalink
[Bugfix] Use patch not update method to modify statefulset and deploy…
Browse files Browse the repository at this point in the history
…ment (#397)

Signed-off-by: yandongxiao <[email protected]>
  • Loading branch information
yandongxiao authored Jan 16, 2024
1 parent 51f9935 commit b437e47
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/k8sutils/k8sutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func ApplyDeployment(ctx context.Context, k8sClient client.Client, deploy *appv1
deploy.Annotations = map[string]string{}
}
deploy.Annotations[srapi.ComponentResourceHash] = expectHash
return UpdateClientObject(ctx, k8sClient, deploy)
return k8sClient.Patch(ctx, deploy, client.Merge)
}

func ApplyConfigMap(ctx context.Context, k8sClient client.Client, configmap *corev1.ConfigMap) error {
Expand Down Expand Up @@ -170,7 +170,7 @@ func ApplyStatefulSet(ctx context.Context, k8sClient client.Client, expect *appv
}

expect.ResourceVersion = actual.ResourceVersion
return UpdateClientObject(ctx, k8sClient, expect)
return k8sClient.Patch(ctx, expect, client.Merge)
}

func CreateClientObject(ctx context.Context, k8sClient client.Client, object client.Object) error {
Expand Down

0 comments on commit b437e47

Please sign in to comment.