Skip to content

Commit 33e9f42

Browse files
authored
Merge pull request #5391 from sbueringer/pr-clustertoobjectsmapper-use-objectlist
⚠️ ClusterToObjectsMapper: replace runtime.Object parameter with client.ObjectList
2 parents 0cec440 + 62cebab commit 33e9f42

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

util/util.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,7 @@ func (o MachinesByCreationTimestamp) Less(i, j int) bool {
483483
// ClusterToObjectsMapper returns a mapper function that gets a cluster and lists all objects for the object passed in
484484
// and returns a list of requests.
485485
// NB: The objects are required to have `clusterv1.ClusterLabelName` applied.
486-
func ClusterToObjectsMapper(c client.Client, ro runtime.Object, scheme *runtime.Scheme) (handler.MapFunc, error) {
487-
if _, ok := ro.(metav1.ListInterface); !ok {
488-
return nil, errors.Errorf("expected a metav1.ListInterface, got %T instead", ro)
489-
}
490-
486+
func ClusterToObjectsMapper(c client.Client, ro client.ObjectList, scheme *runtime.Scheme) (handler.MapFunc, error) {
491487
gvk, err := apiutil.GVKForObject(ro, scheme)
492488
if err != nil {
493489
return nil, err

util/util_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ func TestClusterToObjectsMapper(t *testing.T) {
600600
table := []struct {
601601
name string
602602
objects []client.Object
603-
input runtime.Object
603+
input client.ObjectList
604604
output []ctrl.Request
605605
expectError bool
606606
}{

0 commit comments

Comments
 (0)