Skip to content

Commit b59d658

Browse files
committed
fix: report resolve references errors for adopt-or-create
Currently we have been ignoring `ResolveReferences` errors for all adoptions and readOnly. Ignoring the error for `adopt-or-create` is an antipattern, since we want to ensure users are aware of these issues. In the case of `adopt`, since the spec will fully be rewritten, we would not need to resolve references at all.
1 parent 2ab09c6 commit b59d658

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/runtime/reconciler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,8 @@ func (r *resourceReconciler) Sync(
427427
rlog.Enter("rm.ResolveReferences")
428428
resolved, hasReferences, err := rm.ResolveReferences(ctx, r.apiReader, desired)
429429
rlog.Exit("rm.ResolveReferences", err)
430-
// TODO (michaelhtm): should we fail here for `adopt-or-create` adoption policy?
431-
if err != nil && !needAdoption && !isReadOnly {
430+
// TODO (michaelhtm): ignore error only for `adopt` or `read-only`
431+
if err != nil && (adoptionPolicy == "" || adoptionPolicy == AdoptionPolicy_AdoptOrCreate) && !isReadOnly {
432432
return ackcondition.WithReferencesResolvedCondition(desired, err), err
433433
}
434434
if hasReferences {

0 commit comments

Comments
 (0)