Skip to content

Commit

Permalink
Bugfix: update bundle status display also in case of errors
Browse files Browse the repository at this point in the history
Signed-off-by: Silvio Moioli <[email protected]>
  • Loading branch information
moio committed Dec 1, 2022
1 parent 7e934fe commit 1bb8fde
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/controllers/bundle/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,13 @@ func (h *handler) OnBundleChange(bundle *fleet.Bundle, status fleet.BundleStatus
}

if err := h.updateStatusAndTargets(&status, matchedTargets); err != nil {
updateDisplay(&status)
return nil, status, err
}

if status.ObservedGeneration != bundle.Generation {
if err := setResourceKey(&status, bundle, manifest, h.isNamespaced); err != nil {
updateDisplay(&status)
return nil, status, err
}
}
Expand All @@ -207,10 +209,7 @@ func (h *handler) OnBundleChange(bundle *fleet.Bundle, status fleet.BundleStatus

elapsed := time.Since(start)

status.Display.ReadyClusters = fmt.Sprintf("%d/%d",
status.Summary.Ready,
status.Summary.DesiredReady)
status.Display.State = string(summary.GetSummaryState(status.Summary))
updateDisplay(&status)

logrus.Debugf("OnBundleChange for bundle '%s' took %s", bundle.Name, elapsed)

Expand Down Expand Up @@ -405,3 +404,10 @@ func resetDeployment(target *target.Target, status *fleet.BundleStatus) {
status.NewlyCreated++
target.ResetDeployment()
}

func updateDisplay(status *fleet.BundleStatus) {
status.Display.ReadyClusters = fmt.Sprintf("%d/%d",
status.Summary.Ready,
status.Summary.DesiredReady)
status.Display.State = string(summary.GetSummaryState(status.Summary))
}

0 comments on commit 1bb8fde

Please sign in to comment.