Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/fsm/internal/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ func (r *fsmReconciler[T, Obj]) reconcile(
}

if err := r.applyOutputs(ctx, log, obj, out); err != nil {
// Mark the state's condition as failed since outputs couldn't be applied
if !condition.IsEmpty() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we do this even if the condition isn't empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question, let me think about it. The only weird part of that would be what is the condition type since we are overriding other fields here? Should it just be empty? 🤔

The IsEmpty returns true only if all fields are empty - https://github.com/reddit/achilles-sdk-api/blob/main/api/condition.go#L115

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also seem to do this same check when setting any other fields for the condition too -

if !condition.IsEmpty() {

condition.Status = corev1.ConditionFalse
condition.Reason = "ApplyOutputsFailed"
condition.Message = fmt.Sprintf("Failed to apply outputs: %v", err)
conditions.SetConditions(condition)
}
return obj, conditions, types.ErrorResult(fmt.Errorf("applying outputs: %w", err))
}

Expand Down