Skip to content

Commit 4fa7610

Browse files
committed
Update critical annotations when a resource exists
Signed-off-by: twobiers <[email protected]>
1 parent 5eca344 commit 4fa7610

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/reconciler/managed/reconciler.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,17 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (resu
14081408
return reconcile.Result{Requeue: true}, errors.Wrap(r.client.Status().Update(ctx, managed), errUpdateManagedStatus)
14091409
}
14101410

1411+
if observation.ResourceExists {
1412+
// When a resource exists or is just created, it might have received
1413+
// a non-deterministic external name, which we need to persist.
1414+
// We do this by updating the critical annotations.
1415+
if err := r.managed.UpdateCriticalAnnotations(ctx, managed); err != nil {
1416+
log.Debug(errUpdateManagedAnnotations, "error", err)
1417+
record.Event(managed, event.Warning(reasonCannotUpdateManaged, errors.Wrap(err, errUpdateManagedAnnotations)))
1418+
return reconcile.Result{Requeue: true}, errors.Wrap(r.client.Status().Update(ctx, managed), errUpdateManagedAnnotations)
1419+
}
1420+
}
1421+
14111422
if observation.ResourceLateInitialized && policy.ShouldLateInitialize() {
14121423
// Note that this update may reset any pending updates to the status of
14131424
// the managed resource from when it was observed above. This is because

0 commit comments

Comments
 (0)