Skip to content

Commit

Permalink
reconcile: improve observability between actions
Browse files Browse the repository at this point in the history
- Change the log-level of "action determination" to "debug".
- Set `Ready=Unknown` while working on an install or upgrade.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
  • Loading branch information
hiddeco committed Nov 3, 2023
1 parent 628b6cb commit 7c5c23a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/reconcile/atomic_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (r *AtomicRelease) Reconcile(ctx context.Context, req *Request) error {
return fmt.Errorf("atomic release canceled: %w", ctx.Err())
default:
// Determine the next action to run based on the current state.
log.Info("determining next Helm action based on current state")
log.V(logger.DebugLevel).Info("determining next Helm action based on current state")
if next, err = NextAction(ctx, r.configFactory, r.eventRecorder, req); err != nil {
log.Error(err, "cannot determine next action")
if errors.Is(err, ErrNoRetriesRemain) {
Expand Down Expand Up @@ -187,8 +187,18 @@ func (r *AtomicRelease) Reconcile(ctx context.Context, req *Request) error {

// Mark the release as reconciling before we attempt to run the action.
// This to show continuous progress, as Helm actions can be long-running.
conditions.MarkTrue(req.Object, meta.ReconcilingCondition, "Progressing", "Running '%s' %s action with timeout of %s",
reconcilingMsg := fmt.Sprintf("Running '%s' %s action with timeout of %s",
next.Name(), next.Type(), timeoutForAction(next, req.Object).String())
conditions.MarkTrue(req.Object, meta.ReconcilingCondition, "Progressing", reconcilingMsg)

// If the next action is a release action, we can mark the release
// as progressing in terms of readiness as well. Doing this for any
// other action type is not useful, as it would potentially
// overwrite more important failure state from an earlier action.
if next.Type() == ReconcilerTypeRelease {
conditions.MarkUnknown(req.Object, meta.ReadyCondition, "Progressing", reconcilingMsg)
}

// Patch the object to reflect the new condition.
if err = r.patchHelper.Patch(ctx, req.Object, patch.WithOwnedConditions{Conditions: OwnedConditions}, patch.WithFieldOwner(r.fieldManager)); err != nil {
return err
Expand Down

0 comments on commit 7c5c23a

Please sign in to comment.