Expected Behavior
Followup from this thread in Slack #serving-api
If ObservedGeneration == Generation, I expect that the object's Status reflects the actual status of the resource.
Actual Behavior
If the reconcile is written to return errors early, then the Status may not be fully accurate.
Example from @mattmoor:
foo.Status.ObsGen = foo.Gen
if bar, err := reconcileFoo(); err != nil {
// What happens here?
return err
} if bar.Something() {
bar.Status.MarkSomething()
}
foo.Status.MarkReady()
return nil
If the reconciler returns on line 4, then the statuses of the Something and Ready conditions actually reflect the previous generation's status, not the current generation.
Additional Info
One solution mentioned in the thread is to re-initialize status to fully unknown at the beginning of every reconcile so that no information is carried over from the previous generation. This works for non-timestamped status fields like address, but is suboptimal for conditions as it would make lastTransitionTime inaccurate.
Instead of replacing each condition, we could mark existing conditions before reconcile and unmark them when updated during reconcile. After the reconcile, any conditions that are still marked are set to unknown. This preserves the functionality of lastTransitionTime.
@dprotaso @markusthoemmes @mattmoor @vaikas
Expected Behavior
Followup from this thread in Slack #serving-api
If ObservedGeneration == Generation, I expect that the object's Status reflects the actual status of the resource.
Actual Behavior
If the reconcile is written to return errors early, then the Status may not be fully accurate.
Example from @mattmoor:
If the reconciler returns on line 4, then the statuses of the
SomethingandReadyconditions actually reflect the previous generation's status, not the current generation.Additional Info
One solution mentioned in the thread is to re-initialize status to fully unknown at the beginning of every reconcile so that no information is carried over from the previous generation. This works for non-timestamped status fields like
address, but is suboptimal for conditions as it would makelastTransitionTimeinaccurate.Instead of replacing each condition, we could mark existing conditions before reconcile and unmark them when updated during reconcile. After the reconcile, any conditions that are still marked are set to unknown. This preserves the functionality of
lastTransitionTime.@dprotaso @markusthoemmes @mattmoor @vaikas