tl;dr:
Whenever the fsmReconciler fails to applyOutputs(), the object's Ready status is always unexpectedly True 🙀
Details
The "Ready" condition's status is always set to:
True if all other conditions are True; or,
False if any other condition is False
However, when the fsmReconciler fails to applyOutputs(), no False condition is ever set within the returned conditions!
|
if err := r.applyOutputs(ctx, log, obj, out); err != nil { |
|
return obj, conditions, types.ErrorResult(fmt.Errorf("applying outputs: %w", err)) |
|
} |
|
|
|
// accumulate status conditions, overwrites duplicate conditions with those of later states |
|
if !condition.IsEmpty() { |
|
conditions.SetConditions(condition) |
|
} |
As a result, the resource's Ready status will always show as True despite this failure.
Proposed Fix
All other code paths through the main loop seem to apply the current condition to conditions before returning:
So perhaps failures applying outputs should take any non-empty condition and:
- Falsify the status
- Set the reason and message to something indicating the failure to apply resources
- Set that onto
conditions before returning
That would align the condition handling with the other code paths and ensure that output failures don't cause the resource to report an "incorrect" status of being ready.
tl;dr:
Whenever the
fsmReconcilerfails toapplyOutputs(), the object'sReadystatus is always unexpectedlyTrue🙀Details
The "Ready" condition's status is always set to:
Trueif all other conditions areTrue; or,Falseif any other condition isFalseHowever, when the
fsmReconcilerfails toapplyOutputs(), noFalsecondition is ever set within the returnedconditions!achilles-sdk/pkg/fsm/internal/reconciler.go
Lines 288 to 295 in 23adbe7
As a result, the resource's
Readystatus will always show asTruedespite this failure.Proposed Fix
All other code paths through the main loop seem to apply the current
conditiontoconditionsbefore returning:When the result is not done:
achilles-sdk/pkg/fsm/internal/reconciler.go
Lines 272 to 280 in 23adbe7
When the result is done, and the outputs are applied successfully:
achilles-sdk/pkg/fsm/internal/reconciler.go
Lines 292 to 295 in 23adbe7
So perhaps failures applying outputs should take any non-empty
conditionand:conditionsbefore returningThat would align the condition handling with the other code paths and ensure that output failures don't cause the resource to report an "incorrect" status of being ready.