reconcile: Set observed gen only when conditions exist#729
Conversation
|
Looks like it's minio again: *** Test killed with quit: ran too long (11m0s).
FAIL github.com/fluxcd/source-controller/pkg/minio 660.006s |
|
IMO this is a regression bug fix not an enhancement |
|
I haven't verified that it fixes the CLI issue. Couldn't reproduce it locally by creating a GitRepo and Kustomization rapidly based on the example in https://github.com/fluxcd/flux2-multi-tenancy/blob/50ad87d14542a09249bfe761b441078f12b4053f/.github/workflows/e2e.yaml#L43 . Need to try it in flux2-multi-tenancy CI. |
|
This is indeed a bug and not an enhancement as it was not working as intended, even if this would not pose an issue to the CLI. |
The observed generation must be set only when actual observation is made. When an actual observation is made, some conditions are set on the object. Introduce a helper function addPatchOptionWithStatusObservedGeneration() to set the patcher option WithStatusObservedGeneration only when there's any condition in the status. Updates the existing tests that depended on this behavior. This fixes the issue where the observed generation is set by the patcher when a reconciler does an early return for setting the finalizers only. With this, the observed generation will be updated only when some observations are made on the object based on the usual rules of success result, no error, ignore error and stalled condition. Signed-off-by: Sunny <darkowlzz@protonmail.com>
02a2959 to
3213179
Compare
The observed generation must be set only when actual observation is
made. When an actual observation is made, some conditions are set on the
object. Introduce a helper function
addPatchOptionWithStatusObservedGeneration()to set the patcher optionWithStatusObservedGenerationonly when there's any condition in thestatus.
Updates the existing tests that depended on this behavior.
This fixes the issue where the observed generation is set by the patcher
when a reconciler does an early return for setting the finalizers only.
With this, the observed generation will be updated only when some
observations are made on the object based on the usual rules of success
result, no error, ignore error and stalled condition.
After finalizer setting reconcile -
Before this change:
After this change:
Ref: fluxcd/flux2#2736