Skip to content

Commit 46bb7a2

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 46bb7a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/runtime/reconciler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ func (r *resourceReconciler) Sync(
428428
resolved, hasReferences, err := rm.ResolveReferences(ctx, r.apiReader, desired)
429429
rlog.Exit("rm.ResolveReferences", err)
430430
// TODO (michaelhtm): should we fail here for `adopt-or-create` adoption policy?
431-
if err != nil && !needAdoption && !isReadOnly {
431+
if err != nil && adoptionPolicy == AdoptionPolicy_AdoptOrCreate && !isReadOnly {
432432
return ackcondition.WithReferencesResolvedCondition(desired, err), err
433433
}
434434
if hasReferences {

0 commit comments

Comments
 (0)