Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,20 @@ func Reconcile(ctx context.Context, k8sClient client.Client, expected appsv1.Sta
update(&expected, existed.(*appsv1.StatefulSet))
},
})
return *reconciled.(*appsv1.StatefulSet), err
// reconciler.Reconcile can return (nil, err) when the downstream
// Create/Update failed; the previous unconditional type assertion
// panicked the reconciler with 'interface conversion: client.Object
// is nil, not *v1.StatefulSet' and crash-looped the operator. Fall
// back to the expected object so the controller receives a valid
// StatefulSet alongside the error and schedules a requeue.
if err != nil || reconciled == nil {
return expected, err
}
sts, ok := reconciled.(*appsv1.StatefulSet)
if !ok || sts == nil {
return expected, err
}
return *sts, err
}

func needUpdate(expected, existed *appsv1.StatefulSet) bool {
Expand Down