Skip to content

Commit 6c9d857

Browse files
committed
use patch instead of update
1 parent 552c94d commit 6c9d857

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/controller/postgrescluster/postgres.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,8 @@ func (r *Reconciler) updateCustomSecretLabels(
613613
return errors.Wrap(err, fmt.Sprintf("failed to get user %s secret %s", userName, secretName))
614614
}
615615

616+
orig := secret.DeepCopy()
617+
616618
requiredLabels := map[string]string{
617619
naming.LabelCluster: cluster.Name,
618620
naming.LabelPostgresUser: userName,
@@ -631,7 +633,7 @@ func (r *Reconciler) updateCustomSecretLabels(
631633
}
632634

633635
if needsUpdate {
634-
return errors.WithStack(r.Client.Update(ctx, secret))
636+
return errors.WithStack(r.Client.Patch(ctx, secret.DeepCopy(), client.MergeFrom(orig)))
635637
}
636638

637639
return nil

0 commit comments

Comments
 (0)