diff --git a/pkg/reconciler/managed/api.go b/pkg/reconciler/managed/api.go index b1b4a30..0f1801a 100644 --- a/pkg/reconciler/managed/api.go +++ b/pkg/reconciler/managed/api.go @@ -218,15 +218,25 @@ func NewRetryingCriticalAnnotationUpdater(c client.Client) *RetryingCriticalAnno // UpdateCriticalAnnotations updates (i.e. persists) the annotations of the // supplied Object. It retries in the face of any API server error several times // in order to ensure annotations that contain critical state are persisted. -// Pending changes to the supplied Object's spec, status, or other metadata -// might get reset to their current state according to the API server, e.g. in -// case of a conflict error. +// Only annotations will be updated as part of this operation, other fields of the +// supplied Object will not be modified. func (u *RetryingCriticalAnnotationUpdater) UpdateCriticalAnnotations(ctx context.Context, o client.Object) error { a := o.GetAnnotations() err := retry.OnError(retry.DefaultRetry, func(err error) bool { return !errors.Is(err, context.Canceled) }, func() error { - err := u.client.Update(ctx, o) + patchMap := map[string]interface{}{ + "metadata": map[string]any{ + "annotations": a, + }, + } + + patchData, err := json.Marshal(patchMap) + if err != nil { + return err + } + + err = u.client.Patch(ctx, o, client.RawPatch(types.MergePatchType, patchData), client.FieldOwner(fieldOwnerAPISimpleRefResolver), client.ForceOwnership) if kerrors.IsConflict(err) { if getErr := u.client.Get(ctx, client.ObjectKeyFromObject(o), o); getErr != nil { return getErr diff --git a/pkg/reconciler/managed/api_test.go b/pkg/reconciler/managed/api_test.go index 9a9310e..35f97af 100644 --- a/pkg/reconciler/managed/api_test.go +++ b/pkg/reconciler/managed/api_test.go @@ -420,12 +420,12 @@ func TestRetryingCriticalAnnotationUpdater(t *testing.T) { o client.Object } - setLabels := func(obj client.Object) error { - obj.SetLabels(map[string]string{"getcalled": "true"}) + setAnnotations := func(obj client.Object) error { + obj.SetAnnotations(map[string]string{"getcalled": "true"}) return nil } objectReturnedByGet := &fake.Managed{} - setLabels(objectReturnedByGet) + setAnnotations(objectReturnedByGet) cases := map[string]struct { reason string @@ -436,8 +436,8 @@ func TestRetryingCriticalAnnotationUpdater(t *testing.T) { "UpdateConflictGetError": { reason: "We should return any error we encounter getting the supplied object", c: &test.MockClient{ - MockGet: test.NewMockGetFn(errBoom, setLabels), - MockUpdate: test.NewMockUpdateFn(kerrors.NewConflict(schema.GroupResource{ + MockGet: test.NewMockGetFn(errBoom, setAnnotations), + MockPatch: test.NewMockPatchFn(kerrors.NewConflict(schema.GroupResource{ Group: "foo.com", Resource: "bars", }, "abc", errBoom)), @@ -453,8 +453,8 @@ func TestRetryingCriticalAnnotationUpdater(t *testing.T) { "UpdateError": { reason: "We should return any error we encounter updating the supplied object", c: &test.MockClient{ - MockGet: test.NewMockGetFn(nil, setLabels), - MockUpdate: test.NewMockUpdateFn(errBoom), + MockGet: test.NewMockGetFn(nil, setAnnotations), + MockPatch: test.NewMockPatchFn(errBoom), }, args: args{ o: &fake.Managed{}, @@ -467,8 +467,8 @@ func TestRetryingCriticalAnnotationUpdater(t *testing.T) { "SuccessfulGetAfterAConflict": { reason: "A successful get after a conflict should not hide the conflict error and prevent retries", c: &test.MockClient{ - MockGet: test.NewMockGetFn(nil, setLabels), - MockUpdate: test.NewMockUpdateFn(kerrors.NewConflict(schema.GroupResource{ + MockGet: test.NewMockGetFn(nil, setAnnotations), + MockPatch: test.NewMockPatchFn(kerrors.NewConflict(schema.GroupResource{ Group: "foo.com", Resource: "bars", }, "abc", errBoom)), @@ -487,8 +487,8 @@ func TestRetryingCriticalAnnotationUpdater(t *testing.T) { "Success": { reason: "We should return without error if we successfully update our annotations", c: &test.MockClient{ - MockGet: test.NewMockGetFn(nil, setLabels), - MockUpdate: test.NewMockUpdateFn(errBoom), + MockGet: test.NewMockGetFn(nil, setAnnotations), + MockPatch: test.NewMockPatchFn(errBoom), }, args: args{ o: &fake.Managed{}, diff --git a/pkg/reconciler/managed/reconciler.go b/pkg/reconciler/managed/reconciler.go index 4d51888..629d1b5 100644 --- a/pkg/reconciler/managed/reconciler.go +++ b/pkg/reconciler/managed/reconciler.go @@ -1332,6 +1332,21 @@ func (r *Reconciler) Reconcile(ctx context.Context, req reconcile.Request) (resu return reconcile.Result{Requeue: true}, errors.Wrap(r.client.Status().Update(ctx, managed), errUpdateManagedStatus) } + if observation.ResourceExists { + // When a resource exists or is just created, it might have received + // a non-deterministic external name after its creation, which we need to persist. + // We do this by updating the critical annotations. + // This is needed because some resources might not receive an external-name directly + // after the creation, but later as part of an asynchronous process. + // When Crossplane supports asynchronous creation of resources natively, this logic + // might not be needed anymore and can be revisited. + if err := r.managed.UpdateCriticalAnnotations(ctx, managed); err != nil { + log.Debug(errUpdateManagedAnnotations, "error", err) + record.Event(managed, event.Warning(reasonCannotUpdateManaged, errors.Wrap(err, errUpdateManagedAnnotations))) + return reconcile.Result{Requeue: true}, errors.Wrap(r.client.Status().Update(ctx, managed), errUpdateManagedAnnotations) + } + } + if observation.ResourceLateInitialized && policy.ShouldLateInitialize() { // Note that this update may reset any pending updates to the status of // the managed resource from when it was observed above. This is because diff --git a/pkg/reconciler/managed/reconciler_test.go b/pkg/reconciler/managed/reconciler_test.go index 3fc6df4..87fa9a6 100644 --- a/pkg/reconciler/managed/reconciler_test.go +++ b/pkg/reconciler/managed/reconciler_test.go @@ -297,7 +297,8 @@ func TestReconciler(t *testing.T) { args: args{ m: &fake.Manager{ Client: &test.MockClient{ - MockGet: managedMockGetFn(nil, 42), + MockGet: managedMockGetFn(nil, 42), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetConditions(xpv1.ReconcileSuccess().WithObservedGeneration(42)) @@ -692,6 +693,7 @@ func TestReconciler(t *testing.T) { Client: &test.MockClient{ MockGet: managedMockGetFn(nil, 42), MockUpdate: test.NewMockUpdateFn(errBoom), + MockPatch: test.NewMockPatchFn(errBoom), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) meta.SetExternalCreatePending(want, time.Now()) @@ -738,6 +740,7 @@ func TestReconciler(t *testing.T) { Client: &test.MockClient{ MockGet: managedMockGetFn(nil, 42), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) meta.SetExternalCreatePending(want, time.Now()) @@ -787,6 +790,7 @@ func TestReconciler(t *testing.T) { Client: &test.MockClient{ MockGet: managedMockGetFn(nil, 42), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(errBoom), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) meta.SetExternalCreatePending(want, time.Now()) @@ -833,6 +837,7 @@ func TestReconciler(t *testing.T) { Client: &test.MockClient{ MockGet: managedMockGetFn(nil, 42), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) meta.SetExternalCreatePending(want, time.Now()) @@ -891,6 +896,7 @@ func TestReconciler(t *testing.T) { Client: &test.MockClient{ MockGet: managedMockGetFn(nil, 42), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) meta.SetExternalCreatePending(want, time.Now()) @@ -929,6 +935,7 @@ func TestReconciler(t *testing.T) { return nil }), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) meta.SetExternalCreatePending(want, time.Now()) @@ -963,6 +970,7 @@ func TestReconciler(t *testing.T) { m: &fake.Manager{ Client: &test.MockClient{ MockGet: managedMockGetFn(nil, 42), + MockPatch: test.NewMockPatchFn(nil), MockUpdate: test.NewMockUpdateFn(errBoom), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) @@ -1002,7 +1010,8 @@ func TestReconciler(t *testing.T) { args: args{ m: &fake.Manager{ Client: &test.MockClient{ - MockGet: managedMockGetFn(nil, 42), + MockGet: managedMockGetFn(nil, 42), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetConditions(xpv1.ReconcileSuccess().WithObservedGeneration(42)) @@ -1041,7 +1050,8 @@ func TestReconciler(t *testing.T) { args: args{ m: &fake.Manager{ Client: &test.MockClient{ - MockGet: managedMockGetFn(nil, 42), + MockGet: managedMockGetFn(nil, 42), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), @@ -1084,7 +1094,8 @@ func TestReconciler(t *testing.T) { args: args{ m: &fake.Manager{ Client: &test.MockClient{ - MockGet: managedMockGetFn(nil, 42), + MockGet: managedMockGetFn(nil, 42), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), @@ -1122,7 +1133,8 @@ func TestReconciler(t *testing.T) { args: args{ m: &fake.Manager{ Client: &test.MockClient{ - MockGet: managedMockGetFn(nil, 42), + MockGet: managedMockGetFn(nil, 42), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), @@ -1164,7 +1176,8 @@ func TestReconciler(t *testing.T) { args: args{ m: &fake.Manager{ Client: &test.MockClient{ - MockGet: managedMockGetFn(nil, 42), + MockGet: managedMockGetFn(nil, 42), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetConditions(xpv1.ReconcileError(errors.Wrap(errBoom, errReconcileUpdate)).WithObservedGeneration(42)) @@ -1206,7 +1219,8 @@ func TestReconciler(t *testing.T) { args: args{ m: &fake.Manager{ Client: &test.MockClient{ - MockGet: managedMockGetFn(nil, 42), + MockGet: managedMockGetFn(nil, 42), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetConditions(xpv1.ReconcileError(errBoom).WithObservedGeneration(42)) @@ -1259,7 +1273,8 @@ func TestReconciler(t *testing.T) { args: args{ m: &fake.Manager{ Client: &test.MockClient{ - MockGet: managedMockGetFn(nil, 42), + MockGet: managedMockGetFn(nil, 42), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetConditions(xpv1.ReconcileSuccess().WithObservedGeneration(42)) @@ -1301,7 +1316,8 @@ func TestReconciler(t *testing.T) { args: args{ m: &fake.Manager{ Client: &test.MockClient{ - MockGet: managedMockGetFn(nil, 42), + MockGet: managedMockGetFn(nil, 42), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetConditions(xpv1.ReconcileSuccess().WithObservedGeneration(42)) @@ -1350,6 +1366,7 @@ func TestReconciler(t *testing.T) { mg.SetAnnotations(map[string]string{meta.AnnotationKeyReconciliationPaused: "true"}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetAnnotations(map[string]string{meta.AnnotationKeyReconciliationPaused: "true"}) @@ -1377,6 +1394,7 @@ func TestReconciler(t *testing.T) { mg.SetManagementPolicies(xpv1.ManagementPolicies{}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{}) @@ -1411,6 +1429,7 @@ func TestReconciler(t *testing.T) { mg.SetConditions(xpv1.ReconcilePaused()) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetAnnotations(map[string]string{meta.AnnotationKeyReconciliationPaused: "false"}) @@ -1455,6 +1474,7 @@ func TestReconciler(t *testing.T) { mg.SetAnnotations(map[string]string{meta.AnnotationKeyReconciliationPaused: "true"}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return errBoom }), @@ -1475,6 +1495,7 @@ func TestReconciler(t *testing.T) { mg.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionCreate}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionCreate}) @@ -1502,6 +1523,7 @@ func TestReconciler(t *testing.T) { mg.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionCreate}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionCreate}) @@ -1532,6 +1554,7 @@ func TestReconciler(t *testing.T) { mg.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionAll}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionAll}) @@ -1563,6 +1586,7 @@ func TestReconciler(t *testing.T) { mg.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionObserve}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionObserve}) @@ -1605,6 +1629,7 @@ func TestReconciler(t *testing.T) { mg.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionObserve}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionObserve}) @@ -1652,6 +1677,7 @@ func TestReconciler(t *testing.T) { mg.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionObserve}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionObserve}) @@ -1701,6 +1727,7 @@ func TestReconciler(t *testing.T) { return nil }), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionAll}) @@ -1741,6 +1768,7 @@ func TestReconciler(t *testing.T) { return nil }), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionAll}) @@ -1781,6 +1809,7 @@ func TestReconciler(t *testing.T) { return nil }), MockUpdate: test.NewMockUpdateFn(errBoom), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionObserve, xpv1.ManagementActionLateInitialize, xpv1.ManagementActionCreate, xpv1.ManagementActionDelete}) @@ -1829,6 +1858,7 @@ func TestReconciler(t *testing.T) { mg.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionAll}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionAll}) @@ -1877,6 +1907,7 @@ func TestReconciler(t *testing.T) { mg.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionAll}) return nil }), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionAll}) @@ -1926,6 +1957,7 @@ func TestReconciler(t *testing.T) { return nil }), MockUpdate: test.NewMockUpdateFn(errBoom), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, obj client.Object, _ ...client.SubResourceUpdateOption) error { want := newManaged(42) want.SetManagementPolicies(xpv1.ManagementPolicies{xpv1.ManagementActionObserve, xpv1.ManagementActionUpdate, xpv1.ManagementActionCreate, xpv1.ManagementActionDelete}) @@ -1972,6 +2004,7 @@ func TestReconciler(t *testing.T) { return nil }), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), @@ -2001,6 +2034,7 @@ func TestReconciler(t *testing.T) { return nil }), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), @@ -2499,6 +2533,7 @@ func TestReconcilerChangeLogs(t *testing.T) { Client: &test.MockClient{ MockGet: managedMockGetFn(nil, 42), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), }, Scheme: fake.SchemeWith(&fake.Managed{}), @@ -2536,6 +2571,7 @@ func TestReconcilerChangeLogs(t *testing.T) { Client: &test.MockClient{ MockGet: managedMockGetFn(nil, 42), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), }, Scheme: fake.SchemeWith(&fake.Managed{}), @@ -2574,6 +2610,7 @@ func TestReconcilerChangeLogs(t *testing.T) { Client: &test.MockClient{ MockGet: managedMockGetFn(nil, 42), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), }, Scheme: fake.SchemeWith(&fake.Managed{}), @@ -2611,6 +2648,7 @@ func TestReconcilerChangeLogs(t *testing.T) { Client: &test.MockClient{ MockGet: managedMockGetFn(nil, 42), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), }, Scheme: fake.SchemeWith(&fake.Managed{}), @@ -2655,6 +2693,7 @@ func TestReconcilerChangeLogs(t *testing.T) { return nil }), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), }, Scheme: fake.SchemeWith(&fake.Managed{}), @@ -2698,6 +2737,7 @@ func TestReconcilerChangeLogs(t *testing.T) { return nil }), MockUpdate: test.NewMockUpdateFn(nil), + MockPatch: test.NewMockPatchFn(nil), MockStatusUpdate: test.MockSubResourceUpdateFn(func(_ context.Context, _ client.Object, _ ...client.SubResourceUpdateOption) error { return nil }), }, Scheme: fake.SchemeWith(&fake.Managed{}),