Skip to content

Commit 96355b6

Browse files
authored
Merge pull request #6 from surajkota/requeue_condition
requeue based on conditions even if resource is in sync
2 parents ac9c44c + b709d00 commit 96355b6

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

pkg/runtime/reconciler.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -204,29 +204,29 @@ func (r *reconciler) sync(
204204
)
205205
} else {
206206
// Check to see if the latest observed state already matches the
207-
// desired state and if so, simply return since there's nothing to do
208-
if r.rd.Equal(desired, latest) {
209-
return nil
210-
}
211-
diffReporter := r.rd.Diff(desired, latest)
212-
log.V(1).Info(
213-
"desired resource state has changed",
214-
"diff", diffReporter.String(),
215-
"arn", latest.Identifiers().ARN(),
216-
)
217-
latest, err = rm.Update(ctx, desired, latest, diffReporter)
218-
if err != nil {
219-
if latest != nil {
220-
// this indicates, that even though update failed
221-
// there is some changes available in the latest.RuntimeObject()
222-
// (example: ko.Status.Conditions) which have been
223-
// updated in the resource
224-
// Thus, patchResource() call should be made here
225-
_ = r.patchResource(ctx, desired, latest)
207+
// desired state and if not, update the resource
208+
if !r.rd.Equal(desired, latest) {
209+
diffReporter := r.rd.Diff(desired, latest)
210+
log.V(1).Info(
211+
"desired resource state has changed",
212+
"diff", diffReporter.String(),
213+
"arn", latest.Identifiers().ARN(),
214+
)
215+
latest, err = rm.Update(ctx, desired, latest, diffReporter)
216+
if err != nil {
217+
if latest != nil {
218+
// this indicates, that even though update failed
219+
// there is some changes available in the latest.RuntimeObject()
220+
// (example: ko.Status.Conditions) which have been
221+
// updated in the resource
222+
// Thus, patchResource() call should be made here
223+
_ = r.patchResource(ctx, desired, latest)
224+
}
225+
return err
226226
}
227-
return err
227+
log.V(0).Info("updated resource")
228+
228229
}
229-
log.V(0).Info("updated resource")
230230
}
231231
err = r.patchResource(ctx, desired, latest)
232232
if err != nil {

0 commit comments

Comments
 (0)