Skip to content

Commit

Permalink
Restore support in ChildReconciler for unstructured resources (#362)
Browse files Browse the repository at this point in the history
Adding a duplicate test suite for ChildReconciler using unstructured
parent and child resources.

Signed-off-by: Scott Andrews <andrewssc@vmware.com>
  • Loading branch information
scothis committed Apr 24, 2023
1 parent 492f3d0 commit d3c6f93
Show file tree
Hide file tree
Showing 3 changed files with 1,004 additions and 4 deletions.
6 changes: 3 additions & 3 deletions reconcilers/reconcilers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ func (r *ChildReconciler[T, CT, CLT]) Reconcile(ctx context.Context, resource T)
// the created child from a previous turn may be slow to appear in the informer cache, but shouldn't appear
// on the reconciled resource as being not ready.
apierr := err.(apierrs.APIStatus)
conflicted := newEmpty(r.ChildType).(CT)
conflicted := r.ChildType.DeepCopyObject().(CT)
_ = c.APIReader.Get(ctx, types.NamespacedName{Namespace: resource.GetNamespace(), Name: apierr.Status().Details.Name}, conflicted)
if r.ourChild(resource, conflicted) {
// skip updating the reconciled resource's status, fail and try again
Expand All @@ -1145,8 +1145,8 @@ func (r *ChildReconciler[T, CT, CLT]) reconcile(ctx context.Context, resource T)
pc := RetrieveOriginalConfigOrDie(ctx)
c := RetrieveConfigOrDie(ctx)

actual := newEmpty(r.ChildType).(CT)
children := newEmpty(r.ChildListType).(CLT)
actual := r.ChildType.DeepCopyObject().(CT)
children := r.ChildListType.DeepCopyObject().(CLT)
if err := c.List(ctx, children, r.listOptions(ctx, resource)...); err != nil {
return nilCT, err
}
Expand Down
Loading

0 comments on commit d3c6f93

Please sign in to comment.