Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on fluxcd/pkg#422
This change introduces progressive status across all the reconcilers. It uses the helpers and checks proposed in fluxcd/pkg#422 to implement and verify the result of the change.
Mid-reconciliation status
Before this change, the reconcilers patched the target object of reconciliation only once, at the end of the reconciliation to report the final result of the reconciliation. The change in the status that took place during reconciliation were not reflected on the object. As described in #936, this resulted in stale status reported on the object. This also resulted in not reporting the progressive status of the reconciliation, which made it hard to understand if an object is undergoing reconciliation or not, refer #935 .
In order to perform multiple status updates on the object during reconciliation, a serial patcher was introduced in fluxcd/pkg#379 . This patcher is a drop-in replacement for the previous patch helper. It keeps track of the previously patched object and constructs subsequent patch based on the previously patched object.
To perform mid-reconciliation patching, all the sub-reconcilers need an instance of the patcher. This change extends the sub-reconciler function signature to allow passing the patcher.
When reconciliation of an object begins, the object is immediately marked with
Reconciling=True
. If it's a new object generation or reconciliation is manually requested using the reconcile annotation value, the reconciling status is patched and reported on the object.In the
reconcileStorage()
phase, if there's no artifact in the storage or an existing artifact disappeared from the storage, it is considered as a drift and is immediately reported on the object by patching the status.In the
reconcileSource()
phase, if a drift is detected in the artifact or the included artifact, it is again considered as a drift and is immediately reported on the object by patching the status.All the sub-reconciler tests have been updated accordingly with in-progress status condition check.
Reconciled status
In order to indicate that a reconciliation has resulted in a failure and reconciliation will be retried, the
Reconciling=True
condition is updated withProgressingWithRetry
reason. Kustomize-controller already does this.After a full reconciliation, if the reconciliation didn't succeed and
Reconciling
is stillTrue
, theComputeReconcileResult()
helper is updated to add theReconciling=True
reason withProgressingWithRetry
.Subsequent reconciliation updates the
Reconciling=True
reason withProgressing
to indicate that a reconciliation is in progress.SummarizeAndPatch()
has been updated to replace the previous patch helper with the serial patcher.Fixes #936, #935
Snippets showing the result of this change with status output:
Except for HelmRepository OCI reconciler, all the other reconcilers have similar implementations. Their status results should be similar.