Skip to content

Commit

Permalink
use patch instead of update for height updates from version-check
Browse files Browse the repository at this point in the history
  • Loading branch information
agouin committed Nov 6, 2023
1 parent ff3610b commit 9410556
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/versioncheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,15 @@ func checkVersion(
}
}

if crd.Status.Height == nil {
crd.Status.Height = make(map[string]uint64)
patch := crd.DeepCopy()
if patch.Status.Height == nil {
patch.Status.Height = make(map[string]uint64)
}

crd.Status.Height[thisPod.Name] = uint64(height)
patch.Status.Height[thisPod.Name] = uint64(height)

if err := kClient.Status().Update(
ctx, crd,
if err := kClient.Status().Patch(
ctx, patch, client.StrategicMergeFrom(crd.DeepCopy()),
); err != nil {
return fmt.Errorf("failed to patch status: %w", err)
}
Expand Down

0 comments on commit 9410556

Please sign in to comment.